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: Rhys Ulerich
Subject: Re: [Help-gsl] Handling lists, vectors and so on
Date: Fri, 2 Apr 2010 15:22:19 -0600

> 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.

- Rhys

[1] http://www.gnu.org/software/gsl/manual/html_node/Vectors.html
[2] http://www.sgi.com/tech/stl/RandomAccessIterator.html
[3] http://www.cplusplus.com/reference/algorithm/sort/




reply via email to

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