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

22
mat.cc
View File

@@ -28,6 +28,7 @@
#include <errno.h>
#include <unistd.h>
#include <math.h>
#include "nonclass.h"
namespace LA {
@@ -3163,12 +3164,13 @@ for(int i=0; i<n; ++i)
}
template<typename T>
NRMat<T>::NRMat(const NRPerm<int> &p, const bool direction)
NRMat<T>::NRMat(const NRPerm<int> &p, const bool direction, const bool parity)
{
int n=p.size();
resize(n,n);
clear();
axpy((T)1,p,direction);
T alpha= parity? p.parity():1;
axpy(alpha,p,direction);
}
@@ -3358,6 +3360,22 @@ copyonwrite();
template<>
NRMat<double> NRMat<double>::inverse()
{
NRMat<double> tmp(*this);
return calcinverse(tmp);
}
template<>
NRMat<std::complex<double> > NRMat<std::complex<double> >::inverse()
{
NRMat<std::complex<double> > tmp(*this);
return calcinverse(tmp);
}