Outer Product¶
- class fastmat.Outer¶
Bases:
Matrix
The outer product is a special case of the Kronecker product of one-dimensional vectors. For given \(a \in \mathbb{C}^n\) and \(b \in \mathbb{C}^m\) it is defined as
\[x \mapsto a \cdot b^\mathrm{T} \cdot x.\]It is clear, that this matrix has at most rank \(1\) and as such has a fast transformation.
>>> # import the package >>> import fastmat as fm >>> import numpy as np >>> >>> # define parameter >>> n, m = 4, 5 >>> v = np.arange(n) >>> h = np.arange(m) >>> >>> # construct the matrix >>> M = fm.Outer(v, h)
This yields
\[v = (0,1,2,3,4)^\mathrm{T}\]\[h = (0,1,2,3,4,5)^\mathrm{T}\]\[\begin{split}M = \begin{bmatrix} 0 & 0 & 0 & 0 & 0 \\ 0 & 1 & 2 & 3 & 4 \\ 0 & 2 & 4 & 6 & 8 \\ 0 & 3 & 6 & 9 & 12 \end{bmatrix}\end{split}\]- __init__()¶
Initialize a Outer product matrix instance.
- Parameters
- arrV
numpy.ndarray
A 1d vector defining the column factors of the resulting matrix.
- arrH
numpy.ndarray
A 1d vector defining the row factors of the resulting matrix.
- **optionsoptional
Additional keyworded arguments. Supports all optional arguments supported by
fastmat.Matrix
.
- arrV
- vecH¶
Return the matrix-defining vector of horizontal defining entries.
(read only)
- vecV¶
Return the matrix-defining vector of vertical defining entries.
(read only)