Statevector¶
- class Statevector(data, dims=None)[source]¶
Statevector class
Initialize a statevector object.
- Parameters
data (vector_like) – a complex statevector.
dims (int or tuple or list) – Optional. The subsystem dimension of the state (See additional information).
- Raises
QiskitError – if input data is not valid.
- Additional Information:
The
dims
kwarg can be None, an integer, or an iterable of integers.Iterable
– the subsystem dimensions are the values in the list with the total number of subsystems given by the length of the list.Int
orNone
– the length of the input vector specifies the total dimension of the density matrix. If it is a power of two the state will be initialized as an N-qubit state. If it is not a power of two the state will have a single d-dimensional subsystem.
Attributes
The absolute tolerance parameter for float comparisons.
Return data.
Return total state dimension.
Return the number of qubits if a N-qubit state or None otherwise.
The relative tolerance parameter for float comparisons.
Methods
Statevector.__mul__
(other)Statevector.add
(other)Return the linear combination self + other.
Return the conjugate of the operator.
Make a copy of current operator.
Statevector.dims
([qargs])Return tuple of input dimension for specified subsystems.
Statevector.equiv
(other[, rtol, atol])Return True if statevectors are equivalent up to global phase.
Statevector.evolve
(other[, qargs])Evolve a quantum state by the operator.
Statevector.expand
(other)Return the tensor product state other ⊗ self.
Statevector.from_instruction
(instruction)Return the output statevector of an instruction.
Statevector.from_int
(i, dims)Return a computational basis statevector.
Statevector.from_label
(label)Return a tensor product of Pauli X,Y,Z eigenstates.
Statevector.is_valid
([atol, rtol])Return True if a Statevector has norm 1.
Statevector.measure
([qargs])Measure subsystems and return outcome and post-measure state.
Statevector.multiply
(other)Return the scalar multipled state other * self.
Statevector.probabilities
([qargs, decimals])Return the subsystem measurement probability vector.
Statevector.probabilities_dict
([qargs, decimals])Return the subsystem measurement probability dictionary.
Return the purity of the quantum state.
Statevector.reset
([qargs])Reset state or subsystems to the 0-state.
Statevector.sample_counts
(shots[, qargs])Sample a dict of qubit measurement outcomes in the computational basis.
Statevector.sample_memory
(shots[, qargs])Sample a list of qubit measurement outcomes in the computational basis.
Statevector.seed
([value])Set the seed for the quantum state RNG.
Statevector.set_atol
(value)Set the class default absolute tolerance parameter for float comparisons.
Statevector.set_rtol
(value)Set the class default relative tolerance parameter for float comparisons.
Statevector.subtract
(other)Return the linear operator self - other.
Statevector.tensor
(other)Return the tensor product state self ⊗ other.
Returns the statevector as a counts dict of probabilities.
Statevector.to_dict
([decimals])Convert the statevector to dictionary form.
Convert state to a rank-1 projector operator
Return the trace of the quantum state as a density matrix.
Statevector.__mul__
(other)