Bio-Metabolic
view release on metacpan or search on metacpan
lib/Bio/Metabolic/MatrixOps.pm view on Meta::CPAN
$inv = $m->invert;
Returns the inverse of $m, undef if $m is not invertible.
=cut
sub PDL::Matrix::invert {
my $matrix = shift->copy;
# print "ref(matrix) is ".ref($matrix)."\n";
# my ($pkg,$file,$line)=caller();
my @dims = $matrix->dims;
if ( $dims[0] != $dims[1] ) {
croak("Inverse for non-square matrix not defined!\n");
return undef;
}
my $n = $dims[0]; # n x n matrix
( run in 0.275 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )