template for general power, power of NRPerm and CyclePerm

This commit is contained in:
2023-08-08 16:39:15 +02:00
parent 757a76844e
commit 12e6af9ca6
12 changed files with 190 additions and 31 deletions

9
smat.h
View File

@@ -93,6 +93,13 @@ public:
//! assign scalar value to diagonal elements
NRSMat & operator=(const T &a);
//! unit matrix for general power
void identity() {*this = (T)1;}
//! inverse matrix
NRSMat inverse();
//! permute matrix elements
const NRSMat permuted(const NRPerm<int> &p, const bool inverse=false) const;
@@ -148,7 +155,7 @@ public:
inline int nrows() const;
inline int ncols() const;
inline size_t size() const;
inline size_t size() const; //NOTE it is the size of data n*(n+1)/2, not nrows
inline bool transp(const int i, const int j) const {return i>j;} //this can be used for compact storage of matrices, which are actually not symmetric, but one triangle of them is redundant
const typename LA_traits<T>::normtype norm(const T scalar = (T)0) const;