Learn to Use ITensor

main / classes / qnitensor

QN ITensor

An QN ITensor is an ITensor whose indices have subspaces labeled by quantum numbers (QN objects) and as a result have block-sparse data storage. Most of the interface of an ITensor with these properties is the same as for a regular, dense ITensor. So adding, contracting, setting elements, and so on is done the same way. However, some operations are a little bit different: for example, when contracting two QN ITensors, contracted indices must have opposite arrow directions or an error will be thrown. Also some constructors require extra arguments when making a QN ITensor.

Most operations and functions for QN ITensors are documented on the ITensor page since they work for both dense and QN ITensors. Occasional slight differences in behavior for QN ITensors are noted on that page. The information below is about functions strictly related to QN ITensors only.

If an ITensor T is QN-sparse, that is a QN ITensor, then it will satisfy hasQNs(I)==true.

The QN section of the ITensor book has more introductory information about the QN system and QN ITensors.


// Make a collection of four QN Index objects 
// which carry QN information corresponding to
// S=1/2 spins:
auto sites = SpinHalf(4,{"ConserveQNs=",true})

// Generate a random QN ITensor which has an
// overall QN or flux of QN({"Sz",2}):
auto T = randomITensor(QN({"Sz",2}),sites(1),sites(2),sites(3),sites(4));

Constructors and Accessor Methods

QN ITensor Functions

This page current as of version 3.0.0

Back to Classes
Back to Main