scipy.linalg.invhilbert

scipy.linalg.invhilbert(n, exact=False)

Compute the inverse of the Hilbert matrix of order n.

Parameters :

n : int

The order of the Hilbert matrix.

exact : bool

If False, the data type of the array that is returned in np.float64, and the array is an approximation of the inverse. If True, the array is exact integer array. To represent the exact inverse when n > 14, the returned array is an object array of long integers. For n <= 14, the exact inverse is returned as an array with data type np.int64.

Returns :

invh : ndarray with shape (n, n)

The data type of the array is np.float64 is exact is False. If exact is True, the data type is either np.int64 (for n <= 14) or object (for n > 14). In the latter case, the objects in the array will be long integers.

Notes

New in version 0.10.0.

Examples

>>> invhilbert(4)
array([[   16.,  -120.,   240.,  -140.],
       [ -120.,  1200., -2700.,  1680.],
       [  240., -2700.,  6480., -4200.],
       [ -140.,  1680., -4200.,  2800.]])
>>> invhilbert(4, exact=True)
array([[   16,  -120,   240,  -140],
       [ -120,  1200, -2700,  1680],
       [  240, -2700,  6480, -4200],
       [ -140,  1680, -4200,  2800]], dtype=int64)
>>> invhilbert(16)[7,7]
4.2475099528537506e+19
>>> invhilbert(16, exact=True)[7,7]
42475099528537378560L

Previous topic

scipy.linalg.hilbert

Next topic

scipy.linalg.leslie

This Page