Table of Contents
GNU Scientific Library (GSL/FGSL)
Documentation and Examples of the GSL
Documentation of the FGSL
Not realy something anywhere.
Sorting
program mysort use fgsl use iso_c_binding implicit none integer(c_size_t) :: i, n idx(20) double precision :: arr(20) ... ! index sort. Original contents undisturbed call fgsl_sort_index(idx, arr, 1_fgsl_size_t, n) idx = idx +1 do i = 1, n ! array will be shown numerical order write (*, fmt = ifmt) sects(idx(i)) enddo
For sorting in place, see links.
Stats
program stats use fgsl implicit none real(fgsl_double) :: data(5) = (/17.2D0, 18.1D0, 16.5D0, 18.3D0, 12.6D0 /) real(fgsl_double) :: mean, variance, largest, smallest mean = fgsl_stats_mean(data, 1_fgsl_size_t, 5_fgsl_size_t) variance = fgsl_stats_variance(data, 1_fgsl_size_t, 5_fgsl_size_t) largest = fgsl_stats_max(data, 1_fgsl_size_t, 5_fgsl_size_t) smallest = fgsl_stats_min(data, 1_fgsl_size_t, 5_fgsl_size_t) end program stats