mat_utils.hpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /**
  2. * \file mat_utils.hpp
  3. * \author Dhairya Malhotra, dhairya.malhotra@gmail.com
  4. * \date 2-11-2011
  5. * \brief This file contains BLAS and LAPACK wrapper functions.
  6. */
  7. #include <pvfmm_common.hpp>
  8. #ifndef _PVFMM_MAT_UTILS_
  9. #define _PVFMM_MAT_UTILS_
  10. #ifdef __INTEL_OFFLOAD
  11. #pragma offload_attribute(push,target(mic))
  12. #endif
  13. namespace pvfmm{
  14. namespace mat{
  15. template <class T>
  16. void gemm(char TransA, char TransB, int M, int N, int K, T alpha, T *A, int lda, T *B, int ldb, T beta, T *C, int ldc);
  17. template <class T>
  18. void cublasgemm(char TransA, char TransB, int M, int N, int K, T alpha, T *A, int lda, T *B, int ldb, T beta, T *C, int ldc);
  19. template <class T>
  20. void svd(char *JOBU, char *JOBVT, int *M, int *N, T *A, int *LDA,
  21. T *S, T *U, int *LDU, T *VT, int *LDVT, T *WORK, int *LWORK,
  22. int *INFO);
  23. /**
  24. * \brief Computes the pseudo inverse of matrix M(n1xn2) (in row major form)
  25. * and returns the output M_(n2xn1).
  26. */
  27. template <class T>
  28. void pinv(T* M, int n1, int n2, T eps, T* M_);
  29. }//end namespace
  30. }//end namespace
  31. #ifdef __INTEL_OFFLOAD
  32. #pragma offload_attribute(pop)
  33. #endif
  34. #include <mat_utils.txx>
  35. #endif //_PVFMM_MAT_UTILS_