Learn to Use ITensor

main / classes / iqindex


(subclass of Index)

An IQIndex is a tensor index with additional structure. As a subtype of Index, an IQIndex has a name, size, type, prime level, and unique id number. IQIndex also inherits all of the class methods of Index.

An IQIndex is also divided into quantum number "blocks". Each block is defined by a Index-QN pair (an IndexQN) where the size of each block is the size of its Index. The size of an IQIndex is the total size of all of its blocks. The order and number of blocks of an IQIndex cannot be changed after the IQIndex is constructed.

For example, the IQIndex representing a single spin 1/2 has total size 2, which is made up of two blocks:

An IQIndex also has a direction, which is of type Arrow. An Arrow can be In or Out, and the default for an IQIndex is Out.
For more information on Arrows, see the page on index conventions.

IQIndex is defined in the header "itensor/iqindex.h".


// Make an IQIndex with five blocks
// and total size 4+8+10+8+4=34
auto I = IQIndex("I",Index("I+2",4),QN(+2),

Print(I.m()); //prints: I.m() = 34

//Get number of blocks of I
Print(I.nblock()); //prints: I.nblock() = 5

//Get Index and QN of block 2
Print(I.index(2)); //prints: (I+1,8,Link)
Print(I.qn(2));    //prints: QN(+1)

//Get direction of I
Print(I.dir()); //prints: I.dir() = Out

Class Methods (only showing those differing from Index)

Other Features of IQIndex

IQIndex Functions

Prime Level Functions

This page current as of version 2.0.6

Back to Classes
Back to Main