diff --git a/vec.cc b/vec.cc index ff5b5aa..01d524e 100644 --- a/vec.cc +++ b/vec.cc @@ -841,6 +841,12 @@ else for(int i=1; i<=n; ++i) r[p[i]-1] = v[i-1]; return r; } +template +void NRVec::permuteme(const NRPerm &p, bool inverse) +{ +NRVec tmp=permuted(p,inverse); +for(int i=0; i void NRVec::permuteme(const CyclePerm &p) diff --git a/vec.h b/vec.h index c71a0c3..80065c6 100644 --- a/vec.h +++ b/vec.h @@ -347,6 +347,7 @@ public: //! permute vector elements const NRVec permuted(const NRPerm &p, const bool inverse=false) const; void permuteme(const CyclePerm &p); //in place + void permuteme(const NRPerm &p, const bool inverse=false); //formally in place, but allocates a copy //! compute the sum of the absolute values of the elements of this vector inline const typename LA_traits::normtype asum() const;