Tensor Network Theory Library  Beta release 1.0
A library of routines for performing TNT-based operations
Loading data

Functions

void tntLoadParams (const char *loadname, unsigned num_int, unsigned num_dbl, unsigned num_cmp,...)
 
void tntLoadStrings (const char *loadname, unsigned num_str,...)
 
void tntLoadArrays (const char *loadname, unsigned num_int, unsigned num_dbl, unsigned num_cmp,...)
 
void tntLoadNodes (const char *loadname, unsigned num_nodes,...)
 
void tntLoadNetwork (const char *loadname, tntNetwork *tnwp, const char *init_name, const char *network_name, const char *network_sz, const char *connections_name)
 

Detailed Description

This section describes functions for loading different data types from a MATLAB file. Different input formats will later be added.

Function Documentation

void tntLoadArrays ( const char *  loadname,
unsigned  num_int,
unsigned  num_dbl,
unsigned  num_cmp,
  ... 
)

Loads the system parameters that are simple arrays (of type either int, double or tntComplex), and loads the entire MATLAB array. These are arrays that are used for lists of parameters etc, not for network information (such as operators or wave functions). The function assumes that memory is not allocated for the array values. The function accepts a variable number of arguments, to allow as many variables as needed to be loaded. The variable list of arguments have (the total number of arrays to load)*2 arguments, in the order:

  • tntIntArray *var_name
  • const char *matlab_name
  • ... (repeated for all integer types)
  • tntDoubleArray *var_name
  • const char *matlab_name
  • ... (repeated for all double types)
  • tntComplexArray *var_name
  • const char *matlab_name
  • ... (repeated for all tntComplex types)
    Returns
    No return value.
Parameters
loadnameThe name of the input file
num_intThe number of arrays to load of type integer
num_dblThe number of arrays to load of type double
num_cmpThe number of arrays to load of type tntComplex
void tntLoadNetwork ( const char *  loadname,
tntNetwork tnwp,
const char *  init_name,
const char *  network_name,
const char *  network_sz,
const char *  connections_name 
)

Loads the arrays that represent network from a matlab file, and initialises the network by calling init_network. See example MATLAB files for more details on loading the network parameters.

Returns
No return value.
Parameters
loadnameThe name of the input file
tnwpPointer to the new network
init_nameName of the MATLAB variable that stores information about the initialisation type for the tensors
network_nameif init_type = PRELOAD, the name of the matlab variable that stores the tensor values. Otherwise argument is ignored.
network_szif init_type != PRELOAD, an array which gives the dimension of each connection type
connections_nameName of the MATLAB variable that stores information about the connections between the nodes
void tntLoadNodes ( const char *  loadname,
unsigned  num_nodes,
  ... 
)

Loads arrays from a matlab file and builds tnodes from them. There is a list of arguments of variable length, which must be a multiple of three, and be in groups of:

  • tntNode *var_name - A pointer to the new tnode
  • const char *matlab_name - A character array giving the name of the MATLAB variable that stores the array
  • const char *matlab_idname - A character array giving the name of the MATLAB variable that stores the array of leg ids
Returns
No return value.
Parameters
loadnameThe name of the input file
num_nodesThe number of tnodes to load
void tntLoadParams ( const char *  loadname,
unsigned  num_int,
unsigned  num_dbl,
unsigned  num_cmp,
  ... 
)

Loads the system parameters that are single numbers (of type either int, double or tntComplex). The function accepts a variable number of arguments, to allow as many variables as needed to be loaded. The variable list of arguments must have (the total number of parameters to load)*3 arguments, in the order:

  • int *var_name
  • const char *matlab_name
  • unsigned index (in matlab array)
  • ... (repeated for all integer types)
  • double *var_name
  • const char *matlab_name
  • unsigned index (in matlab array)
  • ... (repeated for all double types)
  • tntComplex *var_name
  • const char *matlab_name
  • unsigned index (in matlab array)
  • ... (repeated for all tntComplex types) The index counts from 0 (not 1, as with usual MATLAB indexing).
Returns
No return value.
Parameters
loadnameThe name of the input file
num_intThe number of parameters to load of type integer
num_dblThe number of parameters to load of type double
num_cmpThe number of parameters to load of type tntComplex
void tntLoadStrings ( const char *  loadname,
unsigned  num_str,
  ... 
)

Loads string variables from the input file. The function accepts a variable number of arguments, to allow as many variables as needed to be loaded. The variable list of arguments must have (the total number of parameters to load)*2 arguments, in the order:

  • char *var_name
  • const char *matlab_name
  • ... (repeated for all strings) The variable to load the string into should be a pre-allocated character array of size TNT_STRLEN.
    Returns
    No return value.
Parameters
loadnameThe name of the input file
num_strThe number of strings to load