Tensor Network Theory Library  Beta release 1.2.1
A library of routines for performing TNT-based operations
 All Data Structures Functions Variables Groups Pages
tntMatAppendOpArray.m
1 %======================================================================
2 %> @ingroup matscripts
3 %> Turns a matrix into a node structure representing an operator in the MPS library.
4 %> To create a single node, call the function passing a cell of length 1 containing the matrix. The node can then be loaded using tntNodesLoad().
5 %>
6 %> To create a node array, call the function passing a cell array, each entry contraining a matrix. The node can then be loaded using tntNodeArraysLoad().
7 %>
8 %> The nodes are created have two legs according to the labelling of the MPS library i.e. columns correspond to the upwards facing leg and are labelled "U", rows correspond to the downwards facing leg and are labelled "D".
9 %>
10 %> @param ops A cell array contraining matrices for the operators.
11 %>
12 %> @retval narr A structure representing a singe node or a node array.
13 %======================================================================
14 function narrout = tntMatAppendOpArray(narrin,op)
15 
16 if (~ismatrix(op))
17  error('input operator must be a matrix!');
18 end
19 
20 narrout = narrin;
21 
22 tensor.elems_type = 'values';
23 tensor.elems.vals = op;
24 tensor.dims = size(op);
25 tensor.qn_info.qn_dir = [0,0];
26 tensor.qn_info.qn_index = {[],[]};
27 
28 narrout(length(narrin)+1).tensor = tensor;
29 narrout(length(narrin)+1).ids = 'DU';
30 narrout(length(narrin)+1).indices = {0,1};
31 
32 end
void tntNodesLoad(const char *loadname, tntNode varA, tntNode varB, tntNode varC, tntNode varD, tntNode varE)
Definition: tntLoad.c:276
function tntMatAppendOpArray(in narrin, in op)
void tntNodeArraysLoad(const char *loadname, tntNodeArray arrA, tntNodeArray arrB, tntNodeArray arrC, tntNodeArray arrD, tntNodeArray arrE)
Definition: tntLoad.c:311