Permutation Matrix

class fastmat.Permutation

Bases: Matrix

For a given permutation \(\sigma \in S_n\) and a vector \(x \in \mathbb{C}^n\) we map

\[x \mapsto \left(x_{\sigma(i)}\right)_{i = 1}^n.\]
>>> # import the package
>>> import fastmat
>>>
>>> # set the permutation
>>> sigma = np.array([3,1,2,0])
>>>
>>> # construct the identity
>>> P = fastmat.Permutation(sigma)
\[\begin{split}J = \begin{bmatrix} 0 & 0 & 0 & 1 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 1 & 0 & 0 & 0 \end{bmatrix}\end{split}\]
__init__()

Initialize a Permutation matrix instance.

Parameters
sigmanumpy.ndarray

A 1d vector of type int mapping the row indices to column indices uniquely.

**optionsoptional

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

sigma

Return the defining permutation

(read only)