*** empty log message ***

This commit is contained in:
jiri 2005-09-08 10:23:45 +00:00
parent aa4fc240e0
commit 834437d870

9
permutation.h Normal file
View File

@ -0,0 +1,9 @@
template<typename T>
const NRVec<T> inversepermutation(const NRVec<T> &p, const T offset=0)
{
int n=p.size();
NRVec<T> q(n);
if(!offset) for(int i=0; i<n; ++i) q[p[i]]=i;
else for(int i=0; i<n; ++i) q[p[i]-offset]=i+offset;
return q;
}