Partial Matrix¶
- class fastmat.Partial¶
Bases:
Matrix
Let \(I \subset \{1,\dots,n\}\) and \(J \subset \{1,\dots,m\}\) index sets and \(M \in \mathbb{C}^{n \times m}\) a linear transform. Then the partial transform \(M_{I,J}\) is defined as
\[x \in \mathbb{C}^m \mapsto ( M_J \cdot x_J)_{i \in I}.\]In other words, we select the rows \(I\) of \(M\) and columns J of \(M\) and rows \(J\) of \(x\).
>>> # import the package >>> import fastmat as fm >>> import numpy as np >>> >>> # define the index set >>> a = np.arange(n) >>> am = np.mod(a, 2) >>> b = np.array(am, dtype='bool') >>> I = a[b] >>> >>> # construct the partial transform >>> M = fm.Partial(F, I)
Let \({\mathcal{F}}\) be the \(n\)-dimensional Fourier matrix. And let \(I\) be the set of odd integers. Then we define a partial transform as
\[M = {\mathcal{F}}_I\]- __init__()¶
Initialize a Partial matrix instance.
- Parameters
- mat
fastmat.Matrix
A fastmat matrix instance subject to partial access.
- rows
numpy.ndarray
, optional A 1d vector selecting rows of mat.
If N is of type bool it’s size must match the height of mat and the values of N corresponds to taking/dumping the corresponding row.
If N is of type int it’s values correspond to the indices of the rows of mat to select. The size of N then matches the height of the partialed matrix.
Defaults to selecting all rows.
- cols
numpy.ndarray
, optional A 1d vector selecting columns of mat. The behaviour is identical to N.
Defaults to selecting all columns.
- **optionsoptional
Additional optional keyworded arguments. Supports all optional arguments supported by
fastmat.Matrix
.
- mat
- colSelection¶
Return the support of the base matrix which defines the partial
Subselected columns
(read only)
- indicesM¶
Deprecated. See .colSelection
- indicesN¶
Deprecated. See .rowSelection
- rowSelection¶
Return the support of the base matrix which defines the partial
Subselected rows
(read only)