[Top][All Lists]

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

[Help-gsl] Octave-like indexing with the GSL

From: Jordi Gutierrez Hermoso
Subject: [Help-gsl] Octave-like indexing with the GSL
Date: Sat, 11 Nov 2006 18:01:25 -0500

Hello everyone.

I'm writing some simple C++ wrappers for the GSL for personal use, and
I've already hit a bit of a stump at an early stage. I want to able to
index my wrapper class with Octave-like syntax. E.g. if A is a 4x4
matrix, then A(2,2,4, 2,2,4) (corresponding to Octave syntax A(2:2:4,
2:2:4) ) should give me the elements with indices

    (2,2) (2,4)
    (4,2) (4,4),

as both an rvalue or lvalue depending on context, but I don't
understand how to do this efficiently and cleanly (i.e. "vectorised"
or valarray-like) in GSL with its gsl_matrix structure. I was
expecting to find just such a method as a matrix view with a clever
little hack with the matrix's tda, but I cannot figure out how to do
this. Should I just use a number of for-loops with row or column
views, or use one of the gsl_matrix view functions for arrays, or is
there a more clever intended way of accomplishing this? (Btw, I don't
think I understand either the need for a gsl_matrix_view struct, if
all it holds is a pointer to a gsl_matrix; is this simply to emphasise
syntactically that the view owns the same data as another matrix?)

Thank you. I hope my question is easy to answer and that I posed it clearly. :-)

- Jordi G. H.

reply via email to

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