qml.resource.AlgorithmicError

class AlgorithmicError(error)[source]

Bases: abc.ABC

Abstract base class representing an abstract type of error. This class can be used to create objects that track and propagate errors introduced by approximations and other algorithmic inaccuracies.

Parameters

error (float) – The numerical value of the error

Note

Child classes must implement the combine() method which combines two instances of this error type (as if the associated gates were applied in series).

combine(other)

A method to combine two errors of the same type.

get_error(approximate_op, exact_op)

A method to allow users to compute this type of error between two operators.

abstract combine(other)[source]

A method to combine two errors of the same type. (e.g., additive, square additive, multiplicative, etc.)

Parameters

other (AlgorithmicError) – The other instance of error being combined.

Returns

The total error after combination.

Return type

AlgorithmicError

static get_error(approximate_op, exact_op)[source]

A method to allow users to compute this type of error between two operators.

Parameters
  • approximate_op (Operator) – The approximate operator.

  • exact_op (Operator) – The exact operator.

Returns

The error between the exact operator and its approximation.

Return type

float