Low Rank Matrix

class fastmat.LowRank

Bases: Product

Generally one can consider the “complexity” of a matrix as the number of its rows \(n\) and columns \(m\). The rank of a matrix \(A \in \mathbb{C}^{n \times m}\) always obeys the bound

\[\mathrm{rk}(A) \leqslant \min \{n,m\}.\]

If one carries out the normal matrix vector multiplication, one assumes the rank to be essentially close to this upper bound. However if the rank of \(A\) is far lower than the minimum of its dimensions, then one carries out a lot of redundant tasks, when applying this matrix to a vector. But if one computes the singular value decomposition (SVD) of \(A = U \Sigma V^\mathrm{H}\), then one can express \(A\) as a sum of rank-\(1\) matrices as

\[A = \sum\limits_{i = 1}^{r} \sigma_i u_{i} v^\mathrm{H}_{i}.\]

If \(r = \mathrm{rk}(A)\) is much smaller than the minimum of the dimensions, then one can save a lot of computational effort in applying \(A\) to a vector.

>>> # import the package
>>> import fastmat as fm
>>> import numpy as np
>>>
>>> # define all parameters
>>> S = np.random.randn(2)
>>> U = np.random.randn(20,2)
>>> V = np.random.randn(20,2)
>>>
>>> # define the matrix
>>> L = fm.LowRank(S, U, V)

We define a matrix \(L = U S V^\mathrm{H} \in \mathbb{R}^{20 \times 20}\) with rank \(2\).

__init__()

Initialize a Low Rank matrix instance.

Parameters
vecSnumpy.ndarray

The singular values as 1d vector corresponding to the singular value decomposition of the matrix.

arrUnumpy.ndarray

A 2d array corresponding to U of the singular value decomposition of the matrix.

arrUnumpy.ndarray

A 2d array corresponding to V of the singular value decomposition of the matrix.

**optionsoptional

Additional keyworded arguments. Supports all optional arguments supported by fastmat.Matrix.

arrU

Return the array of left orthogonal vectors, i.e. the image

(read-only)

arrV

Return the array of right orthogonal vectors

the orthogonal complement of the kernel

(read-only)

vecS

Return the vector of non-zero singular values entries.

(read-only)