Tamil
Languages
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

Statevector

class Statevector(data, dims=None)[source]

Bases: QuantumState, TolerancesMixin

Statevector class

Initialize a statevector object.

Parameters
  • or (data (np.array or list or Statevector or Operator or QuantumCircuit) -- 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 a QuantumCircuit or Instruction. 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 or None -- 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.

Methods

conjugate

Return the conjugate of the operator.

copy

Make a copy of current operator.

dims

Return tuple of input dimension for specified subsystems.

draw

Return a visualization of the Statevector.

equiv

Return True if other is equivalent as a statevector up to global phase.

evolve

Evolve a quantum state by the operator.

expand

Return the tensor product state other ⊗ self.

expectation_value

Compute the expectation value of an operator.

from_instruction

Return the output statevector of an instruction.

from_int

Return a computational basis statevector.

from_label

Return a tensor product of Pauli X,Y,Z eigenstates.

inner

Return the inner product of self and other as \(\langle self| other \rangle\).

is_valid

Return True if a Statevector has norm 1.

measure

Measure subsystems and return outcome and post-measure state.

probabilities

Return the subsystem measurement probability vector.

probabilities_dict

Return the subsystem measurement probability dictionary.

purity

Return the purity of the quantum state.

reset

Reset state or subsystems to the 0-state.

reverse_qargs

Return a Statevector with reversed subsystem ordering.

sample_counts

Sample a dict of qubit measurement outcomes in the computational basis.

sample_memory

Sample a list of qubit measurement outcomes in the computational basis.

seed

Set the seed for the quantum state RNG.

tensor

Return the tensor product state self ⊗ other.

to_dict

Convert the statevector to dictionary form.

to_operator

Convert state to a rank-1 projector operator

trace

Return the trace of the quantum state as a density matrix.

Attributes

atol = 1e-08
data

Return data.

dim

Return total state dimension.

num_qubits

Return the number of qubits if a N-qubit state or None otherwise.

rtol = 1e-05
settings

Return settings.

Return type

Dict