permutation: in-place inversion

This commit is contained in:
2026-07-31 20:50:36 +02:00
parent 3bfa3007ce
commit e5073a3141
3 changed files with 57 additions and 1 deletions
+12 -1
View File
@@ -4788,7 +4788,7 @@ cout<<tt;
cout <<"Error = "<<(t-tt).norm()<<endl;
}
if(1)
if(0)
{
Tensor<double> tt;
tt.numpy_read(argv[1]);
@@ -4798,4 +4798,15 @@ cout<<"part\n"<<tt.subtensor1(1);
cout<<"part\n"<<tt.subtensor1(2);
}
if(1)
{
int n;
cin >>n;
NRPerm<int> p(n); p.randomize();
NRPerm<int> q=p.inverse();
p.inverseme();
if(p!=q) laerror("inverseme failed");
else cout <<p<<"OK\n";
}
}//main