Multidimensional array allocation

Brian Gough
Wed Apr 17 13:05:00 GMT 2002

Eric Brown writes:
 > Dear GSL Users,
 >     I am a new user of GSL and C (from a Fortran background) and simply
 > cannot figure out how to allocate multidimensional arrays within the
 > package. Forexample, the function
 > gsl_matrix * gsl_matrix_alloc (size_t n1, size_t n2)
 > implies that only a 2 x 2 may be allocated straightforwardly. How may this
 > be for, say, a three dimensional array? Indeed, I wish to represent a
 > density along a cubic grid, and then fit the density to a set of gaussian
 > functions that vary in x, y, and z.

GSL only provides support for vectors and 2-dimensional matrices (like

For higher dimensional arrays the choice of how to handle them is up
to the user, since there's no standard (unlike in the 1 and 2d cases).


Brian Gough

More information about the Gsl-discuss mailing list