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
Functional nodes

Detailed Description

A functional node contains a number of operators, and information for building the node from a function, and operators and parameters. The node can be created using the function tntNodeFuncCreate() or loaded from an initialisation file, where it is built using the function tntMatCreateFunctionalOp().

Multiple copies of this node can then be made for using at different points in the network. The parameter values for each point in the node are then set using the functions tntNodeSetRealParam() or tntNodeSetCompParam(). Note that once the node has been used in a calculation e.g. tntNodeContractPair(), the functional nature is lost.

Functions

tntNode tntNodeFuncCreate (tntComplexArray *nodeVals, unsigned numops, char *opstr, tntLegLabel leglabels, unsigned dimleg1, unsigned dim...)
 
void tntNodeSetCompParam (tntNode A, tntComplex pval, unsigned pnum)
 
void tntNodeSetRealParam (tntNode A, double pval, unsigned pnum)
 

Function Documentation

tntNode tntNodeFuncCreate ( tntComplexArray *  nodeVals,
unsigned  numops,
char *  opstr,
tntLegLabel  leglabels,
unsigned  dimleg1,
unsigned  dim... 
)

Creates a new functional node, where each operator is made using the values given in the 1D complex array nodevals.

The label that should be assigned to each leg should be passed as a string, the length of which sets the number of legs (maximum number 12) The dimension of each leg should be passed as the final arguments. If the number of dimensions supplied is less than the length of the string, it will be assumed that all remaining legs have a dimension of 1. The legs should be order such that the one with the fastest running index in the supplied array comes first. e.g. if there are three legs have respective indices \(i,j,k\) with dimensions \(d_i,d_j,d_k\), the then index in the suplied 1D array should be \( i + d_i j + d_i d_j k \). (Note: If there are two dimensions, rows then columns, this is equivalent to column-major order which is the default in MATLAB and Fortran).

The size of the array must be \(d_i d_j d_k\).

The values are copied from nodevals, so if the array is no longer required it should be freed afterwards using tntComplexArrayFree().

Returns
The new node.
Parameters
nodeValsThe values for the node. If NULL, node will be filled with random values.
leglabelsThe label that will be assigned to each leg.
dimleg1The dimension of the first leg (optional).
dim...Dimensions of remaining legs in the order of the labels (optional).
Examples:
create_nodes.c.

Definition at line 495 of file tntNodeUtil.c.

void tntNodeSetCompParam ( tntNode  A,
tntComplex  pval,
unsigned  pnum 
)

Sets complex parameters for functional nodes. If there are multiple parameters, this function should be called once for each parameter. These parameters will then be used to generate the tensor using the operators and linked function set when the node was first created. Trying to set a parameter for a node that is not a functional node will cause an error.

Parameters
AThe node to set the parameter for
pvalThe value to set for the parameter
pnumIndex specifying which parameter should be set, where the index counts from zero.
Examples:
create_nodes.c.

Definition at line 668 of file tntNodeUtil.c.

void tntNodeSetRealParam ( tntNode  A,
double  pval,
unsigned  pnum 
)

Sets a real parameter for functional nodes. If there are multiple parameters, this function should be called once for each parameter. These parameters will then be used to generate the tensor using the operators and linked function set when the node was first created. Trying to set a parameter for a node that is not a functional node will cause an error.

Parameters
AThe node to set the parameter for
pvalThe value to set for the parameter
pnumIndex specifying which parameter should be set, where the index counts from zero.
Examples:
create_nodes.c.

Definition at line 651 of file tntNodeUtil.c.