Package csb :: Package numeric :: Class InvertibleMatrix |
[frames] | no frames]

# Class InvertibleMatrix

source code

    object --+
             |
            InvertibleMatrix

Matrix object which is intended to save time in MCMC sampling algorithms involving repeated integration of Hamiltonian equations of motion and frequent draws from multivariate normal distributions involving mass matrices as covariance matrices. It can be initialized either with the matrix one wants to use or its inverse. The main feature compared to standard numpy matrices / arrays is that it has also a property "inverse", which gives the inverse matrix. If the matrix (its inverse) is changed, the inverse (regular matrix) is calculated only when needed. This avoids costly matrix inversions.

Instance Methods
__array__(self, dtype=None) | source code
__div__(self, value) | source code
__eq__(self, other) | source code
__getitem__(self, loc) | source code
__idiv__(self, value) | source code
__imul__(self, value) | source code
__init__(self, matrix=None, inverse_matrix=None) x.__init__(...) initializes x; see help(type(x)) for signature | source code
__itruediv__(self, value) | source code
__len__(self) | source code
__mul__(self, value) | source code
__rmul__(self, value) | source code
__setitem__(self, i, value) | source code
__str__(self) str(x) | source code
__truediv__(self, value) | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Properties
| inverse
| is_unity_multiple This property can be used to save computation time when drawing from multivariate normal distributions with the covariance matrix given by an instance of this object.
Inherited from `object`: `__class__`

Method Details

### __init__(self, matrix=None, inverse_matrix=None) (Constructor) | source code
x.__init__(...) initializes x; see help(type(x)) for signature Parameters: `matrix` (invertible (n,n)-shaped numpy.ndarray) - matrix-like object with whose values the Matrix object is supposed to hold `inverse_matrix` (invertible (n,n)-shaped numpy.ndarray) - matrix-like object with whose inverse the Matrix object is supposed to hold Overrides: object.__init__ (inherited documentation)

### __str__(self) (Informal representation operator) | source code
str(x) Overrides: object.__str__ (inherited documentation)

Property Details

### inverse Get Method: unreachable.inverse(self) Set Method: unreachable.inverse(self, value)

### is_unity_multiple This property can be used to save computation time when drawing from multivariate normal distributions with the covariance matrix given by an instance of this object. By probing this property, one can instead draw from normal distributions and rescale the samples afterwards to avoid costly matrix inversions Get Method: unreachable.is_unity_multiple(self) - This property can be used to save computation time when drawing from multivariate normal distributions with the covariance matrix given by an instance of this object.