It happens that there's Statistics::LTU. In general, look for the solution that lets Perl interface with other external software.
Inline::Octave may be useful.
Pari (a number theory package) may also be of use.
Omegahat has a bunch of bi-directional interfaces for general programming languages and math software.
Math::MatrixReal can solve linear equations alright. It can't deal with eigensystem in general, only the symmetric case. But it's not hard to implement your own power method to find real (as opposed to complex) eigen values.
use constant eps => 0.00001;
my $m;
sub eigen {
$m = shift; # assume a Math::MatrixReal object
return _eigen(-1e300, $m->column(1)->each(sub{1}));
}
sub _eigen {
my $v = $_[1];
$v = $m*$v;
my $eigen = $v->norm_max();
$v = $v*(1/$eigen);
abs($eigen - $_[0]) > eps ? _eigen($eigen,$v) : return($eigen,$v);
}
__________________
Caveat. Power method may go on forever if no real eigenvalues exist unless you explicitly limit the number of iteration.
|