French
Languages
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

SparseVectorStateFn

class SparseVectorStateFn(*args, **kwargs)[source]

Bases : StateFn

Deprecated: A class for sparse state functions and measurements in vector representation.

This class uses scipy.sparse.spmatrix for the internal representation.

Obsolète depuis la version 0.24.0: The class qiskit.opflow.state_fns.sparse_vector_state_fn.SparseVectorStateFn is deprecated as of qiskit-terra 0.24.0. It will be removed no earlier than 3 months after the release date. For code migration guidelines, visit https://qisk.it/opflow_migration.

Paramètres
  • primitive – The underlying sparse vector.

  • coeff – A coefficient multiplying the state function.

  • is_measurement – Whether the StateFn is a measurement operator

Lève
  • ValueError – If the primitive is not a column vector.

  • ValueError – If the number of elements in the primitive is not a power of 2.

Methods Defined Here

add

Return Operator addition of self and other, overloaded by +.

adjoint

Return a new Operator equal to the Operator's adjoint (conjugate transpose), overloaded by ~.

equals

Evaluate Equality between Operators, overloaded by ==.

eval

Evaluate the Operator's underlying function, either on a binary string or another Operator.

primitive_strings

Return a set of strings describing the primitives contained in the Operator.

sample

Sample the state function as a normalized probability distribution.

to_circuit_op

Convert this state function to a CircuitStateFn.

to_dict_fn

Convert this state function to a DictStateFn.

to_matrix

Return NumPy representation of the Operator.

to_matrix_op

Return a VectorStateFn for this StateFn.

to_spmatrix

Return SciPy sparse matrix representation of the Operator.

Attributes

INDENTATION = '  '
coeff

A coefficient by which the state function is multiplied.

instance_id

Return the unique instance id.

is_measurement

Whether the StateFn object is a measurement Operator.

num_qubits
parameters
primitive: spmatrix

The primitive which defines the behavior of the underlying State function.

settings

Return settings.