comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: What is the algorithms of sort function and where function?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: What is the algorithms of sort function and where function? [message #48161] Thu, 30 March 2006 17:14
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
kuyper@wizard.net wrote:
> Daegal wrote:
>> Hi, IDLers~
>>
>> I want to know the algorithm which is used in sort and where.
>> How much fast is that functions comparing with C and Fortran functions
>> if there are similar functions in C and Fortran even if I don't know
>> that language at all.
>
> I can't answer your main question, nor the implied side issue about
> Fortran. However, I can tell you about C. The C standard library does
> contain a sorting function, called qsort(). It's name is derived from
> the QuickSort algorithm. but the standard does not require that it
> actually use that algorithm. QuickSort is not an especially
> sophisticated algorithm, but there are algorithms that are a lot
> slower, and in theory you have no guarantee that qsort() doesn't use
> one of those slower algorithms. In practice, of course, you can
> reasonably expect that it does used the QuickSort algorithm.
>
> I gather that much of IDL's source code is written in C; the SORT
> routine might use qsort().
>

Remember there isn't much "algorithm" to WHERE -- it just finds the
indices of the elements which aren't zero.

SORT uses underlying system sorting routine and can be slightly
different on the various platforms.

-Mike
Re: What is the algorithms of sort function and where function? [message #48187 is a reply to message #48161] Wed, 29 March 2006 07:08 Go to previous message
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
Daegal wrote:
> Hi, IDLers~
>
> I want to know the algorithm which is used in sort and where.
> How much fast is that functions comparing with C and Fortran functions
> if there are similar functions in C and Fortran even if I don't know
> that language at all.

I can't answer your main question, nor the implied side issue about
Fortran. However, I can tell you about C. The C standard library does
contain a sorting function, called qsort(). It's name is derived from
the QuickSort algorithm. but the standard does not require that it
actually use that algorithm. QuickSort is not an especially
sophisticated algorithm, but there are algorithms that are a lot
slower, and in theory you have no guarantee that qsort() doesn't use
one of those slower algorithms. In practice, of course, you can
reasonably expect that it does used the QuickSort algorithm.

I gather that much of IDL's source code is written in C; the SORT
routine might use qsort().
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: CONTOUR & TRIGRID/TRIANGULATE
Next Topic: Optimization help

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 14:56:13 PDT 2025

Total time taken to generate the page: 0.00497 seconds