continuing on permutations - implemented Sn characters
This commit is contained in:
19
mat.cc
19
mat.cc
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user