Next: , Previous: Subsets, Up: Subsets


Defining a subset

Subsets are defined through the data type QDP_Subset

Syntax QDP_Subset * QDP_create_subset(int (*func)(int x[], void *args), void *args, int argsize, int n);


Meaning Creates an array of n subsets based on func.


Example QDP_Subset ts[nt];
ts = QDP_create_subset(timeslice, NULL, 0, nt);
where timeslice(x, NULL) returns x[3]

The extra arguments args are passed directly to the function and saved in case the subset function is needed again when doing shifts involving the subset. Therefore the function should not depend on any other global parameters that may change later in the program. It is permissible to call QDP_create_subset with n = 1. In this case the function must return zero if the site is in the subset and nonzero if not. (Note, this is opposite the true, false convention in C).

Destroying subsets

Syntax void QDP_destroy_subset(QDP_subset s[]);


Meaning Destroys all subsets created with s.


Example QDP_destroy_subset(ts);

This procedure frees all memory associated with the subset object s. The QDP_subset * value s should be the object returned by QDP_create_subset. All subsets in the array s are destroyed.

Getting the size of a subset

Syntax int QDP_subset_len(QDP_subset s);


Meaning Returns the number of sites in a subset.