MatrixWeighting
- class odl.core.space.weightings.weighting.MatrixWeighting(matrix, impl, device, exponent=2.0, **kwargs)[source]
Bases:
WeightingWeighting 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
- matrix
scipy.sparse.spmatrixor 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
matrixis a sparse matrix, only 1.0, 2.0 andinfare allowed.- precomp_mat_powbool, optional
If
True, precompute the matrix powerW ** (1/p)during initialization. This has no effect ifexponentis 1.0, 2.0 orinf.Default:
False- cache_mat_powbool, optional
If
True, cache the matrix powerW ** (1/p). This can happen either during initialization or in the first call tonormordist, resp. This has no effect ifexponentis 1.0, 2.0 orinf.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 tonormordist, resp. This has no effect ifexponentis 1.0, 2.0 orinf.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.
- matrix