MatrixWeighting

class odl.core.space.weightings.weighting.MatrixWeighting(matrix, impl, device, exponent=2.0, **kwargs)[source]

Bases: Weighting

Weighting of a space by a matrix.

The exact definition of the weighted inner product, norm and distance functions depend on the concrete space.

The matrix must be Hermitian and posivive definite, otherwise it does not define an inner product or norm, respectively. This is not checked during initialization.

__init__(matrix, impl, device, exponent=2.0, **kwargs)[source]

Initialize a new instance.

Parameters

matrixscipy.sparse.spmatrix or 2-dim. array-like

Square weighting matrix of the inner product

implstring

Specifier for the implementation backend

device :

device identifier, compatible with the backend associated with impl

exponentpositive float, optional

Exponent of the norm. For values other than 2.0, the inner product is not defined. If matrix is a sparse matrix, only 1.0, 2.0 and inf are allowed.

precomp_mat_powbool, optional

If True, precompute the matrix power W ** (1/p) during initialization. This has no effect if exponent is 1.0, 2.0 or inf.

Default: False

cache_mat_powbool, optional

If True, cache the matrix power W ** (1/p). This can happen either during initialization or in the first call to norm or dist, resp. This has no effect if exponent is 1.0, 2.0 or inf.

Default: True

cache_mat_decompbool, optional

If True, cache the eigenbasis decomposition of the matrix. This can happen either during initialization or in the first call to norm or dist, resp. This has no effect if exponent is 1.0, 2.0 or inf.

Default: False

Notes

The matrix power W ** (1/p) is computed by eigenbasis decomposition:

eigval, eigvec = scipy.linalg.eigh(matrix)
mat_pow = (eigval ** p * eigvec).dot(eigvec.conj().T)

Depending on the matrix size, this can be rather expensive.