Subject: | [PATCH] determinant() returns NaN for BigInt/BigRat matrices |
Due to a typo in determinant(), overloaded numeric types as matrix components are initially added to undef, which at least in the case of Math::BigXXX is regarded as an error.
The patch below will fix this.
-Martin
Subject: | Math-Matrix-0.8-MHASCH-01.patch |
diff -rup Math-Matrix-0.8.orig/Matrix.pm Math-Matrix-0.8/Matrix.pm
--- Math-Matrix-0.8.orig/Matrix.pm 2013-09-30 09:40:10.000000000 +0200
+++ Math-Matrix-0.8/Matrix.pm 2015-05-10 14:07:56.615626265 +0200
@@ -645,7 +645,7 @@ sub determinant {
foreach my $col (0..$last) {
my $matrix = $self->slice(0..$col-1,$col+1..$last);
$matrix = $class->new(@$matrix[1..$last]);
- my $term += $matrix->determinant();
+ my $term = $matrix->determinant();
$term *= $self->[0][$col];
$term *= $col % 2 ? -1 : 1;
$result += $term;