On 02/08/12 11:01, John Reid wrote:
> Heapsort is brilliant and there is a Fortran code in Numerical Recipes.
Great, thanks for the advice. I dug out that the GNU Scientific Library
uses heapsort, so all I needed was to do:
interface GSLSort ! GNU Scientific Library heapsort
!void gsl_sort (double * data, size_t stride, size_t n)
subroutine gsl_sort(data, stride, size) bind(c)
use iso_c_binding
integer(c_size_t), value :: stride, size
real(c_double), intent(inout) :: data(size)
end subroutine
subroutine gsl_sort_float(data, stride, size) bind(c)
! Uses heapsort
use iso_c_binding
integer(c_size_t), value :: stride, size
real(c_float), intent(inout) :: data(size)
end subroutine
end interface
and then link in the library that is already on my system. Now it is
working with reduced memory usage.
I also found out someone is working on a Fortran interface (FGSL) to
GSL, though for this simple use I did not need the whole library.
Best,
Aleks
--
Aleksandar Donev, Assistant Professor of Mathematics
Courant Institute of Mathematical Sciences
Office: 1016 Warren Weaver Hall, New York University
E-mail: [log in to unmask]
Phone: (212) 992-7315; Fax: (212) 995-4121
Mailing address: 251 Mercer St, New York, NY 10012
Web: http://cims.nyu.edu/~donev
|