prune
Overloads
| Name | Description |
|---|---|
prune(ComplexOperatorSum input) -> ComplexOperatorSum | Prunes operators from an OperatorSum based on their effective norm (in-place). |
prune(RealOperatorSum input, real tolerance) -> RealOperatorSum | Prunes operators from an OperatorSum based on their effective norm (in-place). |
prune(ComplexOperatorSum input, real tolerance) -> ComplexOperatorSum | Prunes operators from an OperatorSum based on their effective norm (in-place). |
prune(RealOperatorSum input) -> RealOperatorSum | Prunes operators from an OperatorSum based on their effective norm (in-place). |
prune(ComplexOperatorSum input) -> ComplexOperatorSum
Prunes operators from an OperatorSum based on their effective norm (in-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 modified in-place
Returns
Reference to the modified OperatorSum (allows method chaining)
Example
var sum = X(0) + 1e-15 * Y(0);
prune(sum); // sum is modified to contain only 1 * X(0)
// Alternative syntax:
sum.prune(); // Same result, member function style
// Method chaining example:
var result = prune(sum); // result refers to the same modified sum
prune(RealOperatorSum input, real tolerance) -> RealOperatorSum
Prunes operators from an OperatorSum based on their effective norm (in-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 modified in-place
- tolerance: The custom threshold below which terms are removed (optional)
Returns
Reference to the modified OperatorSum (allows method chaining)
Example
var sum = X(0) + 1e-4 * Y(0);
prune(sum, 1e-3); // sum is modified to contain only 1 * X(0)
// Alternative syntax:
sum.prune(1e-3); // Same result, member function style
// Method chaining example:
var result = prune(sum, 1e-3); // result refers to the same modified sum
prune(ComplexOperatorSum input, real tolerance) -> ComplexOperatorSum
Prunes operators from an OperatorSum based on their effective norm (in-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 modified in-place
- tolerance: The custom threshold below which terms are removed (optional)
Returns
Reference to the modified OperatorSum (allows method chaining)
Example
var sum = X(0) + 1e-4 * Y(0);
prune(sum, 1e-3); // sum is modified to contain only 1 * X(0)
// Alternative syntax:
sum.prune(1e-3); // Same result, member function style
// Method chaining example:
var result = prune(sum, 1e-3); // result refers to the same modified sum
prune(RealOperatorSum input) -> RealOperatorSum
Prunes operators from an OperatorSum based on their effective norm (in-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 modified in-place
Returns
Reference to the modified OperatorSum (allows method chaining)
Example
var sum = X(0) + 1e-15 * Y(0);
prune(sum); // sum is modified to contain only 1 * X(0)
// Alternative syntax:
sum.prune(); // Same result, member function style
// Method chaining example:
var result = prune(sum); // result refers to the same modified sum