QN

Description

ITensors.QNType

A QN object stores a collection of up to four named values such as ("Sz",1) or ("N",0). These values can include a third integer "m" which makes them obey addition modulo m, for example ("P",1,2) for a value obeying addition mod 2. (The default is regular integer addition).

Adding or subtracting pairs of QN objects performs addition and subtraction element-wise on each of the named values. If a name is missing from the collection, its value is treated as zero.

source

Constructors

ITensors.QNMethod
QN(qvs...)

Construct a QN from a set of up to four named value tuples.

Examples

q = QN(("Sz",1))
q = QN(("N",1),("Sz",-1))
q = QN(("P",0,2),("Sz",0)).
source
ITensors.QNType
QN(name,val::Int,modulus::Int=1)

Construct a QN with a single named value by providing the name, value, and optional modulus.

source
ITensors.QNType
QN(val::Int,modulus::Int=1)

Construct a QN with a single unnamed value (equivalent to the name being the empty string) with optional modulus.

source

Properties

ITensors.valMethod
val(q::QN,name)

Get the value within the QN q corresponding to the string name

source
ITensors.modulusMethod
modulus(q::QN,name)

Get the modulus within the QN q corresponding to the string name

source
Base.zeroMethod
zero(q::QN)

Returns a QN object containing the same names as q, but with all values set to zero.

source