matrices.cyclic_permutation_matrix¶
Generates a cyclic permutation matrix.
Functions¶
|
Create the cyclic permutation matrix for a given dimension |
Module Contents¶
- matrices.cyclic_permutation_matrix.cyclic_permutation_matrix(n, k=1)¶
Create the cyclic permutation matrix for a given dimension
n
[1].This function creates a cyclic permutation matrix of 0’s and 1’s which is a special type of square matrix that represents a cyclic permutation of its rows. The function allows fixed points and successive applications.
Examples
Generate fixed point.
>>> from toqito.matrices import cyclic_permutation_matrix >>> n = 4 >>> cyclic_permutation_matrix(n) array([[0, 0, 0, 1], [1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0]])
Generate successive application.
>>> from toqito.matrices import cyclic_permutation_matrix >>> n = 4 >>> k = 3 >>> cyclic_permutation_matrix(n, k) array([[0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1], [1, 0, 0, 0]])
References
- Parameters:
n (int) – int The number of rows and columns in the cyclic permutation matrix.
k (int) – int The power to which the elements are raised, representing successive applications.
- Returns:
A NumPy array representing a cyclic permutation matrix of dimension
n x n
. Each row of the matrix is shifted one position to the right in a cyclic manner, creating a circular permutation pattern. Ifk
is specified, the function raises the matrix to the power ofk
, representing successive applications of the cyclic permutation.- Return type:
numpy.ndarray