permutation_matrix#
- permutation_matrix(oneline_notation)[source]#
Generate a permutation matrix from one-line notation.
If
oneline_notation = [p_0,\dots,p_{d-1}], the returned matrix \(\mathbf{P}\) satisfies \((\mathbf{P}\mathbf{x})_i = x_{p_i}\).Example
>>> permutation_matrix([2, 0, 1]) array([[0, 0, 1], [1, 0, 0], [0, 1, 0]])