PermutationMatrix
- class PermutationMatrix(input, radixes=[], check_arguments=True)[source]
Bases:
UnitaryMatrix
A binary, unitary matrix with a single 1 in each row and column.
- __init__(input, radixes=[], check_arguments=True)[source]
Constructs a PermutationMatrix from the supplied matrix.
See
UnitaryMatrix
for more info.
Attributes
The transpose of the unitary.
The conjugate transpose of the unitary.
The matrix dimension for this unitary.
The NumPy data type of the unitary.
The number of real parameters this unitary-valued function takes.
The number of qudits this unitary can act on.
The NumPy array holding the unitary.
The number of orthogonal states for each qudit.
The two-dimensional square shape of the unitary.
Methods
check_parameters
(params)Check parameters are valid and match the unitary.
closest_to
(M[, radixes])Calculate and return the closest unitary to a given matrix.
conj
()Return the complex conjugate unitary matrix.
from_file
(filename)Load a unitary from a file.
from_qubit_location
(num_qubits, location)Creates a qubit permutation matrix.
from_qudit_location
(num_qudits, radix, location)Creates the permutation matrix specified by arguments.
gen_swap_unitary
([radix])Generate a unitary matrix that swaps the state of two qudits.
get_distance_from
(other[, degree])Return the distance between self and other.
get_statevector
(in_state)Calculate the output state after applying this unitary to in_state.
get_unitary
([params])Return the same object, satisfies the
Unitary
API.identity
(dim[, radixes])Construct an identity UnitaryMatrix.
Return true if this unitary doesn't take parameters.
Return true if this unitary is parameterized.
is_permutation
(P[, tol])Check if P is a permutation matrix.
Return true if this unitary can only act on qubits.
is_qudit_only
(radix)Return true if this unitary can only act on radix-qudits.
Return true if this unitary can only act on qutrits.
is_self_inverse
([params])Checks whether the unitary is its own inverse.
Return true if this unitary is special.
is_unitary
(U[, tol])Check if U is a unitary matrix.
otimes
(*utrys)Calculate the tensor or kroneckor product with other unitaries.
random
(num_qudits[, radixes])Sample a random unitary from the haar distribution.
save
(filename)Save the unitary to a file.
Return a special unitary matrix verson of this one.