Skip to main content

pruned

Overloads

NameDescription
pruned(const RealOperatorSum input) -> RealOperatorSumPrunes operators from an OperatorSum based on their effective norm (out-of-place).
pruned(const RealOperatorSum input, real tolerance) -> RealOperatorSumPrunes operators from an OperatorSum based on their effective norm (out-of-place).
pruned(const ComplexOperatorSum input, real tolerance) -> ComplexOperatorSumPrunes operators from an OperatorSum based on their effective norm (out-of-place).
pruned(const ComplexOperatorSum input) -> ComplexOperatorSumPrunes operators from an OperatorSum based on their effective norm (out-of-place).

pruned(const RealOperatorSum input) -> RealOperatorSum

Prunes operators from an OperatorSum based on their effective norm (out-of-place).

Here, the effective norm = |coefficient| × norm(operator), where norm(operator) is the spectral norm by default. Uses a default cutoff threshold of 1e-13 for double and 1e-4 for single precision. To modify the cutoff, use the tolerance parameter version.

Parameters

  • input: The input OperatorSum to be pruned

Returns

A new OperatorSum containing only terms where effective_norm > threshold

Example

var result = pruned(X(0) + 1e-15 * Y(0)); // Returns new OperatorSum with only 1 * X(0)

pruned(const RealOperatorSum input, real tolerance) -> RealOperatorSum

Prunes operators from an OperatorSum based on their effective norm (out-of-place).

Here, the effective norm = |coefficient| × norm(operator), where norm(operator) is the spectral norm by default. This version allows you to specify a custom cutoff threshold.

Parameters

  • input: The input OperatorSum to be pruned
  • tolerance: The custom threshold below which terms are removed (optional)

Returns

A new OperatorSum containing only terms where effective_norm > tolerance

Example

var result = pruned(X(0) + 1e-4 * Y(0), 1e-3); // Returns new OperatorSum with only 1 * X(0)

pruned(const ComplexOperatorSum input, real tolerance) -> ComplexOperatorSum

Prunes operators from an OperatorSum based on their effective norm (out-of-place).

Here, the effective norm = |coefficient| × norm(operator), where norm(operator) is the spectral norm by default. This version allows you to specify a custom cutoff threshold.

Parameters

  • input: The input OperatorSum to be pruned
  • tolerance: The custom threshold below which terms are removed (optional)

Returns

A new OperatorSum containing only terms where effective_norm > tolerance

Example

var result = pruned(X(0) + 1e-4 * Y(0), 1e-3); // Returns new OperatorSum with only 1 * X(0)

pruned(const ComplexOperatorSum input) -> ComplexOperatorSum

Prunes operators from an OperatorSum based on their effective norm (out-of-place).

Here, the effective norm = |coefficient| × norm(operator), where norm(operator) is the spectral norm by default. Uses a default cutoff threshold of 1e-13 for double and 1e-4 for single precision. To modify the cutoff, use the tolerance parameter version.

Parameters

  • input: The input OperatorSum to be pruned

Returns

A new OperatorSum containing only terms where effective_norm > threshold

Example

var result = pruned(X(0) + 1e-15 * Y(0)); // Returns new OperatorSum with only 1 * X(0)