Example 6: Operator representations¶
Objects of the classes LeafOperator, MultiLeafOperator and
SumOfProductOperator can be represented in the basis provided by a
TensorTree. Corresponding to every active node in the Tree,
the operator is represented by a Matrix. The representation is only required for
nodes where the representation is not trivial, i.e. not a identity matrix.
Active nodes are detected automatically by QuTree and the resulting object
belongs to the class SparseMatrixTree.
Similar to the DotProduct and Contraction routines for TensorTrees,
there is a bottom-up and top-down building routines for Operators.
The bottom-up representation of an operator can be build via
LeafOperatorcd& x2 = &LeafInterface::applyX2;
LeafOperatorcd& p = &LeafInterface::applyP;
MLOcd h(p, 0);
h.push_back(x2, 2);
Tree tree = TreeFactory::BalancedTree(8, 2, 2);
mt19937 gen; // RNG
TensorTreecd Psi(gen, tree);
SparseMatrixTreecd Hmat = TreeFunctions::Represent(h, Psi, tree);
The top-down representation of an operator (sometimes called mean-field matrices) requires previously build bottom-up matrices and is build by
SparseMatrixTreecd Hmean = TreeFunctions::Contraction(h, Psi, Hmat, tree);
The operator representation of a single LeafOperator or MultiLeafOperator results
in a single SparseMatrixTree; a SumOfProductOperator representation
requires a SparseMatrixTree for every summand, the list of those
objects is saved as a vector of SparseMatrixTrees, also called SparseMatrixTrees.
SOPcd H;
H.push_back(h, 1.);
H.push_back(h, 0.5);
SparseMatrixTreescd Hmats = TreeFunctions::Represent(H, Psi, tree);
SparseMatrixTreescd Hmeans = TreeFunctions::Contraction(H, Psi, Hmats, tree);
SparseTrees¶
A SparseTree is a directed subset of nodes in a tree. SparseTrees manage