NAME
Algo - algorithms library
VERSION
Version 0.01
SYNOPSIS
use Algo;
DESCRIPTION
This module provides several math and statistical algorithms implementations in C++ XS for perl.
Functions
kth_order_statistic(compare_sub, array_ref, k)
This function allows to find k-th order statistic for certain array of elements. Note that this function changes input array (like std::nth_element im STL C++) according to the next rule: element at k-th position will become k-th order atatistic. Each element from the left of k will be less then k-th and each from the right will be greater. This algorithm works with linear complexity O(n).
$statistic = kth_order_statistic(\&compare, $array_ref, $k);
For example compare
function could be simple comparison for integers:
sub compare {
$_[0] <=> $_[1]
}
mediana(compare_sub, array_ref)
This function allows to find mediana for certain array of elements. This method is the same as n/2 kth order statistc. Like kth_order_statistic
this functions changes input array according to the same rule.
$mediana = mediana(\&compare, $array_ref);
BUGS
If you find a bug please contact me via email.
AUTHOR
Igor KarbachinskyE <igorkarbachinsky@mail.ru>
LICENSE AND COPYRIGHT
Copyright (c) 2015, Igor Karbachinsky. All rights reserved.