Kronecker Product¶
- class fastmat.Kron¶
Bases:
Matrix
For matrices \(A_i \in \mathbb{C}^{n_i \times n_i}\) for \(i = 1,\dots,k\) the Kronecker product
\[A_1 \otimes A_2 \otimes \dots \otimes A_k\]can be defined recursively because of associativity from the Kronecker product of \(A \in \mathbb{C}^{n \times m}\) and \(B \in \mathbb{C}^{r \times s}\) defined as
\[\begin{split}A \otimes B = \begin{bmatrix} a_{11} B & \dots & a_{1m} B \\ \vdots & \ddots & \vdots \\ a_{n1} B & \dots & a_{nm} B \end{bmatrix}.\end{split}\]We make use of a decomposition into a standard matrix product to speed up the matrix-vector multiplication which is introduced in [4]. This then yields multiple benefits:
It already brings down the complexity of the forward and backward projection if the factors \(A_i\) have no fast transformations.
It is not necessary to compute the matrix representation of the product, which saves a lot of memory.
When fast transforms of the factors are available the calculations can be sped up further.
>>> # import the package >>> import fastmat as fm >>> >>> # define the factors >>> C = fm.Circulant(x_C) >>> H = fm.Hadamard(n) >>> >>> # define the Kronecker >>> # product >>> P = fm.Kron(C.H, H)
Assume we have a circulant matrix \(C\) with first column \(x_c\) and a Hadamard matrix \({\mathcal{H}}_n\) of order \(n\). Then we define
\[P = C^\mathrm{H} \otimes H_n.\]- __init__()¶
Initialize a Kron matrix instance.
- Parameters
- *matrices
fastmat.Matrix
The matrix instances to form a kronecker product of. Currently only square matrices are supported as kronecker product terms.
- **optionsoptional
Additional keyworded arguments. Supports all optional arguments supported by
fastmat.Matrix
.
- *matrices