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
tntMpsProcessExpecOptions.c
1 /*
2 Authors: Sarah Al-Assam, Stephen Clark and Dieter Jaksch
3 $LastChangedDate$
4 (c) University of Oxford 2014
5 */
6 
12 /* Include the internal header for the TNT library */
13 #include "tntMpsInternal.h"
14 
15 #include <getopt.h>
16 #include <ctype.h>
17 
18 /* --- Definitions that don't depend on system type --*/
19 
20 /* Number of types of two-site terms (e.g. nearest neighbour, centre site, all pairs) */
21 #define TNT_NUM_TSTYPES 3
22 
23 /* The number codes for types of two-site terms */
24 #define TNT_TSTYPE_NN 0 /* Nearest neighbour terms */
25 #define TNT_TSTYPE_CS 1 /* Centre-site terms */
26 #define TNT_TSTYPE_AP 2 /* All pairs of sites */
27 
28 /* String lengths for the two-site character codes */
29 #define TNT_TSTYPE_STRLEN 4
30 
31 /* --- Definitions for spin systems --*/
32 
33 /* Number of allowed spin on-site and two-site terms + 1 (zero entry not used) */
34 #define TNT_SP_NUMOSTERMS 4
35 #define TNT_SP_NUMTSTERMS 11
36 
37 /* Types of onsite expectation value for spin systems */
38 /* Number value gives array entry+1, or option code */
39 #define TNT_SP_OS_SX 1
40 #define TNT_SP_OS_SY 2
41 #define TNT_SP_OS_SZ 3
42 
43 /* Types of two site expectation value for spin systems */
44 /* Number value gives array entry+1, or option code */
45 #define TNT_SP_TS_SXSX 1
46 #define TNT_SP_TS_SYSY 2
47 #define TNT_SP_TS_SZSZ 3
48 #define TNT_SP_TS_SXSY 4
49 #define TNT_SP_TS_SYSZ 5
50 #define TNT_SP_TS_SZSX 6
51 #define TNT_SP_TS_SYSX 7
52 #define TNT_SP_TS_SZSY 8
53 #define TNT_SP_TS_SXSZ 9
54 #define TNT_SP_TS_SPSM 10
55 
56 /* --- Definitions for boson systems --*/
57 
58 /* Number of allowed boson on-site and two-site terms + 1 (zero entry not used) */
59 #define TNT_BS_NUMOSTERMS 6
60 #define TNT_BS_NUMTSTERMS 3
61 
62 /* Types of onsite expectation value for boson systems */
63 /* Number value gives array entry, or option code */
64 #define TNT_BS_OS_N 1
65 #define TNT_BS_OS_INT 2
66 #define TNT_BS_OS_NSQ 3
67 #define TNT_BS_OS_Q1 4
68 #define TNT_BS_OS_Q2 5
69 
70 /* Types of two site expectation value for boson systems */
71 /* Number value gives array entry, or option code */
72 #define TNT_BS_TS_BDB 1
73 #define TNT_BS_TS_DD 2
74 
201  char **argv,
202  tntMpsExOp *ExOp)
204 {
205 
206  int option_index;
207  int c; /* Variable that contains the returned option code from getopt_long */
208  char **argv_cp; /* Used to hold a copy of the arguments - this will be used by the function instead of the original arguments */
209  unsigned numos = 0; /* Number of onsite expectation values to calculate */
210  unsigned numts[TNT_NUM_TSTYPES] = {0,0,0}; /* Number of two-site expectation values of each type to calculate */
211  char ts_labels[TNT_NUM_TSTYPES][TNT_STRLEN] = {"nearest-neighbour","centre-site","all"};
212  char ts_codes[TNT_NUM_TSTYPES][TNT_TSTYPE_STRLEN] = {"nn","cs","ap"};
213  tntNodeArray *ts_narrays[TNT_NUM_TSTYPES]; /* Array of pointers to tntNodeArray arguments to be populated */
214  tntStringArray *ts_sarrays[TNT_NUM_TSTYPES]; /* Array of pointers to tntStringArray arguments to be populated */
215  int loop, tstype; /* loop counter for terms, type of two-site term */
216 
217  int numosterms; /* Number of onsite terms */
218  int numtsterms; /* Number of two-site terms */
219  struct option *os_options; /* Options available for onsite terms. Must all have no_argument set as argument type. */
220  struct option *ts_options; /* Options available for two-site terms. Must all have optional_argument set as argument type. */
221  tntStringArray osop_strs, tsop_strs; /* String for each one-site and two-site term */
222  tntNodeArray osop_ops, tsop_ops[2]; /* Operators for each one-site and each site of each two-site term */
223  tntIntArray osop_present, tsop_present; /* Specifies whether each one-site term or two-site term is present */
224 
225  tntPrintf("----------------------------------------------------------\n");
226  tntPrintf("The following expectation values will be calculated in the simulation: \n");
227 
228  /* Assign the expectation value operator arrays to the arrays for two-site expectation values */
229  ts_narrays[TNT_TSTYPE_NN] = &(ExOp->ExOp2nn);
230  ts_narrays[TNT_TSTYPE_CS] = &(ExOp->ExOp2cs);
231  ts_narrays[TNT_TSTYPE_AP] = &(ExOp->ExOp2ap);
232 
233  ts_sarrays[TNT_TSTYPE_NN] = &(ExOp->LbOp2nn);
234  ts_sarrays[TNT_TSTYPE_CS] = &(ExOp->LbOp2cs);
235  ts_sarrays[TNT_TSTYPE_AP] = &(ExOp->LbOp2ap);
236 
237  /* Set allowed options for each type of system */
238  if (TNT_MPS_SPIN == tntSysTypeGet()) { /* Do this bit if the system is a spin system - all bosonic command line arguments will be ignored. */
239 
240 
241  /* Assign the arrays that will be used for dealing with the command line options */
242 
243  /* Long options for spin onsite terms */
244  static struct option sp_os_options[] = {
245  {"Ex1Sx", no_argument, 0, TNT_SP_OS_SX},
246  {"Ex1Sy", no_argument, 0, TNT_SP_OS_SY},
247  {"Ex1Sz", no_argument, 0, TNT_SP_OS_SZ},
248  {0, 0, 0, 0}
249  };
250 
251  /* Long options for spin two-site terms */
252  static struct option sp_ts_options[] = {
253  {"Ex2SxSx", optional_argument, 0, TNT_SP_TS_SXSX},
254  {"Ex2SySy", optional_argument, 0, TNT_SP_TS_SYSY},
255  {"Ex2SzSz", optional_argument, 0, TNT_SP_TS_SZSZ},
256  {"Ex2SxSy", optional_argument, 0, TNT_SP_TS_SXSY},
257  {"Ex2SySz", optional_argument, 0, TNT_SP_TS_SYSZ},
258  {"Ex2SzSx", optional_argument, 0, TNT_SP_TS_SZSX},
259  {"Ex2SySx", optional_argument, 0, TNT_SP_TS_SYSX},
260  {"Ex2SzSy", optional_argument, 0, TNT_SP_TS_SZSY},
261  {"Ex2SxSz", optional_argument, 0, TNT_SP_TS_SXSZ},
262  {"Ex2SpSm", optional_argument, 0, TNT_SP_TS_SPSM},
263  {0, 0, 0, 0}
264  };
265 
266  /* Create all the operators needed for processing the command line options */
267  tntNode Sx, Sy, Sz, Sp, Sm; /* Spin operators */
268  unsigned TwoS = tntNodeGetLegDim(tntSysBasisOpGet(),"D") - 1; /* Physical dimension of the spin system */
269 
270  /* Create the spin operators */
271  tntMpsCreateSpinOp(TwoS, &Sx, &Sy, &Sz, &Sp, &Sm, NULL);
272 
273  /* Set variables that are system dependent */
274  numosterms = TNT_SP_NUMOSTERMS; /* Number of onsite terms */
275  numtsterms = TNT_SP_NUMTSTERMS; /* Number of two-site terms */
276  os_options = sp_os_options; /* Options available for onsite terms. Must all have no_argument set as argument type. */
277  ts_options = sp_ts_options; /* Options available for two-site terms. Must all have optional_argument set as argument type. */
278 
279  /* String for each one-site term */
280  osop_strs = tntStringArrayAlloc(numosterms);
281  strcpy(osop_strs.vals[TNT_SP_OS_SX], "Sx");
282  strcpy(osop_strs.vals[TNT_SP_OS_SY], "Sy");
283  strcpy(osop_strs.vals[TNT_SP_OS_SZ], "Sz");
284 
285  /* Operators for each one-site term */
286  osop_ops = tntNodeArrayAlloc(numosterms);
287  osop_ops.vals[TNT_SP_OS_SX] = tntNodeCopy(Sx);
288  osop_ops.vals[TNT_SP_OS_SY] = tntNodeCopy(Sy);
289  osop_ops.vals[TNT_SP_OS_SZ] = tntNodeCopy(Sz);
290 
291  /* String for each two-site term */
292  tsop_strs = tntStringArrayAlloc(numtsterms);
293  strcpy(tsop_strs.vals[TNT_SP_TS_SXSX], "SxSx");
294  strcpy(tsop_strs.vals[TNT_SP_TS_SYSY], "SySy");
295  strcpy(tsop_strs.vals[TNT_SP_TS_SZSZ], "SzSz");
296  strcpy(tsop_strs.vals[TNT_SP_TS_SXSY], "SxSy");
297  strcpy(tsop_strs.vals[TNT_SP_TS_SYSZ], "SySz");
298  strcpy(tsop_strs.vals[TNT_SP_TS_SZSX], "SzSx");
299  strcpy(tsop_strs.vals[TNT_SP_TS_SYSX], "SySx");
300  strcpy(tsop_strs.vals[TNT_SP_TS_SZSY], "SzSy");
301  strcpy(tsop_strs.vals[TNT_SP_TS_SXSZ], "SxSz");
302  strcpy(tsop_strs.vals[TNT_SP_TS_SPSM], "SpSm");
303 
304  /* Operators for each site of two-site term */
305  tsop_ops[0] = tntNodeArrayAlloc(numtsterms); tsop_ops[1] = tntNodeArrayAlloc(numtsterms);
306  tsop_ops[0].vals[TNT_SP_TS_SXSX] = tntNodeCopy(Sx); tsop_ops[1].vals[TNT_SP_TS_SXSX] = tntNodeCopy(Sx);
307  tsop_ops[0].vals[TNT_SP_TS_SYSY] = tntNodeCopy(Sy); tsop_ops[1].vals[TNT_SP_TS_SYSY] = tntNodeCopy(Sy);
308  tsop_ops[0].vals[TNT_SP_TS_SZSZ] = tntNodeCopy(Sz); tsop_ops[1].vals[TNT_SP_TS_SZSZ] = tntNodeCopy(Sz);
309  tsop_ops[0].vals[TNT_SP_TS_SXSY] = tntNodeCopy(Sx); tsop_ops[1].vals[TNT_SP_TS_SXSY] = tntNodeCopy(Sy);
310  tsop_ops[0].vals[TNT_SP_TS_SYSZ] = tntNodeCopy(Sy); tsop_ops[1].vals[TNT_SP_TS_SYSZ] = tntNodeCopy(Sz);
311  tsop_ops[0].vals[TNT_SP_TS_SZSX] = tntNodeCopy(Sz); tsop_ops[1].vals[TNT_SP_TS_SZSX] = tntNodeCopy(Sx);
312  tsop_ops[0].vals[TNT_SP_TS_SYSX] = tntNodeCopy(Sy); tsop_ops[1].vals[TNT_SP_TS_SYSX] = tntNodeCopy(Sx);
313  tsop_ops[0].vals[TNT_SP_TS_SZSY] = tntNodeCopy(Sz); tsop_ops[1].vals[TNT_SP_TS_SZSY] = tntNodeCopy(Sy);
314  tsop_ops[0].vals[TNT_SP_TS_SXSZ] = tntNodeCopy(Sx); tsop_ops[1].vals[TNT_SP_TS_SXSZ] = tntNodeCopy(Sz);
315  tsop_ops[0].vals[TNT_SP_TS_SPSM] = tntNodeCopy(Sp); tsop_ops[1].vals[TNT_SP_TS_SPSM] = tntNodeCopy(Sm);
316 
317  /* Free the spin operators */
318  tntNodeFree(&Sx);
319  tntNodeFree(&Sy);
320  tntNodeFree(&Sz);
321  tntNodeFree(&Sp);
322  tntNodeFree(&Sm);
323 
324  } else if (TNT_MPS_BOSON == tntSysTypeGet()) { /* Do this bit if the system is a bosonic system - all spin command line arguments will be ignored. */
325 
326  /* Assign the arrays that will be used for dealing with the command line options */
327 
328  /* Long options for boson onsite terms */
329  static struct option bs_os_options[] = { /* Long options for bosonic onsite terms */
330  {"Ex1N", no_argument, 0, TNT_BS_OS_N},
331  {"Ex1Int", no_argument, 0, TNT_BS_OS_INT},
332  {"Ex1Nsq", no_argument, 0, TNT_BS_OS_NSQ},
333  {"Ex1Q1", no_argument, 0, TNT_BS_OS_Q1},
334  {"Ex1Q2", no_argument, 0, TNT_BS_OS_Q2},
335  {0, 0, 0, 0}
336  };
337 
338  /* Long options for boson two-site terms */
339  static struct option bs_ts_options[] = { /* Long options for nearest-neighbour bosonic two-site terms */
340  {"Ex2bdagb", optional_argument, 0, TNT_BS_TS_BDB},
341  {"Ex2denden", optional_argument, 0, TNT_BS_TS_DD},
342  {0, 0, 0, 0}
343  };
344 
345 
346  /* Create all the operators needed for processing the command line options */
347  tntNode b, bdag, n, os_int, nsq, ncp, Q1, Q2; /* Boson operators */
348  unsigned nmax = tntNodeGetLegDim(tntSysBasisOpGet(),"D") - 1; /* Maximum number of bosons on each site */
349  tntComplex imag = {0,1.0}; /* i */
350 
351  /* Create the boson operators */
352  tntMpsCreateBosonOp(nmax, &b, &bdag, &n, &os_int, NULL);
353 
354  /* ---- Create the nodes to make the term n^2 ---- */
355  nsq = tntNodeCopy(n);
356  ncp = tntNodeCopy(n);
357  tntNodeJoin(ncp,"D",nsq,"U");
358  nsq = tntNodeContract(ncp,nsq);
359 
360  /* ---- Create the nodes to make the term b + bdag ---- */
361  Q1 = tntNodeCopy(b);
362  tntNodeAdd(Q1,bdag);
363 
364  /* ---- Create the nodes to make the term i(b - bdag) ---- */
365  Q2 = tntNodeCopy(bdag);
366  tntNodeScaleReal(Q2,-1.0);
367  tntNodeAdd(Q2,b);
368  tntNodeScaleComplex(Q2,imag);
369 
370  /* Set variables that are system dependent */
371  numosterms = TNT_BS_NUMOSTERMS; /* Number of onsite terms */
372  numtsterms = TNT_BS_NUMTSTERMS; /* Number of two-site terms */
373  os_options = bs_os_options; /* Options available for onsite terms. Must all have no_argument set as argument type. */
374  ts_options = bs_ts_options; /* Options available for two-site terms. Must all have optional_argument set as argument type. */
375 
376  /* String for each one-site term */
377  osop_strs = tntStringArrayAlloc(numosterms);
378  strcpy(osop_strs.vals[TNT_BS_OS_N], "density");
379  strcpy(osop_strs.vals[TNT_BS_OS_INT], "interaction");
380  strcpy(osop_strs.vals[TNT_BS_OS_NSQ], "n_squared");
381  strcpy(osop_strs.vals[TNT_BS_OS_Q1], "Q1");
382  strcpy(osop_strs.vals[TNT_BS_OS_Q2], "Q2");
383 
384  /* Operators for each one-site term */
385  osop_ops = tntNodeArrayAlloc(numosterms);
386  osop_ops.vals[TNT_BS_OS_N] = tntNodeCopy(n);
387  osop_ops.vals[TNT_BS_OS_INT] = tntNodeCopy(os_int);
388  osop_ops.vals[TNT_BS_OS_NSQ] = tntNodeCopy(nsq);
389  osop_ops.vals[TNT_BS_OS_Q1] = tntNodeCopy(Q1);
390  osop_ops.vals[TNT_BS_OS_Q2] = tntNodeCopy(Q2);
391 
392  /* String for each two-site term */
393  tsop_strs = tntStringArrayAlloc(numtsterms);
394  strcpy(tsop_strs.vals[TNT_BS_TS_BDB], "bdagb");
395  strcpy(tsop_strs.vals[TNT_BS_TS_DD], "denden");
396 
397  /* Operators for each site of two-site term */
398  tsop_ops[0] = tntNodeArrayAlloc(numtsterms); tsop_ops[1] = tntNodeArrayAlloc(numtsterms);
399  tsop_ops[0].vals[TNT_BS_TS_BDB] = tntNodeCopy(b); tsop_ops[1].vals[TNT_BS_TS_BDB] = tntNodeCopy(bdag);
400  tsop_ops[0].vals[TNT_BS_TS_DD] = tntNodeCopy(n); tsop_ops[1].vals[TNT_BS_TS_DD] = tntNodeCopy(n);
401 
402  /* Free the boson operators */
403  tntNodeFree(&b);
404  tntNodeFree(&bdag);
405  tntNodeFree(&n);
406  tntNodeFree(&os_int);
407  tntNodeFree(&nsq);
408  tntNodeFree(&Q1);
409  tntNodeFree(&Q2);
410 
411  } else if (0 == tntSysTypeGet()) {
412  tntErrorPrint("Error setting up operators for expectation values: System type has not been set yet."); /* NO_COVERAGE */
413  } else { /* NO_COVERAGE */
414  tntErrorPrint("Error setting up operators for expectation values: System type %d is not known.", tntSysTypeGet()); /* NO_COVERAGE */
415  } /* NO_COVERAGE */
416 
417  /* -------------------------------------------------------------- */
418  /* ---- Now general part that doesn't depend on system type ----- */
419  /* -------------------------------------------------------------- */
420 
421 
422  /* Set opterr to zero to prevent error message for unknown erguments, since they may be being treated by another process options function */
423  opterr = 0;
424 
425  /* Allocate memory for arrays that determine whether or not a given term is present */
426  osop_present = tntIntArrayAlloc(numosterms);
427  tsop_present = tntIntArrayAlloc(numtsterms);
428 
429  /* Initialise arrays for whether terms are present - if term not present value -1 is assigned */
430  for (loop = 0; loop < numosterms; loop++)
431  osop_present.vals[loop] = -1;
432  for (loop = 0; loop < numtsterms; loop++)
433  tsop_present.vals[loop] = -1;
434 
435  /* --- Loop over the input arguments for onsite terms first --- */
436 
437  /* Set optind to 1 as option getting routine has already been called previously */
438  optind = 1;
439 
440  /* Make a copy of argv - getopt_long will permute the arguments, and they will be required by another processing function */
441  argv_cp = (char **) malloc(argc*sizeof(char *));
442  for (c = 0; c < argc; c++) {
443  argv_cp[c] = argv[c];
444  }
445 
446  /* Determine which options are present */
447  c = getopt_long(argc, argv_cp, "", os_options, &option_index);
448  while ((c = getopt_long(argc, argv_cp, "", os_options, &option_index)) != -1) {
449  /* Populate the array of flags */
450  if ((c <= numosterms)&&(-1 == osop_present.vals[c])) {
451  osop_present.vals[c] = 1;
452  tntPrintf(" - %s \n", osop_strs.vals[c]);
453  numos++;
454  }
455  }
456 
457  /* Allocate arrays to hold the terms and parameters that are present */
458  if (numos) {
459  ExOp->ExOpOs = tntNodeArrayAlloc(numos);
460  ExOp->LbOpOs = tntStringArrayAlloc(numos);
461  } else {
462  ExOp->ExOpOs.sz = 0;
463  ExOp->LbOpOs.sz = 0;
464  }
465 
466  /* reset the counter */
467  numos = 0;
468 
469  /* Loop through parameters and assign them to the array */
470  for (loop = 0; loop < numosterms; loop++) { /* Loop over all possible terms */
471  if (1 == osop_present.vals[loop]) { /* Check if this term is present */
472  ExOp->ExOpOs.vals[numos] = tntNodeCopy(osop_ops.vals[loop],0); /* Onsite operator */
473  strcpy(ExOp->LbOpOs.vals[numos], osop_strs.vals[loop]); /* Label for on-site operator */
474  numos++;
475  } /* end of check if term is present */
476  } /* End of loop over all possible onsite terms */
477 
478  /* -------------- Now deal with two-site terms ------------------ */
479 
480  /* Make a copy of argv - getopt_long will permute the arguments, and they may be required later */
481  for (c = 0; c<argc; c++)
482  argv_cp[c] = argv[c];
483 
484  /* Set optind to 1 as option getting routine has already been called previously */
485  optind = 1;
486 
487  /* Loop over options for these set of two-site terms, making a note if they are present, and increasing the count */
488  while ((c = getopt_long(argc, argv_cp, "", ts_options, &option_index)) != -1) {
489  /* Determine the type of two-site term. Default is nearest neighbour */
490  tstype = TNT_TSTYPE_NN;
491  if (optarg) {
492  for (tstype = 0; tstype < TNT_NUM_TSTYPES; tstype++) {
493  if (0 == strcmp(optarg,ts_codes[tstype]))
494  break; /* break if string is the same as a code - ensuring tstype takes the value of the term present */
495  }
496  }
497  /* Populate the array of flags */
498  if ((c <= numtsterms)&&(tsop_present.vals[c] != 1)) {
499  /* if the end of the loop was reached and no match found, set to default type, with warning for user */
500  if (TNT_NUM_TSTYPES == tstype) {
501  tntWarningPrint("Type %s not known for two-site operators. Defaulting to nearest neighbour for expectation of %s", optarg, tsop_strs.vals[c]);
502  tstype = TNT_TSTYPE_NN;
503  }
504  /* set the flag to the type of two-site term */
505  tsop_present.vals[c] = tstype;
506  /* print information for user */
507  tntPrintf(" - %s for %s pairs\n", tsop_strs.vals[c], ts_labels[tstype]);
508  /* increment the relevant counter */
509  numts[tstype]++;
510  }
511  } /* end of loop over options */
512 
513  /* Now the number has been counted, loop over type of two-site terms */
514  for (tstype = 0; tstype < TNT_NUM_TSTYPES; tstype++) {
515 
516  /* Allocate arrays to hold the terms and parameters that are present */
517  if (numts[tstype]) {
518  *(ts_narrays[tstype]) = tntNodeArrayAlloc(numts[tstype]*2); /* array twice size of number of terms, as two operators for each term */
519  *(ts_sarrays[tstype]) = tntStringArrayAlloc(numts[tstype]);
520  } else {
521  ts_narrays[tstype]->sz = 0;
522  ts_sarrays[tstype]->sz = 0;
523  }
524 
525  /* reset counter */
526  numts[tstype] = 0;
527  } /* End of loop over type of two-site terms */
528 
529  /* Loop through parameters and assign them to the correct array */
530  for (loop = 0; loop < numtsterms; loop++) { /* Loop over all possible terms */
531  if (-1 != tsop_present.vals[loop]) { /* Check if this term is present */
532  /* set the type of two-site term */
533  tstype = tsop_present.vals[loop];
534 
535  /* ---- Set the nodes to make the term ---- */
536  ts_narrays[tstype]->vals[2*numts[tstype]] = tntNodeCopy(tsop_ops[0].vals[loop],0); /* Operator acting on left */
537  ts_narrays[tstype]->vals[2*numts[tstype] + 1] = tntNodeCopy(tsop_ops[1].vals[loop],0); /* Operator acting on right */
538  strcpy(ts_sarrays[tstype]->vals[numts[tstype]], tsop_strs.vals[loop]); /* Label for two-site operator */
539  strcat(ts_sarrays[tstype]->vals[numts[tstype]], "_"); /* Append underscore */
540  strcat(ts_sarrays[tstype]->vals[numts[tstype]], ts_codes[tstype]); /* Append code for type of two-site operator */
541  numts[tstype]++;
542  } /* End of check if terms are present */
543  } /* End of loop over all possible two-site terms */
544 
545  tntPrintf("----------------------------------------------------------\n");
546 
547  /* Free the arrays */
548  free(argv_cp);
549  tntStringArrayFree(&osop_strs);
550  tntStringArrayFree(&tsop_strs);
551  tntNodeArrayFree(&osop_ops);
552  tntNodeArrayFree(tsop_ops);
553  tntNodeArrayFree(tsop_ops+1);
554  tntIntArrayFree(&osop_present);
555  tntIntArrayFree(&tsop_present);
556 
557 }
558 
559 
tntNode tntNodeCopy(tntNode A)
Definition: tntNodeUtil.c:304
#define tntMpsExOp
Definition: tntMps.h:75
void tntNodeArrayFree(tntNodeArray *arr)
Definition: tntArray.c:668
int tntSysTypeGet(void)
Definition: tntSys.c:376
void tntNodeJoin(tntNode A, tntLegLabel legA, tntNode B, tntLegLabel legB)
Definition: tntNodeConn.c:52
void tntStringArrayFree(tntStringArray *arr)
Definition: tntArray.c:684
void tntMpsCreateSpinOp(unsigned TwoS, tntNode *Sx, tntNode *Sy, tntNode *Sz, tntNode *Sp, tntNode *Sm, tntNode *eye)
void tntMpsProcessExpecOptions(int argc, char **argv, tntMpsExOp *ExOp)
tntNodeArray tntNodeArrayAlloc(unsigned num_elems)
Definition: tntArray.c:428
void tntMpsCreateBosonOp(unsigned Nmax, tntNode *b, tntNode *bd, tntNode *n, tntNode *os_int, tntNode *eye)
void tntNodeScaleComplex(tntNode A, tntComplex val)
void tntNodeAdd(tntNode A, tntNode B)
void tntNodeFree(tntNode *A)
Definition: tntNodeUtil.c:275
Definition: tnt.h:65
void tntIntArrayFree(tntIntArray *arr)
Definition: tntArray.c:620
tntIntArray tntIntArrayAlloc(unsigned numrows, unsigned numcols)
Definition: tntArray.c:29
tntNode tntNodeContract(tntNode A, tntNode B, tntLegLabel legMapAC, tntLegLabel legMapBC)
tntNode tntSysBasisOpGet(void)
Definition: tntSys.c:407
void tntNodeScaleReal(tntNode A, double val)
tntStringArray tntStringArrayAlloc(unsigned num_elems)
Definition: tntArray.c:492
int tntPrintf(const char *format,...)
Definition: tntPrint.c:77
unsigned tntNodeGetLegDim(tntNode A, tntLegLabel legA)
Definition: tntNodeInfo.c:246