Japanese
言語
English
Bengali
French
German
Japanese
Korean
Portuguese
Spanish
Tamil

CVaRMeasurement

class CVaRMeasurement(primitive=None, alpha=1.0, coeff=1.0)[ソース]

ベースクラス: OperatorStateFn

A specialized measurement class to compute CVaR expectation values.

See https://arxiv.org/pdf/1907.04769.pdf for further details.

Used in CVaRExpectation, see there for more details.

パラメータ
  • primitive (Optional[OperatorBase]) – The OperatorBase which defines the diagonal operator measurement.

  • coeff (Union[complex, ParameterExpression]) – A coefficient by which to multiply the state function

  • alpha (float) – A real-valued parameter between 0 and 1 which specifies the fraction of observed samples to include when computing the objective value. alpha = 1 corresponds to a standard observable expectation value. alpha = 0 corresponds to only using the single sample with the lowest energy. alpha = 0.5 corresponds to ranking each observation by lowest energy and using the best

例外
  • ValueError – TODO remove that this raises an error

  • ValueError – If alpha is not in [0, 1].

  • OpflowError – If the primitive is not diagonal.

Methods Defined Here

add

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

adjoint

The adjoint of a CVaRMeasurement is not defined.

compute_cvar

Given the energies of each sampled measurement outcome (H_i) as well as the sampling probability of each measurement outcome (p_i, we can compute the CVaR.

eval

Given the energies of each sampled measurement outcome (H_i) as well as the sampling probability of each measurement outcome (p_i, we can compute the CVaR as H_j + 1/α*(sum_i<j p_i*(H_i - H_j)).

eval_variance

Given the energies of each sampled measurement outcome (H_i) as well as the sampling probability of each measurement outcome (p_i, we can compute the variance of the CVaR estimator as H_j^2 + 1/α * (sum_i<j p_i*(H_i^2 - H_j^2)).

get_outcome_energies_probabilities

In order to compute the CVaR of an observable expectation, we require the energies of each sampled measurement outcome as well as the sampling probability of each measurement outcome.

mul

Returns the scalar multiplication of the Operator, overloaded by *, including support for Terra's Parameters, which can be bound to values later (via bind_parameters).

sample

Sample the state function as a normalized probability distribution.

tensor

Return tensor product between self and other, overloaded by ^.

to_circuit_op

Not defined.

to_density_matrix

Not defined.

to_matrix

Not defined.

to_matrix_op

Not defined.

traverse

Apply the convert_fn to the internal primitive if the primitive is an Operator (as in the case of OperatorStateFn).

Attributes

INDENTATION = '  '
alpha
A real-valued parameter between 0 and 1 which specifies the

fraction of observed samples to include when computing the objective value. alpha = 1 corresponds to a standard observable expectation value. alpha = 0 corresponds to only using the single sample with the lowest energy. alpha = 0.5 corresponds to ranking each observation by lowest energy and using the best half.

戻り値の型

float

戻り値

The parameter alpha which was given at initialization

coeff

A coefficient by which the state function is multiplied.

戻り値の型

Union[complex, ParameterExpression]

instance_id

Return the unique instance id.

戻り値の型

int

is_measurement

Whether the StateFn object is a measurement Operator.

戻り値の型

bool

num_qubits
戻り値の型

int

parameters
primitive: OperatorBase

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

settings

Return settings.

戻り値の型

Dict