mat_utils.hpp 1.5 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. #ifndef _PVFMM_MAT_UTILS_
  8. #define _PVFMM_MAT_UTILS_
  9. #include <cstdlib>
  10. namespace pvfmm{
  11. namespace mat{
  12. void gemm(char TransA, char TransB, int M, int N, int K, float alpha, float *A, int lda, float *B, int ldb, float beta, float *C, int ldc);
  13. void gemm(char TransA, char TransB, int M, int N, int K, double alpha, double *A, int lda, double *B, int ldb, double beta, double *C, int ldc);
  14. // cublasXgemm wrapper
  15. void cublasXgemm(char TransA, char TransB, int M, int N, int K, float alpha, float *A, int lda, float *B, int ldb, float beta, float *C, int ldc);
  16. void cublasXgemm(char TransA, char TransB, int M, int N, int K, double alpha, double *A, int lda, double *B, int ldb, double beta, double *C, int ldc);
  17. void svd(char *JOBU, char *JOBVT, int *M, int *N, float *A, int *LDA,
  18. float *S, float *U, int *LDU, float *VT, int *LDVT, float *WORK, int *LWORK,
  19. int *INFO);
  20. void svd(char *JOBU, char *JOBVT, int *M, int *N, double *A, int *LDA,
  21. double *S, double *U, int *LDU, double *VT, int *LDVT, double *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. #include <mat_utils.txx>
  32. #endif //_PVFMM_MAT_UTILS_