help-gsl
[Top][All Lists]
Advanced

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

Re: [Help-gsl] Handling lists, vectors and so on


From: Peter Johansson
Subject: Re: [Help-gsl] Handling lists, vectors and so on
Date: Fri, 02 Apr 2010 19:08:49 -0400
User-agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4

Hi Rhys and Vicent,

On 4/2/10 5:22 PM, Rhys Ulerich wrote:
In my C/C++ code I must use a kind of array of elements and I probably
will have to perform the typical operations on them: searching,
reordering, and so on.

My question for the GSL list is a little bit off-topic, because I
would like to know if any of you is familiar with those containers and
if you think it is a good option ...
It should, I think, be possible to use STL algorithms against
gsl_vectors if you are careful.  From the documentation [1], a
gsl_vector has size, stride, and data members.  If you create a
RandomAccessIterator [2] implementation that honors this information
and appropriate first and last iterator instances, you should be able
to use STL algorithms like std::sort [3].  I cannot speak to the
performance, but it should be reasonable.

The first (minor?) hurdle seems to be creating or finding a strided
iterator.  I'd love to hear what you find.


I co-maintain a C++ library called yat that contains a Vector class, which is wrapper arond gsl_vector. The class is very STLish in the sense that it has a class Vector::iterator that can be created with functions 'begin() and end()'. The iterator is implemented as StrideIterator and has the features as described above, so you can either use the StrideIterator directly or use the Vector class. You can find more information on the yat library here http://dev.thep.lu.se/yat/.

Thanks,
Peter




reply via email to

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