public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* Adding new Vector/Matrix accessor functions
@ 2008-05-05 20:09 Stuart O Anderson
  2008-05-06 20:25 ` Brian Gough
  0 siblings, 1 reply; 2+ messages in thread
From: Stuart O Anderson @ 2008-05-05 20:09 UTC (permalink / raw)
  To: gsl-discuss

I've run into a situation where it would be very convenient to be able
to get pointers to individual elements of GSL vector and matrices.
Currently I deal with this by using matrix and vector views of normal
C arrays.  However, if there were a pair of functions:
double *gsl_vector_get_ptr( gsl_vector *v, int offset )
double *gsl_matrix_get_ptr( gsl_vector *v, int row, int col )

This would make my code cleaner.  Does giving the user pointers to
single elements of the matrix/vector data break anything?

Stuart

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Adding new Vector/Matrix accessor functions
  2008-05-05 20:09 Adding new Vector/Matrix accessor functions Stuart O Anderson
@ 2008-05-06 20:25 ` Brian Gough
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Gough @ 2008-05-06 20:25 UTC (permalink / raw)
  To: Stuart O Anderson; +Cc: gsl-discuss

At Sat, 3 May 2008 17:57:42 -0400,
Stuart O Anderson wrote:
> I've run into a situation where it would be very convenient to be able
> to get pointers to individual elements of GSL vector and matrices.
> Currently I deal with this by using matrix and vector views of normal
> C arrays.  However, if there were a pair of functions:
> double *gsl_vector_get_ptr( gsl_vector *v, int offset )
> double *gsl_matrix_get_ptr( gsl_vector *v, int row, int col )

Hello, 

I think these already exist -- see the functions gsl_matrix_ptr(m,i,j)
and gsl_vector_ptr(v,i) in the manual.  Manipulating data with the
pointers from these is fine.

-- 
Brian Gough

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-05-06 20:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-05 20:09 Adding new Vector/Matrix accessor functions Stuart O Anderson
2008-05-06 20:25 ` Brian Gough

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).