Header menu logo Encodings

Phase Type

The global phase factor attached to a Pauli product.

When multiplying Pauli matrices, the result is another Pauli matrix times a phase in {+1, -1, +i, -i}. For example: X · Y = iZ (phase = +i).

Phases are tracked as a discriminated union enabling exact (no floating-point error) phase arithmetic. The multiplication table forms a cyclic group Z₄:

   P1 * P1 = P1    Pi * Pi = M1
   P1 * M1 = M1    Pi * Mi = P1
   M1 * M1 = P1    Mi * Mi = M1

Union cases

Union case Description

M1

Full Usage: M1

Phase factor -1.

Mi

Full Usage: Mi

Phase factor -i (negative imaginary).

P1

Full Usage: P1

Phase factor +1 (identity phase).

Pi

Full Usage: Pi

Phase factor +i (positive imaginary).

Instance members

Instance member Description

this.FoldIntoGlobalPhase

Full Usage: this.FoldIntoGlobalPhase

Parameters:
    globalPhase : Complex - The complex number to multiply by this phase.

Returns: Complex The product of globalPhase and this phase factor.

Folds this phase into a complex global phase by multiplication.

Converts the symbolic phase to its numeric effect: P1 → globalPhase, M1 → -globalPhase, Pi → i·globalPhase, Mi → -i·globalPhase.

globalPhase : Complex

The complex number to multiply by this phase.

Returns: Complex

The product of globalPhase and this phase factor.

this.IsComplex

Full Usage: this.IsComplex

Returns: bool true for Pi (+i) and Mi (-i); false for P1 (+1) and M1 (-1).

Gets whether this phase is purely imaginary.

Returns: bool

true for Pi (+i) and Mi (-i); false for P1 (+1) and M1 (-1).

this.IsM1

Full Usage: this.IsM1

Returns: bool
Returns: bool

this.IsMi

Full Usage: this.IsMi

Returns: bool
Returns: bool

this.IsP1

Full Usage: this.IsP1

Returns: bool
Returns: bool

this.IsPi

Full Usage: this.IsPi

Returns: bool
Returns: bool

this.IsPositive

Full Usage: this.IsPositive

Returns: bool true for P1 (+1) and Pi (+i); false for M1 (-1) and Mi (-i).

Gets whether this phase has a positive real or imaginary part.

Returns: bool

true for P1 (+1) and Pi (+i); false for M1 (-1) and Mi (-i).

Static members

Static member Description

l * r

Full Usage: l * r

Parameters:
    l : Phase - The left phase factor.
    r : Phase - The right phase factor.

Returns: Phase The product phase factor in {P1, M1, Pi, Mi}.

Multiplies two phase factors exactly.

Phase multiplication follows the cyclic group Z₄ structure: i² = -1, i · (-i) = 1, (-1)² = 1, etc.

l : Phase

The left phase factor.

r : Phase

The right phase factor.

Returns: Phase

The product phase factor in {P1, M1, Pi, Mi}.

Type something to start searching.