Some matrices of order n cannot compute determinants
When I try to use the deterministic method to calculate the determinants of some matrices, perl6 prompts me "attempt to divide by zero when combining Rational to Str",but this matrix does have determinant values. I don't know what happened. It seems like a problem in the implementation process.
Useful information: perl6's version: This is Rakudo Star version 2019.03.1 built on MoarVM version 2019.03 implementing Perl 6.d. Math-Matrix 's version : Math::Matrix:ver<0.3.0>:authgithub:pierre-vigier
can you send me the matrix you tried to compute thanks
like this program:
use Math::Matrix;
my @mat = (
< 1 0 -1 1 0 -1 -1 -1 0 -1 0 1 1 0>,
< 0 1 1 -1 0 1 -1 -1 -1 0 1 0 1 0> ,
<-1 1 0 -1 -1 1 0 -1 0 1 1 0 -1 0>,
<-1 -1 1 0 -1 1 0 1 0 -1 0 -1 0 1>,
<-1 1 0 -1 1 0 -1 0 -1 0 -1 0 1 1>,
<-1 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0>,
< 0 1 0 1 0 -1 1 -1 -1 0 0 2 0 0>,
<-8 -1 0 9 0 -1 0 -4 2 6 0 -4 7 -7>,
< 8 1 0 0 -8 -1 2 0 -5 8 -7 -3 1 6>,
< 0 -9 -2 1 9 -1 0 -6 -3 2 5 0 -5 7>,
< 1 -1 -1 -8 7 -8 8 -5 4 -9 10 -5 -3 8>,
<1 0 0 9 2 -1 -9 5 -7 6 3 -2 -5 0>,
<0 0 9 2 -1 -9 1 -7 6 3 -2 -5 0 5>,
<3 2 3 3 -6 2 -6 11 6 8 0 9 5 2>,
);
my $mat = Math::Matrix.new([@mat]);
say $mat;
say $mat.det;
run it and get result
1 0 -1 1 0 -1 -1 -1 0 -1 0 1 1 0
0 1 1 -1 0 1 -1 -1 -1 0 1 0 1 0
-1 1 0 -1 -1 1 0 -1 0 1 1 0 -1 0
-1 -1 1 0 -1 1 0 1 0 -1 0 -1 0 1
-1 1 0 -1 1 0 -1 0 -1 0 -1 0 1 1
-1 -1 -1 -1 -1 -1 -1 0 0 0 0 0 0 0
0 1 0 1 0 -1 1 -1 -1 0 0 2 0 0
-8 -1 0 9 0 -1 0 -4 2 6 0 -4 7 -7
8 1 0 0 -8 -1 2 0 -5 8 -7 -3 1 6
0 -9 -2 1 9 -1 0 -6 -3 2 5 0 -5 7
1 -1 -1 -8 7 -8 8 -5 4 -9 10 -5 -3 8
1 0 0 9 2 -1 -9 5 -7 6 3 -2 -5 0
0 0 9 2 -1 -9 1 -7 6 3 -2 -5 0 5
3 2 3 3 -6 2 -6 11 6 8 0 9 5 2
Attempt to divide by zero when coercing Rational `to` Str
in block <unit> at first.pl6 line 21
This matrix must have determinant values mathematically, but I got the error.
thank you for examples, as you may see there was reported another bug that bleeds into much more issues but I prioritize these two issues so it will be fixed at least in 0.4.1 (0.4 for the other)
thank you for examples, as you may see there was reported another bug that bleeds into much more issues but I prioritize these two issues so it will be fixed at least in 0.4.1 (0.4 for the other)
Thank you very much.I hope that you can solve this problem smoothly.
I think I have even a bettter solution. I will reimplement the computation of det by algorithm which uses more memory but greatly reduces kombinatory exlosion and i think a fresh rewrite most likely also drops the bug, since its due some interaction I don't quite understand yet.