Statevector¶

class
Statevector
(data, dims=None)[source]¶ Bases:
qiskit.quantum_info.states.quantum_state.QuantumState
,qiskit.quantum_info.operators.mixins.tolerances.TolerancesMixin
Statevector class
Initialize a statevector object.
 Parameters
(np.array or list or Statevector or Operator or QuantumCircuit or (data) – qiskit.circuit.Instruction): Data from which the statevector can be constructed. This can be either a complex vector, another statevector, a
Operator
with only one column or aQuantumCircuit
orInstruction
. If the data is a circuit or instruction, the statevector is constructed by assuming that all qubits are initialized to the zero state.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 Nqubit state. If it is not a power of two the state will have a single ddimensional subsystem.
Methods
Return the conjugate of the operator.
Make a copy of current operator.
Return tuple of input dimension for specified subsystems.
Return a visualization of the Statevector.
Return True if other is equivalent as a statevector up to global phase.
Evolve a quantum state by the operator.
Return the tensor product state other ⊗ self.
Compute the expectation value of an operator.
Return the output statevector of an instruction.
Return a computational basis statevector.
Return a tensor product of Pauli X,Y,Z eigenstates.
Return the inner product of self and other as \(\langle self other \rangle\).
Return True if a Statevector has norm 1.
Measure subsystems and return outcome and postmeasure state.
Return the subsystem measurement probability vector.
Return the subsystem measurement probability dictionary.
Return the purity of the quantum state.
Reset state or subsystems to the 0state.
Return a Statevector with reversed subsystem ordering.
Sample a dict of qubit measurement outcomes in the computational basis.
Sample a list of qubit measurement outcomes in the computational basis.
Set the seed for the quantum state RNG.
Return the tensor product state self ⊗ other.
Convert the statevector to dictionary form.
Convert state to a rank1 projector operator
Return the trace of the quantum state as a density matrix.
Attributes

atol
= 1e08¶

data
¶ Return data.

dim
¶ Return total state dimension.

num_qubits
¶ Return the number of qubits if a Nqubit state or None otherwise.

rtol
= 1e05¶

settings
¶ Return settings.
 Return type
Dict