Move the inclusion of vector math library header files out of the namespace; clean up old zgemm interface in MatrixOperators and use the template one instead.

git-svn-id: https://subversion.assembla.com/svn/qmcdev/trunk@7362 e5b18d87-469d-4833-9cc0-8cdfa06e9491
This commit is contained in:
Ye Luo 2016-12-19 18:30:47 +00:00
parent 8bba2fe48b
commit 32e3fcaaa7
2 changed files with 13 additions and 46 deletions

View File

@ -43,7 +43,7 @@ namespace MatrixOperators
{
/** static function to perform C=AB for real matrices
*
* Call dgemm
* Call dgemm/zgemm/sgemm/cgemm via BLAS::gemm
*/
template<typename T>
inline void product(const Matrix<T>& A,
@ -51,24 +51,23 @@ namespace MatrixOperators
{
const char transa = 'N';
const char transb = 'N';
const T one=1.0;
const T zero=0.0;
const T one(1.0);
const T zero(0.0);
BLAS::gemm(transa, transb, B.cols(), A.rows(), B.rows(),
one, B.data(), B.cols(), A.data(), A.cols(),
zero, C.data(), C.cols());
}
template<typename T>
inline void product_ABt(const Matrix<T>& A,
const Matrix<T>& B, Matrix<T>& C)
{
const char transa = 't';
const char transb = 'n';
const T zone(1.0);
const T one(1.0);
const T zero(0.0);
BLAS::gemm(transa, transb, B.rows(), A.rows(), B.cols(),
zone, B.data(), B.cols(), A.data(), A.cols(),
one, B.data(), B.cols(), A.data(), A.cols(),
zero, C.data(), C.cols());
}
@ -78,10 +77,10 @@ namespace MatrixOperators
{
const char transa = 'n';
const char transb = 't';
const T zone(1.0);
const T one(1.0);
const T zero(0.0);
BLAS::gemm(transa, transb, B.cols(), A.cols(), B.rows(),
zone, B.data(), B.cols(), A.data(), A.cols(),
one, B.data(), B.cols(), A.data(), A.cols(),
zero, C.data(), C.cols());
}
@ -136,38 +135,6 @@ namespace MatrixOperators
simd::transpose(A.data(),B.data(),A.rows(),A.cols());
}
/** static function to perform C=AB for complex matrices
*
* Call zgemm
*/
inline void product(const Matrix<std::complex<double> >& A,
const Matrix<std::complex<double> >& B,
Matrix<std::complex<double> >& C)
{
const char transa = 'N';
const char transb = 'N';
const std::complex<double> zone(1.0,0.0);
const std::complex<double> zero(0.0,0.0);
zgemm(transa, transb, B.cols(), A.rows(), B.rows(),
zone, B.data(), B.cols(), A.data(), A.cols(),
zero, C.data(), C.cols());
}
inline void product_AtB(const Matrix<std::complex<double> >& A,
const Matrix<std::complex<double> >& B,
Matrix<std::complex<double> >& C)
{
const char transa = 'N';
const char transb = 'T';
const std::complex<double> zone(1.0,0.0);
const std::complex<double> zero(0.0,0.0);
zgemm(transa, transb, C.cols(), C.rows(), A.rows(),
zone, B.data(), B.cols(), A.data(), A.cols(),
zero, C.data(), C.cols());
}
/// C = A*diag(B)
template<typename T1,typename T2,typename T3>
@ -218,8 +185,6 @@ namespace MatrixOperators
}
/** static function to perform C=AB for complex matrices
*
* Call zgemm

View File

@ -23,6 +23,12 @@
#define QMCPLUSPLUS_VECTORIZED_STDMATH_HPP
#include <cmath>
#if defined(HAVE_MKL_VML)
#include <mkl_vml_functions.h>
#elif defined(HAVE_MASSV)
#include <mass.h>
#include <massv.h>
#endif
namespace qmcplusplus {
@ -61,8 +67,6 @@ namespace qmcplusplus {
}
#if defined(HAVE_MKL_VML)
#include <mkl_vml_functions.h>
inline void sqrt(const double* restrict in, double* restrict out, int n)
{
vdSqrt(n,in,out);
@ -94,8 +98,6 @@ namespace qmcplusplus {
}
#elif defined(HAVE_MASSV)
#include <mass.h>
#include <massv.h>
inline void sqrt(double* restrict in, double* restrict out, int n)
{
vsqrt(out,in,&n);