|GNU Scientific Library Reference Manual - Third Edition (v1.12)|
by M. Galassi, J. Davies, J. Theiler, B. Gough, G. Jungman, P. Alken, M. Booth, F. Rossi
Paperback (6"x9"), 592 pages, 60 figures
RRP £24.95 ($39.95)
8.4.1 Matrix allocation
The functions for allocating memory to a matrix follow the style of
free. They also perform their own error
checking. If there is insufficient memory available to allocate a matrix
then the functions call the GSL error handler (with an error number of
GSL_ENOMEM) in addition to returning a null pointer. Thus if you
use the library error handler to abort your program then it isn't
necessary to check every
- Function: gsl_matrix * gsl_matrix_alloc (size_t n1, size_t n2)
- This function creates a matrix of size n1 rows by n2 columns, returning a pointer to a newly initialized matrix struct. A new block is allocated for the elements of the matrix, and stored in the block component of the matrix struct. The block is “owned” by the matrix, and will be deallocated when the matrix is deallocated.
- Function: gsl_matrix * gsl_matrix_calloc (size_t n1, size_t n2)
- This function allocates memory for a matrix of size n1 rows by n2 columns and initializes all the elements of the matrix to zero.
- Function: void gsl_matrix_free (gsl_matrix * m)
- This function frees a previously allocated matrix m. If the
matrix was created using
gsl_matrix_allocthen the block underlying the matrix will also be deallocated. If the matrix has been created from another object then the memory is still owned by that object and will not be deallocated. The matrix m must be a valid matrix object (a null pointer is not allowed).
|ISBN 0954612078||GNU Scientific Library Reference Manual - Third Edition (v1.12)||See the print edition|