help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Help with GSL Matrices


From: James Bergstra
Subject: Re: [Help-gsl] Help with GSL Matrices
Date: Fri, 26 May 2006 14:12:58 -0400
User-agent: Mutt/1.4.2.1i

> 1. How can we determine if a gsl matrix is free or not?
Not to confident in being useful... but I'll try.  A gsl_matrix has a data
pointer, a block pointer, and an owner flag.  If the owner flag is 1, then the
block pointer is assumed to be valid, and should be freed (using gsl_block_free)
when the matrix is freed.  gsl_block_free calls free() on *its* data pointer,
not the matrix data pointer, which releases the big block of doubles back to the
OS.  The matrix data pointer should not, in general, be freed.

Of course, if the matrix structure is free itself, then it doesn't make sense to
accesses any of these variables.

> 2. Does gsl_matrix_swap_rows work by copying memory or by some other
> (possibly similar to pointer in spirit) mechanism.
It copies.  The big differences between C matrices and gsl matrices is that the
gsl_matrix assumes that each row is in a certain physical location in memory,
relative to the first row.  This makes many operations fast and easy, but
row-swapping isn't one of them.

-- 
James Bergstra
http://www-etud.iro.umontreal.ca/~bergstrj





reply via email to

[Prev in Thread] Current Thread [Next in Thread]