[Top][All Lists]

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

Re: [Help-gsl] Array sorting queries

From: Will Farr
Subject: Re: [Help-gsl] Array sorting queries
Date: Wed, 22 Oct 2008 09:45:29 -0400


There is a gsl_heapsort function (see section 11.1 of the manual)
which allows the caller to pass an arbitrary comparison function.  If
that doesn't float your boat, you could also just reverse the array
once it's sorted (which you can do in a single pass of interchanges).

Good luck!


On Wed, Oct 22, 2008 at 7:30 AM, Joseph Wakeling
<address@hidden> wrote:
> Hello,
> A few queries about the sorting functions in GSL.
> I have a few different arrays which I need to sort, depending on what
> they are, into either ascending or descending order.
> Later on in the program, I will need to perform index-sorts on the same
> arrays -- again, respectively in either ascending or descending order.
> What bothers me is that I don't see, from the GSL manual, how to do this
> effectively.  Sorting in ascending order is easy -- just use gsl_sort()
> and gsl_sort_index() -- but there's no hint in the manual how to sort
> arrays in _descending_ order.
> I could of course use gsl_sort_largest() over the whole array but that
> means having to assign a separate destination array and seems an
> expensive solution...
> Can anyone suggest a better solution?  (Apologies if I've missed
> something in the manual.)
> Thanks & best wishes,
>    -- Joe
> _______________________________________________
> Help-gsl mailing list
> address@hidden

reply via email to

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