diff options
author | Determinant <[email protected]> | 2015-05-29 23:06:58 +0800 |
---|---|---|
committer | Determinant <[email protected]> | 2015-05-29 23:06:58 +0800 |
commit | 74b9f7cb88cd21cfac3c2e50c8efb802485df0c5 (patch) | |
tree | bd6e583088a086144acc2d8af3eaca59691194ff /tnet_io/KaldiLib/clapack.cc |
init
Diffstat (limited to 'tnet_io/KaldiLib/clapack.cc')
-rw-r--r-- | tnet_io/KaldiLib/clapack.cc | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tnet_io/KaldiLib/clapack.cc b/tnet_io/KaldiLib/clapack.cc new file mode 100644 index 0000000..a486bef --- /dev/null +++ b/tnet_io/KaldiLib/clapack.cc @@ -0,0 +1,61 @@ + +extern "C" { + + /** + * Wrapper to GotoBLAS lapack for STK and TNet (sgetrf sgetri dgetrf dgetri) + */ + typedef float real; + typedef double doublereal; + typedef int integer; + + + /** + * The lapack interface (used in gotoblas) + */ + /* Subroutine */ int sgetrf_(integer *m, integer *n, real *a, integer *lda, + integer *ipiv, integer *info); + /* Subroutine */ int sgetri_(integer *n, real *a, integer *lda, integer *ipiv, + real *work, integer *lwork, integer *info); + /* Subroutine */ int dgetrf_(integer *m, integer *n, doublereal *a, integer * + lda, integer *ipiv, integer *info); + /* Subroutine */ int dgetri_(integer *n, doublereal *a, integer *lda, integer + *ipiv, doublereal *work, integer *lwork, integer *info); + + + + + + /** + * The clapack interface as used by ATLAS (used in STK, + */ + enum CBLAS_ORDER {CblasRowMajor=101, CblasColMajor=102 }; + + int clapack_sgetrf(const enum CBLAS_ORDER Order, const int M, const int N, + float *A, const int lda, int *ipiv) + { + return sgetrf_((int*)&M, (int*)&N, A, (int*)&lda, (int*)ipiv, 0); + } + + + int clapack_sgetri(const enum CBLAS_ORDER Order, const int N, float *A, + const int lda, const int *ipiv) + { + return sgetri_((int*)&N, A, (int*)&lda, (int*)ipiv, 0, 0, 0); + } + + + int clapack_dgetrf(const enum CBLAS_ORDER Order, const int M, const int N, + double *A, const int lda, int *ipiv) + { + return dgetrf_((int*)&M, (int*)&N, A, (int*)&lda, (int*)ipiv, 0); + } + + + int clapack_dgetri(const enum CBLAS_ORDER Order, const int N, double *A, + const int lda, const int *ipiv) + { + return dgetri_((int*)&N, A, (int*)&lda, (int*)ipiv, 0, 0, 0); + } + + +} |