Header menu logo Encodings

PauliRegister Type

Represents a tensor product of single-qubit Pauli operators with a complex coefficient.

A PauliRegister of size n represents an operator on n qubits:

   coefficient 

where each Pᵢ ∈ {I, X, Y, Z} is a single-qubit Pauli operator.

Examples:

  • "XII" with coefficient 1.0 = X₀ ⊗ I₁ ⊗ I₂
  • "ZZ" with coefficient -0.5 = -0.5 · (Z₀ ⊗ Z₁)

Constructors

Constructor Description

PauliRegister(ops, coefficient)

Full Usage: PauliRegister(ops, coefficient)

Parameters:
    ops : Pauli seq - Sequence of Pauli operators.
    coefficient : Complex - The complex coefficient for this term.

Returns: PauliRegister

Creates a PauliRegister from a sequence of Pauli operators.

ops : Pauli seq

Sequence of Pauli operators.

coefficient : Complex

The complex coefficient for this term.

Returns: PauliRegister

PauliRegister(ops, coefficient)

Full Usage: PauliRegister(ops, coefficient)

Parameters:
    ops : Pauli list - List of Pauli operators [P₀; P₁; ...; Pₙ₋₁].
    coefficient : Complex - The complex coefficient for this term.

Returns: PauliRegister

Creates a PauliRegister from a list of Pauli operators.

ops : Pauli list

List of Pauli operators [P₀; P₁; ...; Pₙ₋₁].

coefficient : Complex

The complex coefficient for this term.

Returns: PauliRegister

PauliRegister(ops, coefficient)

Full Usage: PauliRegister(ops, coefficient)

Parameters:
    ops : string - A string like "XYZII" where each character is I, X, Y, or Z.
    coefficient : Complex - The complex coefficient for this term.

Returns: PauliRegister

Creates a PauliRegister from a string of Pauli characters.

ops : string

A string like "XYZII" where each character is I, X, Y, or Z.

coefficient : Complex

The complex coefficient for this term.

Returns: PauliRegister
Example

 let reg = PauliRegister("XZI", Complex.One)  // X₀ ⊗ Z₁ ⊗ I₂
val reg: obj

PauliRegister(n, ?coefficient)

Full Usage: PauliRegister(n, ?coefficient)

Parameters:
    n : uint32 - The number of qubits (register size).
    ?coefficient : Complex - Optional complex coefficient (default: 1.0).

Returns: PauliRegister

Creates a new PauliRegister with all identity operators.

n : uint32

The number of qubits (register size).

?coefficient : Complex

Optional complex coefficient (default: 1.0).

Returns: PauliRegister

Instance members

Instance member Description

this.Coefficient

Full Usage: this.Coefficient

Returns: Complex

Gets the complex coefficient of this Pauli term.

Returns: Complex

this[i]

Full Usage: this[i]

Parameters:
    i : int - The zero-based qubit index.

Returns: Pauli option Some Pauli if index is valid; None otherwise.

Gets the Pauli operator at the given qubit index.

i : int

The zero-based qubit index.

Returns: Pauli option

Some Pauli if index is valid; None otherwise.

this.PhaseConjunction

Full Usage: this.PhaseConjunction

Returns: string

Gets a formatted conjunction string for combining terms in a sum.

Used when building sum expressions like "X + iY - Z".

Returns: string

this.PhasePrefix

Full Usage: this.PhasePrefix

Returns: string

Gets a formatted string prefix representing the coefficient phase.

Used for display purposes, e.g., "+", "-", "+i", "-i".

Returns: string

this.ResetPhase

Full Usage: this.ResetPhase

Parameters:
    p : Complex - The new complex coefficient.

Returns: PauliRegister A new PauliRegister with the same operators but different coefficient.

Creates a copy of this register with a new coefficient.

p : Complex

The new complex coefficient.

Returns: PauliRegister

A new PauliRegister with the same operators but different coefficient.

this.Signature

Full Usage: this.Signature

Returns: string A string like "XYZII" representing the tensor product structure.

Gets the signature string of this register (operators without coefficient).

The signature uniquely identifies the Pauli structure and is used as a dictionary key when combining like terms in a PauliRegisterSequence.

Returns: string

A string like "XYZII" representing the tensor product structure.

this.WithOperatorAt

Full Usage: this.WithOperatorAt

Parameters:
    i : int - The zero-based qubit index to modify.
    op : Pauli - The new Pauli operator to place at index i.

Returns: PauliRegister A new PauliRegister with the updated operator.

Returns a new PauliRegister with the operator at index i replaced.

This operation is immutable - it returns a new register without modifying the original.

i : int

The zero-based qubit index to modify.

op : Pauli

The new Pauli operator to place at index i.

Returns: PauliRegister

A new PauliRegister with the updated operator.

Static members

Static member Description

l * r

Full Usage: l * r

Parameters:
Returns: PauliRegister A new PauliRegister representing the product, with coefficients and phases properly combined.

Multiplies two PauliRegisters component-wise.

Multiplication is performed qubit-by-qubit in O(n) time:

   (c
   = (c

where φ is the accumulated phase from all the individual Pauli multiplications. If registers have different sizes, missing qubits are treated as identity.

l : PauliRegister

The left PauliRegister.

r : PauliRegister

The right PauliRegister.

Returns: PauliRegister

A new PauliRegister representing the product, with coefficients and phases properly combined.

Type something to start searching.