Header menu logo Encodings

S<'unit> Type

A sum of products: the standard form for expressing quantum Hamiltonians.

S represents a sum expression: H = Σᵢ cᵢ Pᵢ, where each Pᵢ is a product term. This is the standard form for molecular Hamiltonians in quantum chemistry.

Examples:

  • h₁₂ a†₁ a₂ + h₂₁ a†₂ a₁ — one-body hopping terms
  • Σᵢⱼ Jᵢⱼ ZᵢZⱼ — Ising model Hamiltonian
  • Full molecular Hamiltonians with hundreds of terms

Terms are stored in a map keyed by their string representation to facilitate combining like terms. The (*) operator distributes over sums; (+) collects terms.

Record fields

Record Field Description

Coeff

Full Usage: Coeff

Field type: Complex

An overall coefficient applied to the entire sum.

Field type: Complex

Terms

Full Usage: Terms

Field type: Map<string, P<'unit>>

Map from string representation to product terms, enabling like-term combination.

Field type: Map<string, P<'unit>>

Instance members

Instance member Description

this.IsZero

Full Usage: this.IsZero

Returns: bool

Indicates whether the entire sum is zero (either zero coefficient or no non-zero terms).

Returns: bool

this.NormalizeTermCoefficient

Full Usage: this.NormalizeTermCoefficient

Returns: S<'unit>

Returns a normalized form with the overall coefficient distributed into each term.

Returns: S<'unit>

this.ProductTerms

Full Usage: this.ProductTerms

Returns: Lazy<P<'unit> array>

Lazily evaluated array of all product terms in this sum.

Returns: Lazy<P<'unit> array>

this.Reduce

Full Usage: this.Reduce

Returns: Lazy<S<'unit>>

Returns a reduced form with zero terms removed.

Returns: Lazy<S<'unit>>

Static members

Static member Description

l * r

Full Usage: l * r

Parameters:
    l : S<'unit> - The left sum.
    r : S<'unit> - The right sum.

Returns: S<'unit> A sum containing all pairwise products: (Σᵢ Pᵢ)(Σⱼ Qⱼ) = Σᵢⱼ (Pᵢ × Qⱼ).

Tensor product operator: distributes multiplication over both sums.

l : S<'unit>

The left sum.

r : S<'unit>

The right sum.

Returns: S<'unit>

A sum containing all pairwise products: (Σᵢ Pᵢ)(Σⱼ Qⱼ) = Σᵢⱼ (Pᵢ × Qⱼ).

l + r

Full Usage: l + r

Parameters:
    l : S<'unit> - The left sum.
    r : S<'unit> - The right sum.

Returns: S<'unit> A sum containing all terms from both operands, with like terms combined.

Sum operator: combines two sums into one.

l : S<'unit>

The left sum.

r : S<'unit>

The right sum.

Returns: S<'unit>

A sum containing all terms from both operands, with like terms combined.

S.Apply(coeff, terms)

Full Usage: S.Apply(coeff, terms)

Parameters:
Returns: S<'unit>

Creates a sum from an array of products with an overall coefficient.

coeff : Complex
terms : P<'unit>[]
Returns: S<'unit>

S.Apply(coeff, term)

Full Usage: S.Apply(coeff, term)

Parameters:
Returns: S<'unit>

Creates a sum containing a single product with the given overall coefficient.

coeff : Complex
term : P<'unit>
Returns: S<'unit>

S.Apply(coeff, units)

Full Usage: S.Apply(coeff, units)

Parameters:
Returns: S<'unit>

Creates a sum containing a single product with the given overall coefficient.

coeff : Complex
units : C<'unit>[]
Returns: S<'unit>

S.Apply(coeff, unit)

Full Usage: S.Apply(coeff, unit)

Parameters:
Returns: S<'unit>

Creates a sum containing a single coefficient-operator pair with additional scaling.

coeff : Complex
unit : C<'unit>
Returns: S<'unit>

S.Apply(coeff, item)

Full Usage: S.Apply(coeff, item)

Parameters:
Returns: S<'unit>

Creates a sum containing a single unit with the given coefficient.

coeff : Complex
item : 'unit
Returns: S<'unit>

S.Apply(terms)

Full Usage: S.Apply(terms)

Parameters:
    terms : P<'unit>[]

Returns: S<'unit>

Creates a sum from an array of product terms.

terms : P<'unit>[]
Returns: S<'unit>

S.Apply(term)

Full Usage: S.Apply(term)

Parameters:
    term : P<'unit>

Returns: S<'unit>

Creates a sum containing a single product term.

term : P<'unit>
Returns: S<'unit>

S.Apply(units)

Full Usage: S.Apply(units)

Parameters:
    units : C<'unit>[]

Returns: S<'unit>

Creates a sum containing a single product made from the given units.

units : C<'unit>[]
Returns: S<'unit>

S.Apply(unit)

Full Usage: S.Apply(unit)

Parameters:
    unit : C<'unit>

Returns: S<'unit>

Creates a sum containing a single coefficient-operator pair.

unit : C<'unit>
Returns: S<'unit>

S.Apply(item)

Full Usage: S.Apply(item)

Parameters:
    item : 'unit

Returns: S<'unit>

Creates a sum containing a single unit with coefficient 1.

item : 'unit
Returns: S<'unit>

S.TryCreateFromString(unitFactory) (s)

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

Parameters:
    unitFactory : string -> 'unit option - A function that parses individual unit strings.
    s : String - The string to parse, in format "{[term1]; [term2]; ...}".

Returns: S<'unit> option Some sum if parsing succeeds; None otherwise.

Attempts to parse a sum from a string representation.

unitFactory : string -> 'unit option

A function that parses individual unit strings.

s : String

The string to parse, in format "{[term1]; [term2]; ...}".

Returns: S<'unit> option

Some sum if parsing succeeds; None otherwise.

S.Unity

Full Usage: S.Unity

Returns: S<'unit>

The multiplicative identity: coefficient 1, no terms.

Returns: S<'unit>

Type something to start searching.