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
tntMatCreateTwoSiteOpArray.m
1 %======================================================================
2 %> @ingroup matscripts
3 %> Turns a matrix into a node structure representing an operator in the MPS library.
4 %>
5 %> To create a single node, call the function passing a cell of length 1 containing the matrix.
6 %> The node can then be loaded using tntNodesLoad().
7 %>
8 %> To create a node array, call the function passing a cell array, each entry contraining a matrix.
9 %> The node can then be loaded using tntNodeArraysLoad().
10 %>
11 %> The nodes are created have four legs according to the labelling of propagator nodes in the MPS library.
12 %> The incoming matrix should have 4 dimensions.
13 %> The first two dimensions correspond to the downwards facing legs and are labelled "D" and "E".
14 %> The second two dimensions columns correspond to the upwards facing leg and are labelled "U" and "V".
15 %>
16 %> @param ops A cell array contraining matrices for the operators.
17 %>
18 %> @retval narr A structure representing a singe node or a node array.
19 %======================================================================
20 function narr = tntMatCreate2SitesOpArray(ops)
21 
22 if (isempty(ops))
23  narr = struct('tensor',{},'ids',{},'indices',{});
24 end
25 
26 for loop = 1:length(ops)
27  tensor.elems_type = 'values';
28  tensor.elems.vals = ops{loop};
29  tensor.dims = size(ops{loop});
30  tensor.qn_info.qn_dir = [0,0,0,0];
31  tensor.qn_info.qn_index = {[],[],[],[]};
32  narr(loop).tensor = tensor;
33  narr(loop).ids = 'DEUV';
34  narr(loop).indices = {0,1,2,3};
35 end
36 
37 end
function tntMatCreate2SitesOpArray(in ops)
void tntNodesLoad(const char *loadname, tntNode varA, tntNode varB, tntNode varC, tntNode varD, tntNode varE)
Definition: tntLoad.c:276
void tntNodeArraysLoad(const char *loadname, tntNodeArray arrA, tntNodeArray arrB, tntNodeArray arrC, tntNodeArray arrD, tntNodeArray arrE)
Definition: tntLoad.c:311