Next: , Previous: Data types, Up: Vectors and Matrices


8.2 Blocks

For consistency all memory is allocated through a gsl_block structure. The structure contains two components, the size of an area of memory and a pointer to the memory. The gsl_block structure looks like this,

     typedef struct
     {
       size_t size;
       double * data;
     } gsl_block;

Vectors and matrices are made by slicing an underlying block. A slice is a set of elements formed from an initial offset and a combination of indices and step-sizes. In the case of a matrix the step-size for the column index represents the row-length. The step-size for a vector is known as the stride.

The functions for allocating and deallocating blocks are defined in gsl_block.h