permuteme with NRPerm
This commit is contained in:
parent
31c45d44ec
commit
496f004b5b
6
vec.cc
6
vec.cc
@ -841,6 +841,12 @@ else for(int i=1; i<=n; ++i) r[p[i]-1] = v[i-1];
|
|||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
void NRVec<T>::permuteme(const NRPerm<int> &p, bool inverse)
|
||||||
|
{
|
||||||
|
NRVec<T> tmp=permuted(p,inverse);
|
||||||
|
for(int i=0; i<size(); ++i) v[i] = tmp.v[i];
|
||||||
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void NRVec<T>::permuteme(const CyclePerm<int> &p)
|
void NRVec<T>::permuteme(const CyclePerm<int> &p)
|
||||||
|
1
vec.h
1
vec.h
@ -347,6 +347,7 @@ public:
|
|||||||
//! permute vector elements
|
//! permute vector elements
|
||||||
const NRVec permuted(const NRPerm<int> &p, const bool inverse=false) const;
|
const NRVec permuted(const NRPerm<int> &p, const bool inverse=false) const;
|
||||||
void permuteme(const CyclePerm<int> &p); //in place
|
void permuteme(const CyclePerm<int> &p); //in place
|
||||||
|
void permuteme(const NRPerm<int> &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
|
//! compute the sum of the absolute values of the elements of this vector
|
||||||
inline const typename LA_traits<T>::normtype asum() const;
|
inline const typename LA_traits<T>::normtype asum() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user