RealTerm

class zixy.fermion.RealTerm(modes: int | Modes = 0, source: Cmpnt[ImplT, SpecT] | SpecT | tuple[SpecT | Cmpnt[ImplT, SpecT], CoeffT | None] = '')[source]

Bases: Term[float]

A term consisting of a normal-ordered fermionic string and a real coefficient.

A single mode-based term consisting of a normal-ordered fermionic string and a float coefficient that may be an owning instance referencing a single element in a TermData instance, or a view on an element in another collection.

__eq__(other: object) bool

Return whether self and other are equal.

__init__(modes: int | Modes = 0, source: Cmpnt[ImplT, SpecT] | SpecT | tuple[SpecT | Cmpnt[ImplT, SpecT], CoeffT | None] = '')

Initialize the term.

Parameters:
  • modes – The mode space or number of modes.

  • source – The term specifier to use for initial value.

__mul__(rhs: OtherCoeffT | String | Term[OtherCoeffT]) Term[Any] | TermSum[Any][source]
Overloads:
  • self, rhs (Sign) → RealTerm

  • self, rhs (ComplexSign) → ComplexTerm

  • self, rhs (float) → RealTerm

  • self, rhs (complex) → ComplexTerm

  • self, rhs (Expr) → SymbolicTerm

  • self, rhs (String) → RealTermSum

  • self, rhs (SignTerm) → RealTermSum

  • self, rhs (RealTerm) → RealTermSum

  • self, rhs (ComplexTerm) → ComplexTermSum

  • self, rhs (SymbolicTerm) → SymbolicTermSum

Multiplication of self by rhs.

__neg__() Self

Return the negation of self.

__pos__() Self

Return self.

__repr__() str

Return a string representation of self.

__rmul__(lhs: OtherCoeffT | String | Term[OtherCoeffT]) Term[Any] | TermSum[Any][source]
Overloads:
  • self, lhs (Sign) → RealTerm

  • self, lhs (ComplexSign) → ComplexTerm

  • self, lhs (float) → RealTerm

  • self, lhs (complex) → ComplexTerm

  • self, lhs (Expr) → SymbolicTerm

  • self, lhs (String) → RealTermSum

  • self, lhs (SignTerm) → RealTermSum

  • self, lhs (RealTerm) → RealTermSum

  • self, lhs (ComplexTerm) → ComplexTermSum

  • self, lhs (SymbolicTerm) → SymbolicTermSum

Multiplication of lhs by self.

aliases(other: Term[Any, Any, Any]) bool

Determine whether self is a view of the same component as other.

clear() None

Set the value of the component to zero and the coefficient to unity.

Note

This method operates in-place.

clone() Self

Return a deep copy of self.

property cmpnt: Cmpnt[ImplT, SpecT]

Get a view on the component of self.

property cmpnt_type: type[Cmpnt[ImplT, SpecT]]

Get the component type of self.

cmpnts_type

alias of Strings

property coeff: CoeffT

Get a copy of the coefficient of self.

coeff_type

alias of float

property coeffs_type: type[Coeffs[CoeffT]]

Get the coefficient container type of self.

dagger() None

Take the adjoint of self in-place, including the fermionic sign.

daggered() Self

Return the adjoint of self.

classmethod from_cmpnt_coeff(cmpnt: Cmpnt[ImplT, SpecT], coeff: CoeffT) Self

Factory to make an instance of cls from a component and a coefficient.

Parameters:
  • cmpnt – Component to copy from.

  • coeff – Coefficient scaling the cmpnt in the new instance.

Returns:

An instance of cls with the given component and coefficient.

classmethod from_str(source: str, *args: Any, **kwargs: Any) Self

Create an instance of cls from a string.

Parameters:
  • source – String to parse.

  • *args – Positional arguments to forward to the component constructor.

  • **kwargs – Keyword arguments to forward to the component constructor.

Returns:

An instance of cls parsed from source.

into(t: type[OutT]) OutT

Clone self into a new related container of type t.

Parameters:

t – Type of the new container to create.

Returns:

A new instance of t containing the same data as self.

is_owning() bool

Check if self is owning (i.e. not a view).

property modes: Modes

Get the modes corresponding to self.

classmethod parse(source: str) Self

Parse a string into an instance of cls.

Deprecated:

use from_str() instead.

Parameters:

source – String to parse.

Returns:

An instance of cls parsed from source.

set(source: Self | Cmpnt[ImplT, SpecT] | SpecT | tuple[SpecT | Cmpnt[ImplT, SpecT], CoeffT | None]) None

Set the value of the term.

Parameters:

source – Specification for the new value.

Note

This method operates in-place.

property string: String

Get the string component of the term.

to_str() str

Return the canonical string representation of self.