Header menu logo Encodings

P<'unit> Type

A product of coefficient-operator pairs: an ordered sequence of operators with an overall coefficient.

P represents a product term: c × (Ô₁ Ô₂ ⋯ Ôₙ), where c is a complex coefficient and each Ôᵢ is an operator unit. The ordering is significant for non-commuting operators.

Examples:

  • a†₁ a₂ — two-operator product (hopping term)
  • 0.5 × a†₁ a†₂ a₃ a₄ — four-operator product (two-electron integral)
  • X₀ Z₁ X₂ — three-qubit Pauli string

The (*) operator performs tensor product of two products. Products can be collected into sums S to form Hamiltonians.

Record fields

Record Field Description

Coeff

Full Usage: Coeff

Field type: Complex

The overall complex coefficient for the product.

Field type: Complex

Units

Full Usage: Units

Field type: C<'unit>[]

The ordered array of coefficient-operator pairs in the product.

Field type: C<'unit>[]

Instance members

Instance member Description

this.AppendToTerm

Full Usage: this.AppendToTerm

Parameters:
    u : 'unit - The unit to append.

Returns: P<'unit> A new product with the unit added at the end.

Appends an operator unit to the end of this product.

u : 'unit

The unit to append.

Returns: P<'unit>

A new product with the unit added at the end.

this.IsZero

Full Usage: this.IsZero

Returns: bool

Indicates whether any coefficient is zero (making the entire product zero).

Returns: bool

this.Reduce

Full Usage: this.Reduce

Returns: Lazy<P<'unit>>

Returns a fully reduced (normalized) form of the product.

Reduction moves all coefficients from individual units into the overall coefficient, leaving each unit with coefficient 1. Zero terms cause the entire product to become zero.

Returns: Lazy<P<'unit>>

this.ScaleCoefficient

Full Usage: this.ScaleCoefficient

Parameters:
    scale : Complex - The scaling factor.

Returns: P<'unit> A product with Coeff = this.Coeff × scale.

Returns a new product with the overall coefficient scaled by the given factor.

scale : Complex

The scaling factor.

Returns: P<'unit>

A product with Coeff = this.Coeff × scale.

Static members

Static member Description

l * r

Full Usage: l * r

Parameters:
    l : P<'unit> - The left product.
    r : P<'unit> - The right product.

Returns: P<'unit> A new product with coefficient (l.Coeff × r.Coeff) and units [l.Units; r.Units].

Tensor product operator: concatenates two products.

Computes P₁ ⊗ P₂ where the units of P₁ appear before P₂ in the result. Order matters for non-commuting operators.

l : P<'unit>

The left product.

r : P<'unit>

The right product.

Returns: P<'unit>

A new product with coefficient (l.Coeff × r.Coeff) and units [l.Units; r.Units].

P.Apply(units)

Full Usage: P.Apply(units)

Parameters:
    units : C<'unit>[] - The coefficient-operator pairs.

Returns: P<'unit>

Creates a product from an array of coefficient-operator pairs with overall coefficient 1.

units : C<'unit>[]

The coefficient-operator pairs.

Returns: P<'unit>

P.Apply(coeff, unit)

Full Usage: P.Apply(coeff, unit)

Parameters:
    coeff : Complex - The overall coefficient.
    unit : C<'unit> - The coefficient-operator pair.

Returns: P<'unit>

Creates a product from a single coefficient-operator pair with the given overall coefficient.

coeff : Complex

The overall coefficient.

unit : C<'unit>

The coefficient-operator pair.

Returns: P<'unit>

P.Apply(unit)

Full Usage: P.Apply(unit)

Parameters:
    unit : C<'unit> - The coefficient-operator pair.

Returns: P<'unit>

Creates a product from a single coefficient-operator pair with overall coefficient 1.

unit : C<'unit>

The coefficient-operator pair.

Returns: P<'unit>

P.Apply(coeff, items)

Full Usage: P.Apply(coeff, items)

Parameters:
    coeff : Complex - The coefficient.
    items : 'unit[] - The operator units.

Returns: P<'unit>

Creates a product from an array of units with the given coefficient.

coeff : Complex

The coefficient.

items : 'unit[]

The operator units.

Returns: P<'unit>

P.Apply(items)

Full Usage: P.Apply(items)

Parameters:
    items : 'unit[] - The operator units.

Returns: P<'unit>

Creates a product from an array of units with coefficient 1.

items : 'unit[]

The operator units.

Returns: P<'unit>

P.Apply(coeff, item)

Full Usage: P.Apply(coeff, item)

Parameters:
    coeff : Complex - The coefficient.
    item : 'unit - The operator unit.

Returns: P<'unit>

Creates a product from a single unit with the given coefficient.

coeff : Complex

The coefficient.

item : 'unit

The operator unit.

Returns: P<'unit>

P.Apply(item)

Full Usage: P.Apply(item)

Parameters:
    item : 'unit - The operator unit.

Returns: P<'unit>

Creates a product from a single unit with coefficient 1.

item : 'unit

The operator unit.

Returns: P<'unit>

P.Apply(coeff, units)

Full Usage: P.Apply(coeff, units)

Parameters:
    coeff : Complex - The overall coefficient.
    units : C<'unit>[] - The array of coefficient-operator pairs.

Returns: P<'unit> A product with reduced coefficients.

Creates a product from an overall coefficient and array of coefficient-operator pairs.

coeff : Complex

The overall coefficient.

units : C<'unit>[]

The array of coefficient-operator pairs.

Returns: P<'unit>

A product with reduced coefficients.

P.TryCreateFromString(unitFactory) (s)

Full Usage: P.TryCreateFromString(unitFactory) (s)

Parameters:
    unitFactory : string -> 'unit option - A function that parses individual unit strings.
    s : String - The string to parse, in format "[unit1|unit2|...]".

Returns: P<'unit> option Some product if parsing succeeds; None otherwise.

Attempts to parse a product from a string representation.

unitFactory : string -> 'unit option

A function that parses individual unit strings.

s : String

The string to parse, in format "[unit1|unit2|...]".

Returns: P<'unit> option

Some product if parsing succeeds; None otherwise.

P.Zero

Full Usage: P.Zero

Returns: P<'unit>

The zero product (additive identity): coefficient zero, empty units.

Returns: P<'unit>

Type something to start searching.