NRPerm::reverse

This commit is contained in:
Jiri Pittner 2021-11-09 13:19:24 +01:00
parent 6715260da7
commit f5d1a13a18
2 changed files with 13 additions and 0 deletions

View File

@ -79,6 +79,18 @@ for(T i=1; i<=this->size(); ++i) q[(*this)[i]]=i;
return q; return q;
} }
template <typename T>
NRPerm<T> NRPerm<T>::reverse() const
{
#ifdef DEBUG
if(!this->is_valid()) laerror("reverse of invalid permutation");
#endif
NRPerm<T> q(this->size());
for(T i=1; i<=this->size(); ++i) q[i]=(*this)[this->size()-i+1];
return q;
}
template <typename T> template <typename T>
NRPerm<T> NRPerm<T>::operator*(const NRPerm<T> q) const NRPerm<T> NRPerm<T>::operator*(const NRPerm<T> q) const

View File

@ -52,6 +52,7 @@ public:
bool is_valid() const; //is it really a permutation bool is_valid() const; //is it really a permutation
bool is_identity() const; bool is_identity() const;
NRPerm inverse() const; NRPerm inverse() const;
NRPerm reverse() const; //backward order
NRPerm operator*(const NRPerm q) const; //q is rhs and applied first, this applied second NRPerm operator*(const NRPerm q) const; //q is rhs and applied first, this applied second
NRPerm conjugate_by(const NRPerm q) const; //q^-1 p q NRPerm conjugate_by(const NRPerm q) const; //q^-1 p q
int parity() const; int parity() const;