mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-12-21 08:00:25 +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;
|
ld det = 1;
|
||||||
transmatrix M = T;
|
transmatrix M = T;
|
||||||
for(int a=0; a<MDIM; a++) {
|
for(int a=0; a<MDIM; a++) {
|
||||||
|
int max_at = a;
|
||||||
for(int b=a; b<MDIM; b++)
|
for(int b=a; b<MDIM; b++)
|
||||||
if(M[b][a]) {
|
if(abs(M[b][a]) > abs(M[max_at][a]))
|
||||||
if(b != a)
|
max_at = b;
|
||||||
for(int c=a; c<MDIM; c++) tie(M[b][c], M[a][c]) = make_pair(-M[a][c], M[b][c]);
|
|
||||||
break;
|
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;
|
if(!M[a][a]) return 0;
|
||||||
for(int b=a+1; b<MDIM; b++) {
|
for(int b=a+1; b<MDIM; b++) {
|
||||||
ld co = -M[b][a] / M[a][a];
|
ld co = -M[b][a] / M[a][a];
|
||||||
|
Loading…
Reference in New Issue
Block a user