12 #ifndef QMCPLUSPLUS_DIRAC_MATRIX_H 13 #define QMCPLUSPLUS_DIRAC_MATRIX_H 31 inline int Xgetrf(
int n,
int m,
float* restrict a,
int lda,
int* restrict piv)
38 inline int Xgetrf(
int n,
int m, std::complex<float>* restrict a,
int lda,
int* restrict piv)
45 inline int Xgetrf(
int n,
int m,
double* restrict a,
int lda,
int* restrict piv)
52 inline int Xgetrf(
int n,
int m, std::complex<double>* restrict a,
int lda,
int* restrict piv)
60 inline int Xgetri(
int n,
float* restrict a,
int lda,
int* restrict piv,
float* restrict work,
int& lwork)
68 std::complex<float>* restrict a,
71 std::complex<float>* restrict work,
79 inline int Xgetri(
int n,
double* restrict a,
int lda,
int* restrict piv,
double* restrict work,
int& lwork)
88 std::complex<double>* restrict a,
91 std::complex<double>* restrict work,
99 template<
typename T,
typename T_FP>
100 inline void computeLogDet(
const T* restrict diag,
int n,
const int* restrict pivot, std::complex<T_FP>& logdet)
102 logdet = std::complex<T_FP>();
103 for (
size_t i = 0; i <
n; i++)
104 logdet +=
std::log(std::complex<T_FP>((pivot[i] == i + 1) ? diag[i] : -diag[i]));
110 template<
typename T_FP>
132 std::ostringstream msg;
133 msg <<
"Xgetri failed with error " << status << std::endl;
134 throw std::runtime_error(msg.str());
138 Lwork =
static_cast<int>(lw);
149 template<
typename TREAL>
158 std::ostringstream msg;
159 msg <<
"Xgetrf failed with error " << status << std::endl;
160 throw std::runtime_error(msg.str());
162 for (
int i = 0; i <
n; i++)
168 std::ostringstream msg;
169 msg <<
"Xgetri failed with error " << status << std::endl;
170 throw std::runtime_error(msg.str());
182 template<
typename TMAT,
186 typename = std::enable_if_t<qmc_allocator_traits<ALLOC1>::is_host_accessible>,
187 typename = std::enable_if_t<qmc_allocator_traits<ALLOC2>::is_host_accessible>>
190 std::complex<TREAL>& LogDet)
192 const int n = invMat.
rows();
203 template<
typename TMAT,
207 typename = std::enable_if_t<qmc_allocator_traits<ALLOC1>::is_host_accessible>,
208 typename = std::enable_if_t<qmc_allocator_traits<ALLOC2>::is_host_accessible>>
211 std::complex<TREAL>& LogDet)
213 const int n = invMat.
rows();
223 #endif // QMCPLUSPLUS_DIRAC_MATRIX_H void reset(T_FP *invMat_ptr, const int lda)
reset internal work space
std::vector< T, aligned_allocator< T > > aligned_vector
helper functions for EinsplineSetBuilder
aligned_vector< T_FP > LU_diag
LU diagonal elements.
service class for explicitly managing the threading of BLAS/LAPACK calls from OpenMP parallel region ...
std::enable_if_t<!std::is_same< T_FP, TMAT >::value > invert_transpose(const Matrix< TMAT, ALLOC1 > &amat, Matrix< TMAT, ALLOC2 > &invMat, std::complex< TREAL > &LogDet)
compute the inverse of the transpose of matrix A and its determinant value in log when T_FP and TMAT ...
void cgetri(const int &n, std::complex< float > *a, const int &n0, int const *piv, std::complex< float > *work, const int &, int &st)
void transpose(const T *restrict A, size_t m, size_t lda, TO *restrict B, size_t n, size_t ldb)
transpose of A(m,n) to B(n,m)
void resize(size_type n, size_type m)
Resize the container.
int Xgetrf(int n, int m, float *restrict a, int lda, int *restrict piv)
wrappers around xgetrf lapack routines
int Xgetri(int n, float *restrict a, int lda, int *restrict piv, float *restrict work, int &lwork)
inversion of a float matrix after lu factorization
void sgetri(const int &n, float *a, const int &n0, int const *piv, float *work, const int &, int &st)
helper class to compute matrix inversion and the log value of determinant
void dgetrf(const int &n, const int &m, double *a, const int &n0, int *piv, int &st)
aligned_vector< int > m_pivot
void cgetrf(const int &n, const int &m, std::complex< float > *a, const int &n0, int *piv, int &st)
void computeLogDet(const T *restrict diag, int n, const int *restrict pivot, std::complex< T_FP > &logdet)
void zgetri(const int &n, std::complex< double > *a, const int &n0, int const *piv, std::complex< double > *work, const int &, int &st)
void sgetrf(const int &n, const int &m, float *a, const int &n0, int *piv, int &st)
MakeReturn< UnaryNode< FnLog, typename CreateLeaf< Vector< T1, C1 > >::Leaf_t > >::Expression_t log(const Vector< T1, C1 > &l)
typename RealAlias_impl< T >::value_type RealAlias
If you have a function templated on a value that can be real or complex and you need to get the base ...
aligned_vector< T_FP > m_work
void computeInvertAndLog(T_FP *invMat, const int n, const int lda, std::complex< TREAL > &LogDet)
compute the inverse of invMat (in place) and the log value of determinant
RealAlias< VALUE_FP > Real_FP
SIMD version of functions in algorithm.
std::enable_if_t< std::is_same< T_FP, TMAT >::value > invert_transpose(const Matrix< TMAT, ALLOC1 > &amat, Matrix< TMAT, ALLOC2 > &invMat, std::complex< TREAL > &LogDet)
compute the inverse of the transpose of matrix A and its determinant value in log when T_FP and TMAT ...
int getNextLevelNumThreads()
get the number of threads at the next parallel level
Matrix< T_FP > psiM_fp
scratch space used for mixed precision
void zgetrf(const int &n, const int &m, std::complex< double > *a, const int &n0, int *piv, int &st)
void dgetri(const int &n, double *a, const int &n0, int const *piv, double *work, const int &, int &st)