vecmat3: diagonalization replaced by Jacobi to avoid numerical errors when already close to diagonal

This commit is contained in:
2024-01-26 23:03:04 +01:00
parent 1ee984eda2
commit c77c112dbf
3 changed files with 152 additions and 23 deletions

10
t.cc
View File

@@ -2461,7 +2461,7 @@ Polynomial<double> pp({1,2,3,4,5});
cout<<pp;
}
if(0)
if(1)
{
//prepare random symmetric mat3
int seed;
@@ -2470,10 +2470,14 @@ if(sizeof(int)!=read(f,&seed,sizeof(int))) laerror("cannot read /dev/random");
close(f);
srand(seed);
double scale;
cin >> scale;
NRMat<double> tmp(3,3);
tmp.randomize(2.);
tmp.randomize(scale);
Mat3<double> mm(tmp);
mm.symmetrize();
mm+= 1.;
NRMat<double> m(&mm[0][0],3,3);
cout <<m<<"3 3\n"<<mm<<endl;
@@ -3149,7 +3153,7 @@ for(int i=0; i<a.size(); ++i)
}
}
if(1)
if(0)
{
}