continuing on permutations - implemented Sn characters

This commit is contained in:
2021-06-04 15:21:35 +02:00
parent 40fe368c31
commit 2a6e79520e
7 changed files with 465 additions and 28 deletions

19
mat.cc
View File

@@ -3133,19 +3133,28 @@ NRMat<T>& NRMat<T>::swap_rows_cols(){
}
//permutation matrix
template<typename T>
void NRMat<T>::axpy(const T alpha, const NRPerm<int> &p, const bool direction)
{
int n=p.size();
for(int i=0; i<n; ++i)
{
if(direction) (*this)(i,p[i+1]-1) +=alpha;
else (*this)(p[i+1]-1,i) += alpha;
}
}
template<typename T>
NRMat<T>::NRMat(const NRPerm<int> &p, const bool direction)
{
int n=p.size();
resize(n,n);
clear();
for(int i=0; i<n; ++i)
{
if(direction) (*this)(i,p[i+1]-1)=1;
else (*this)(p[i+1]-1,i)=1;
}
axpy((T)1,p,direction);
}
//apply permutations
template<typename T>
const NRMat<T> NRMat<T>::permuted_rows(const NRPerm<int> &p, const bool inverse) const