test of permuted_rows
This commit is contained in:
parent
ee21da1311
commit
c6356c0c76
19
t.cc
19
t.cc
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user