vecmat3 added explicit linear solver

This commit is contained in:
2023-12-20 18:00:15 +01:00
parent 731b2a128d
commit eafcfbdd00
3 changed files with 43 additions and 3 deletions

19
t.cc
View File

@@ -2792,6 +2792,25 @@ if(sizeof(int)!=read(f,&seed,sizeof(int))) laerror("cannot read /dev/random");
close(f);
srand(seed);
Mat3<double> a;
a.randomize(10.);
cout<<a<<endl;
Vec3<double> b;
b.randomize(10.);
cout <<b<<endl;
Vec3<double> x = a.linear_solve(b);
cout <<x<<endl;
cout <<"linear solve error = "<<(b-a*x).norm()<<endl;
}
if(0)
{
int seed;
int f=open("/dev/random",O_RDONLY);
if(sizeof(int)!=read(f,&seed,sizeof(int))) laerror("cannot read /dev/random");
close(f);
srand(seed);
Mat3<double> a;
a.randomize(10.);
cout<<a<<endl;