French
Languages
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

# VectorStateFn¶

class VectorStateFn(primitive=None, coeff=1.0, is_measurement=False)[source]

Bases : `StateFn`

A class for state functions and measurements which are defined in vector representation, and stored using Terra’s `Statevector` class.

Paramètres
• primitive (`Union`[`list`, `ndarray`, `Statevector`, `None`]) – The `Statevector`, NumPy array, or list, which defines the behavior of the underlying function.

• coeff (`Union`[`complex`, `ParameterExpression`]) – A coefficient multiplying the state function.

• is_measurement (`bool`) – Whether the StateFn is a measurement operator

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 `~`. `eval` Evaluate the Operator's underlying function, either on a binary string or another Operator. `permute` Permute the qubits of the state function. `primitive_strings` Return a set of strings describing the primitives contained in the Operator. `sample` Sample the state function as a normalized probability distribution. `tensor` Return tensor product between self and other, overloaded by `^`. `to_circuit_op` Return `StateFnCircuit` corresponding to this StateFn. `to_density_matrix` Return matrix representing product of StateFn evaluated on pairs of basis states. `to_dict_fn` Creates the equivalent state function of type DictStateFn. `to_matrix` Return NumPy representation of the Operator. `to_matrix_op` Return a `VectorStateFn` for this `StateFn`.

Attributes

INDENTATION = '  '
coeff

A coefficient by which the state function is multiplied.

Type renvoyé

`Union`[`complex`, `ParameterExpression`]

instance_id

Return the unique instance id.

Type renvoyé

`int`

is_measurement

Whether the StateFn object is a measurement Operator.

Type renvoyé

`bool`

num_qubits
Type renvoyé

`int`

parameters
primitive: Statevector

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

settings

Return settings.

Type renvoyé

`Dict`