Math-GSL

 view release on metacpan or  search on metacpan

lib/Math/GSL/Sort.pm  view on Meta::CPAN

This function indirectly sorts the $n elements of the array $data with stride
$stride into ascending order, outputting the permutation in the foram of an
array. $p must be a prealocated array reference. This should be removed in
further versions. The array $data is not changed.

=item * gsl_sort_smallest($array, $k, $data, $stride, $n)

This function outputs 0 if the operation succeeded, 1 otherwise and then the
$k smallest elements of the array $data, of size $n and stride $stride, in
ascending numerical. The size $k of the subset must be less than or equal to
$n. The data $src is not modified by this operation. $array must be a
prealocated array reference. This should be removed in further versions.

=item * gsl_sort_smallest_index($p, $k, $src, $stride, $n)

This function outputs 0 if the operation succeeded, 1 otherwise and then the
indices of the $k smallest elements of the array $src, of size $n and stride
$stride. The indices are chosen so that the corresponding data is in ascending
numerical order. $k must be less than or equal to $n. The data $src is not
modified by this operation. $p must be a prealocated array reference. This
should be removed in further versions.

=item * gsl_sort_largest($array, $k, $data, $stride, $n)

This function outputs 0 if the operation succeeded, 1 otherwise and then the
$k largest elements of the array $data, of size $n and stride $stride, in
ascending numerical. The size $k of the subset must be less than or equal to
$n. The data $src is not modified by this operation. $array must be a
prealocated array reference. This should be removed in further versions.

=item * gsl_sort_largest_index($p, $k, $src, $stride, $n)

This function outputs 0 if the operation succeeded, 1 otherwise and then the
indices of the $k largest elements of the array $src, of size $n and stride
$stride. The indices are chosen so that the corresponding data is in ascending
numerical order. $k must be less than or equal to $n. The data $src is not
modified by this operation. $p must be a prealocated array reference. This
should be removed in further versions.

=back

 Here is a complete list of all tags for this module :

=over

=item all

=item plain

=item vector

=back

For more informations on the functions, we refer you to the GSL official
documentation: L<http://www.gnu.org/software/gsl/manual/html_node/>

=head1 PERFORMANCE

In the source code of Math::GSL, the file "examples/benchmark/sort" compares
the performance of gsl_sort() to Perl's builtin sort() function. Its first
argument is the number of iterations and the second is the size of the array
of numbers to sort. For example, to see a benchmark of 1000 iterations for
arrays of size 50000 you would type

    ./examples/benchmark/sort 1000 50000

Initial benchmarks indicate just slightly above a 2x performance increase
over sort() for arrays of between 5000 and 50000 elements. This may mostly
be due to the fact that gsl_sort() takes and returns a reference while sort()
takes and returns a plain list.

=head1 AUTHORS

Jonathan "Duke" Leto <jonathan@leto.net> and Thierry Moisan <thierry.moisan@gmail.com>

=head1 COPYRIGHT AND LICENSE

Copyright (C) 2008-2024 Jonathan "Duke" Leto and Thierry Moisan

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.

=cut

1;



( run in 0.886 second using v1.01-cache-2.11-cpan-71847e10f99 )