Skip to main content

simplify_paulis

Overloads

NameDescription
simplify_paulis(Operator input) -> complexSimplifies a sum or product of Pauli operators according to Pauli algebra rules with complex coefficients, pruning terms with a coefficient of norm equal to machine precision.Applies commutation relations: X*Y = iZ, Y*Z = iX, Z*X = iY, and P*P = I for any Pauli operator P. Handles multi-site operators and automatically combines like terms.
simplify_paulis(Operator input, real tol) -> complexSimplifies a sum or product of Pauli operators according to Pauli algebra rules with complex coefficients, pruning terms with a coefficient of norm equal to machine precision.Applies commutation relations: X*Y = iZ, Y*Z = iX, Z*X = iY, and P*P = I for any Pauli operator P. Handles multi-site operators and automatically combines like terms.

simplify_paulis(Operator input) -> complex

Simplifies a sum or product of Pauli operators according to Pauli algebra rules with complex coefficients, pruning terms with a coefficient of norm equal to machine precision.Applies commutation relations: X*Y = iZ, Y*Z = iX, Z*X = iY, and P*P = I for any Pauli operator P. Handles multi-site operators and automatically combines like terms.

Parameters

  • input: OperatorProduct or OperatorSum with complex coefficients containing Pauli operator strings (products of X, Y, Z, I operators).

Example

// Simplify a ComplexOperatorSum with Pauli products
var sum_ops = (1.0+0.0i)*(X(0) * Y(0)) + (1.0+0.0i)*(Y(1) * Z(1)) + (1.0+0.0i)*(Z(2) * X(2))
simplify_paulis(sum_ops)
// modifies input to (0+1i)*Z(0) + (0+1i)*X(1) + (0+1i)*Y(2)

// Simplify sum with mixed terms
var mixed_sum = (1.0+0.0i)*X(0) + (1.0+0.0i)*(Y(1) * Z(0) * X(0) * Z(1) * Z(1))
simplify_paulis(mixed_sum)
// modifies input to (1+0i)*X(0) + (0+1i)*(Y(0)*Y(1))

simplify_paulis(Operator input, real tol) -> complex

Simplifies a sum or product of Pauli operators according to Pauli algebra rules with complex coefficients, pruning terms with a coefficient of norm equal to machine precision.Applies commutation relations: X*Y = iZ, Y*Z = iX, Z*X = iY, and P*P = I for any Pauli operator P. Handles multi-site operators and automatically combines like terms.

Parameters

  • input: OperatorProduct or OperatorSum with complex coefficients containing Pauli operator strings (products of X, Y, Z, I operators).
  • tol: Real number indicating the threshold for truncating the sum of Pauli operator strings.

Example

// Simplify a ComplexOperatorSum with Pauli products
var sum_ops = (1.0+0.0i)*(X(0) * Y(0)) + (1.0+0.0i)*(Y(1) * Z(1)) + (1.0+0.0i)*(Z(2) * X(2))
simplify_paulis(sum_ops,1e-5)
// modifies input to (0+1i)*Z(0) + (0+1i)*X(1) + (0+1i)*Y(2)

// Simplify sum with mixed terms
var mixed_sum = (1.0+0.0i)*X(0) + (1e-8+0.0i)*(Y(1) * Z(0) * X(0) * Z(1) * Z(1))
simplify_paulis(mixed_sum,1e-5)
// modifies input to (1+0i)*X(0)