An open source framework for n-dimensional hypercomplex calculations for NMR.
The libhxnd package implements a portable, open-source programming interface
for manipulating a class of hypercomplex numbers found in the field of
Nuclear Magnetic Resonance spectroscopy.
More importantly, libhxnd supports the manipulation of these hypercomplex
numbers inside multidimensional arrays of any size. Using libhxnd grammars,
any NMR dataset of any dimensionality may be represented by the same
data structure (hx_array
).
A few core terms are used when discussing the use of hypercomplex multidimensional arrays in libhxnd, as follows...
The algebraic dimensionality of an array (or scalar) refers to the number of basis phases used to represent the hypercomplex number. For example, a real number is zero-dimensional, because it contains no complex basis phases. A complex number is one-dimensional and contains a single basis phase:
x = a + b u1
On the other hand, a two-dimensional hypercomplex number contains two bases, u1 and u2. A generic two-dimensional hypercomplex number must then be represented by four real coefficients, like so:
x = a + b u1 + c u2 + d u1 u2
A generic three-dimensional hypercomplex number contains three bases, u1, u2 and u3, and will require eight real coefficients:
x = a + b u1 + c u2 + d u1 u2 + e u3 + f u1 u3 + g u2 u3 + h u1 u2 u3
More generally, the number of coefficients required to express a given hypercomplex number in d dimensions is two to the power d.
The topological dimensionality of an array refers to the number of array dimensions, similar to the concept of tensor order. For example, scalars and vectors are one-dimensional, matrices are two-dimensional, rectangular cuboids are three-dimensional, etc. A k-dimensional array will require a set of k indices to identify a unique scalar element.
The topological size of an array refers to the set of sizes of the dimensions of the array. An array with k topological dimensions will have k sizes, one for each dimension, e.g.:
k = 1: (3)
k = 2: (4, 5)
k = 4: (2, 5, 11, 7)
Of course, the size of any dimension may just as easily be one, making that dimension effectively meaningless in the array. For example, an array of size (1,1,2,1,8,1) is effectively the same as an array of size (2,8).
The configuration of an array refers to the combination of the algebraic dimensionality, the topological dimensionality, and the topological size of the array. Only arrays having identical configurations may be added or multiplied element-wise without modification. Arrays having identical lengths (total number of elements) may be reshaped for element-wise arithmetic.
Because the hx_array
data structure natively describes NMR data of any
dimensionality, its use in representing such data files requires relatively
few extra pieces of information. Thus, the datum
structure in libhxnd is
a fairly thin wrapper around the hx_array
structure, holding per-dimension
metadata such as spectral width, offset and carrier.
The inspiration for libhxnd arose from the following publication:
Schuyler A. D., Maciejewski M. W., Stern A. S., Hoch J. C., Formalism for hypercomplex multidimensional NMR employing partial-component subsampling, Journal of Magnetic Resonance, February 2013, 227: 20--24.
The libhxnd project is released under the GNU GPL 2.0.