mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-20 23:50:27 +00:00
hyperpoint:: det function is now based on the largest coordinate, making it more precise
This commit is contained in:
parent
7a89ad8b19
commit
42265258f2
@ -936,12 +936,14 @@ EX ld det(const transmatrix& T) {
|
||||
ld det = 1;
|
||||
transmatrix M = T;
|
||||
for(int a=0; a<MDIM; a++) {
|
||||
int max_at = a;
|
||||
for(int b=a; b<MDIM; b++)
|
||||
if(M[b][a]) {
|
||||
if(b != a)
|
||||
for(int c=a; c<MDIM; c++) tie(M[b][c], M[a][c]) = make_pair(-M[a][c], M[b][c]);
|
||||
break;
|
||||
}
|
||||
if(abs(M[b][a]) > abs(M[max_at][a]))
|
||||
max_at = b;
|
||||
|
||||
if(max_at != a)
|
||||
for(int c=a; c<MDIM; c++) tie(M[max_at][c], M[a][c]) = make_pair(-M[a][c], M[max_at][c]);
|
||||
|
||||
if(!M[a][a]) return 0;
|
||||
for(int b=a+1; b<MDIM; b++) {
|
||||
ld co = -M[b][a] / M[a][a];
|
||||
|
Loading…
Reference in New Issue
Block a user