test of permuted_rows

This commit is contained in:
Jiri Pittner 2022-02-03 11:04:55 +01:00
parent ee21da1311
commit c6356c0c76
1 changed files with 18 additions and 1 deletions

19
t.cc
View File

@ -2388,7 +2388,7 @@ cout <<"det error="<<d-dd<<endl;
cout <<"solution error="<<(r-rr).norm()<<endl;
}
if(1)
if(0)
{
//prepare random mat3
int seed;
@ -2413,4 +2413,21 @@ double det = fit.solve();
cout <<"det= "<<det<<" fit "<<fit<<endl;
}
if(1)
{
NRMat<double> m;
cin >>m;
int n=m.nrows();
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);
NRPerm<int> p(n);
p.randomize();
cout <<p;
NRMat<double> mm=m.permuted_rows(p);
cout <<mm;
}
}