StateVector
- class StateVector(*args, **kwargs)[source]
Bases:
NDArrayOperatorsMixin
A vector representing a pure quantum state.
- __init__(input, radixes=[], check_arguments=True)[source]
Constructs a StateVector from the supplied vector.
- Parameters:
input (
StateLike
) – The state vector input.radixes (
Sequence[int]
) – A sequence with its length equal to the number of qudits this StateVector represents. Each element specifies the base, number of orthogonal states, for the corresponding qudit. By default, the constructor will attempt to calculate radixes from input.check_arguments (
bool
) – If true, check arguments for type and value errors.
- Raises:
ValueError – If input is not a pure quantum state.
ValueError – If the dimension of input does not match the expected dimension from radixes.
RuntimeError – If radixes is not specified and the constructor cannot infer it.
Attributes
The vector dimension for this state.
The NumPy data type of the vector.
The number of qudits in the state.
The NumPy array holding the vector.
The number of orthogonal states for each qudit.
The one-dimensional shape of the vector.
Methods
apply
(utry, location[, inverse, check_arguments])Apply the specified unitary on the right of this StateVector.
get_distance_from
(other)Return the distance between self and other.
Return the probabilities for each classical outcome.
is_pure_state
(V[, tol])Check if V is a pure state vector.
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.
random
(num_qudits[, radixes])Sample a random pure state.
zero
(num_qudits[, radixes])Prepares the zero state.