| atlas_bones.hpp | | atlas_bones.hpp | |
|
| // Copyright (C) 2008-2010 NICTA (www.nicta.com.au) | | // Copyright (C) 2008-2011 NICTA (www.nicta.com.au) | |
| // Copyright (C) 2008-2010 Conrad Sanderson | | // Copyright (C) 2008-2011 Conrad Sanderson | |
| // | | // | |
| // This file is part of the Armadillo C++ library. | | // This file is part of the Armadillo C++ library. | |
| // It is provided without any warranty of fitness | | // It is provided without any warranty of fitness | |
| // for any purpose. You can redistribute this file | | // for any purpose. You can redistribute this file | |
| // and/or modify it under the terms of the GNU | | // and/or modify it under the terms of the GNU | |
| // Lesser General Public License (LGPL) as published | | // Lesser General Public License (LGPL) as published | |
| // by the Free Software Foundation, either version 3 | | // by the Free Software Foundation, either version 3 | |
| // of the License or (at your option) any later version. | | // of the License or (at your option) any later version. | |
| // (see http://www.opensource.org/licenses for more info) | | // (see http://www.opensource.org/licenses for more info) | |
| | | | |
| #ifdef ARMA_USE_ATLAS | | #ifdef ARMA_USE_ATLAS | |
| | | | |
| //! \namespace atlas namespace for ATLAS functions (imported from the globa
l namespace) | | //! \namespace atlas namespace for ATLAS functions (imported from the globa
l namespace) | |
| namespace atlas | | namespace atlas | |
| { | | { | |
| | | | |
| using ::CblasColMajor; | | using ::CblasColMajor; | |
| using ::CblasNoTrans; | | using ::CblasNoTrans; | |
| using ::CblasTrans; | | using ::CblasTrans; | |
|
| | | using ::CblasConjTrans; | |
| | | | |
|
| using ::cblas_sdot; | | #if defined(ARMA_USE_WRAPPER) | |
| using ::cblas_ddot; | | extern "C" | |
| using ::cblas_cdotu_sub; | | | |
| using ::cblas_zdotu_sub; | | | |
| | | | |
| using ::cblas_sgemv; | | | |
| using ::cblas_dgemv; | | | |
| using ::cblas_cgemv; | | | |
| using ::cblas_zgemv; | | | |
| | | | |
| using ::cblas_sgemm; | | | |
| using ::cblas_dgemm; | | | |
| using ::cblas_cgemm; | | | |
| using ::cblas_zgemm; | | | |
| | | | |
| using ::clapack_sgetrf; | | | |
| using ::clapack_dgetrf; | | | |
| using ::clapack_cgetrf; | | | |
| using ::clapack_zgetrf; | | | |
| | | | |
| using ::clapack_sgetri; | | | |
| using ::clapack_dgetri; | | | |
| using ::clapack_cgetri; | | | |
| using ::clapack_zgetri; | | | |
| | | | |
| template<typename eT> | | | |
| inline static const eT& tmp_real(const eT& X) { return X; } | | | |
| | | | |
| template<typename T> | | | |
| inline static const T& tmp_real(const std::complex<T>& X) { return X.rea | | | |
| l(); } | | | |
| | | | |
| template<typename eT> | | | |
| arma_inline | | | |
| eT | | | |
| cblas_dot(const int N, const eT* X, const eT* Y) | | | |
| { | | { | |
|
| arma_type_check((is_supported_blas_type<eT>::value == false)); | | | |
| | | | |
|
| if(is_float<eT>::value == true) | | float wrapper_cblas_sdot(const int N, const float *X, const int incX, | |
| { | | const float *Y, const int incY); | |
| typedef float T; | | double wrapper_cblas_ddot(const int N, const double *X, const int incX, | |
| return eT( cblas_sdot(N, (const T*)X, 1, (const T*)Y, 1) ); | | const double *Y, const int incY); | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| return eT( cblas_ddot(N, (const T*)X, 1, (const T*)Y, 1) ); | | | |
| } | | | |
| else | | | |
| { | | | |
| return eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
|
| template<typename eT> | | void wrapper_cblas_cdotu_sub(const int N, const void *X, const int incX | |
| arma_inline | | , const void *Y, const int incY, void *dotu); | |
| eT | | void wrapper_cblas_zdotu_sub(const int N, const void *X, const int incX | |
| cx_cblas_dot(const int N, const eT* X, const eT* Y) | | , const void *Y, const int incY, void *dotu); | |
| { | | | |
| arma_type_check((is_supported_blas_type<eT>::value == false)); | | | |
| | | | |
|
| if(is_supported_complex_float<eT>::value == true) | | void wrapper_cblas_sgemv(const enum CBLAS_ORDER Order, const enum CBLAS | |
| { | | _TRANSPOSE TransA, const int M, const int N, const float alpha, | |
| typedef typename std::complex<float> T; | | const float *A, const int lda, const float *X, | |
| | | const int incX, const float beta, float *Y, const int incY); | |
| T out; | | | |
| cblas_cdotu_sub(N, (const T*)X, 1, (const T*)Y, 1, &out); | | | |
| | | | |
| return eT(out); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef typename std::complex<double> T; | | | |
| | | | |
| T out; | | | |
| cblas_zdotu_sub(N, (const T*)X, 1, (const T*)Y, 1, &out); | | | |
| | | | |
| return eT(out); | | | |
| } | | | |
| else | | | |
| { | | | |
| return eT(0); | | | |
| } | | | |
| } | | | |
| | | | |
|
| template<typename eT> | | void wrapper_cblas_dgemv(const enum CBLAS_ORDER Order, const enum CBLAS | |
| inline | | _TRANSPOSE TransA, const int M, const int N, const double alpha, | |
| void | | const double *A, const int lda, const double * | |
| cblas_gemv | | X, const int incX, const double beta, double *Y, const int incY); | |
| ( | | | |
| const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, | | | |
| const int M, const int N, | | | |
| const eT alpha, | | | |
| const eT *A, const int lda, | | | |
| const eT *X, const int incX, | | | |
| const eT beta, | | | |
| eT *Y, const int incY | | | |
| ) | | | |
| { | | | |
| arma_type_check((is_supported_blas_type<eT>::value == false)); | | | |
| | | | |
|
| if(is_float<eT>::value == true) | | void wrapper_cblas_cgemv(const enum CBLAS_ORDER Order, const enum CBLAS | |
| { | | _TRANSPOSE TransA, const int M, const int N, const void *alpha, | |
| typedef float T; | | const void *A, const int lda, const void *X, c | |
| cblas_sgemv(Order, TransA, M, N, (const T)tmp_real(alpha), (const T*) | | onst int incX, const void *beta, void *Y, const int incY); | |
| A, lda, (const T*)X, incX, (const T)tmp_real(beta), (T*)Y, incY); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| cblas_dgemv(Order, TransA, M, N, (const T)tmp_real(alpha), (const T*) | | | |
| A, lda, (const T*)X, incX, (const T)tmp_real(beta), (T*)Y, incY); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| cblas_cgemv(Order, TransA, M, N, (const T*)&alpha, (const T*)A, lda, | | | |
| (const T*)X, incX, (const T*)&beta, (T*)Y, incY); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| cblas_zgemv(Order, TransA, M, N, (const T*)&alpha, (const T*)A, lda, | | | |
| (const T*)X, incX, (const T*)&beta, (T*)Y, incY); | | | |
| } | | | |
| } | | | |
| | | | |
|
| template<typename eT> | | void wrapper_cblas_zgemv(const enum CBLAS_ORDER Order, const enum CBLAS | |
| inline | | _TRANSPOSE TransA, const int M, const int N, const void *alpha, | |
| void | | const void *A, const int lda, const void *X, c | |
| cblas_gemm | | onst int incX, const void *beta, void *Y, const int incY); | |
| ( | | | |
| const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, | | | |
| const enum CBLAS_TRANSPOSE TransB, const int M, const int N, | | | |
| const int K, const eT alpha, const eT *A, | | | |
| const int lda, const eT *B, const int ldb, | | | |
| const eT beta, eT *C, const int ldc | | | |
| ) | | | |
| { | | | |
| arma_type_check((is_supported_blas_type<eT>::value == false)); | | | |
| | | | |
|
| if(is_float<eT>::value == true) | | void wrapper_cblas_sgemm(const enum CBLAS_ORDER Order, const enum CBLAS | |
| { | | _TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, | |
| typedef float T; | | const int M, const int N, const int K, const f | |
| cblas_sgemm(Order, TransA, TransB, M, N, K, (const T)tmp_real(alpha), | | loat alpha, | |
| (const T*)A, lda, (const T*)B, ldb, (const T)tmp_real(beta), (T*)C, ldc); | | const float *A, const int lda, const float *B, | |
| } | | const int ldb, const float beta, float *C, const int ldc); | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| cblas_dgemm(Order, TransA, TransB, M, N, K, (const T)tmp_real(alpha), | | | |
| (const T*)A, lda, (const T*)B, ldb, (const T)tmp_real(beta), (T*)C, ldc); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| cblas_cgemm(Order, TransA, TransB, M, N, K, (const T*)&alpha, (const | | | |
| T*)A, lda, (const T*)B, ldb, (const T*)&beta, (T*)C, ldc); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| cblas_zgemm(Order, TransA, TransB, M, N, K, (const T*)&alpha, (const | | | |
| T*)A, lda, (const T*)B, ldb, (const T*)&beta, (T*)C, ldc); | | | |
| } | | | |
| } | | | |
| | | | |
|
| template<typename eT> | | void wrapper_cblas_dgemm(const enum CBLAS_ORDER Order, const enum CBLAS | |
| inline | | _TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, | |
| int | | const int M, const int N, const int K, const d | |
| clapack_getrf | | ouble alpha, | |
| ( | | const double *A, const int lda, const double * | |
| const enum CBLAS_ORDER Order, const int M, const int N, | | B, const int ldb, const double beta, double *C, const int ldc); | |
| eT *A, const int lda, int *ipiv | | | |
| ) | | | |
| { | | | |
| arma_type_check((is_supported_blas_type<eT>::value == false)); | | | |
| | | | |
|
| if(is_float<eT>::value == true) | | void wrapper_cblas_cgemm(const enum CBLAS_ORDER Order, const enum CBLAS | |
| { | | _TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, | |
| typedef float T; | | const int M, const int N, const int K, const v | |
| return clapack_sgetrf(Order, M, N, (T*)A, lda, ipiv); | | oid *alpha, | |
| } | | const void *A, const int lda, const void *B, c | |
| else | | onst int ldb, const void *beta, void *C, const int ldc); | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| return clapack_dgetrf(Order, M, N, (T*)A, lda, ipiv); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| return clapack_cgetrf(Order, M, N, (T*)A, lda, ipiv); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| return clapack_zgetrf(Order, M, N, (T*)A, lda, ipiv); | | | |
| } | | | |
| else | | | |
| { | | | |
| return -1; | | | |
| } | | | |
| } | | | |
| | | | |
|
| template<typename eT> | | void wrapper_cblas_zgemm(const enum CBLAS_ORDER Order, const enum CBLAS | |
| inline | | _TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, | |
| int | | const int M, const int N, const int K, const v | |
| clapack_getri | | oid *alpha, | |
| ( | | const void *A, const int lda, const void *B, c | |
| const enum CBLAS_ORDER Order, const int N, eT *A, | | onst int ldb, const void *beta, void *C, const int ldc); | |
| const int lda, const int *ipiv | | | |
| ) | | int wrapper_clapack_sgetrf(const enum CBLAS_ORDER Order, const int M, c | |
| { | | onst int N, float *A, const int lda, int *ipiv); | |
| arma_type_check((is_supported_blas_type<eT>::value == false)); | | int wrapper_clapack_dgetrf(const enum CBLAS_ORDER Order, const int M, c | |
| | | onst int N, double *A, const int lda, int *ipiv); | |
| | | int wrapper_clapack_cgetrf(const enum CBLAS_ORDER Order, const int M, c | |
| | | onst int N, void *A, const int lda, int *ipiv); | |
| | | int wrapper_clapack_zgetrf(const enum CBLAS_ORDER Order, const int M, c | |
| | | onst int N, void *A, const int lda, int *ipiv); | |
| | | | |
| | | int wrapper_clapack_sgetri(const enum CBLAS_ORDER Order, const int N, f | |
| | | loat *A, const int lda, const int *ipiv); | |
| | | int wrapper_clapack_dgetri(const enum CBLAS_ORDER Order, const int N, d | |
| | | ouble *A, const int lda, const int *ipiv); | |
| | | int wrapper_clapack_cgetri(const enum CBLAS_ORDER Order, const int N, v | |
| | | oid *A, const int lda, const int *ipiv); | |
| | | int wrapper_clapack_zgetri(const enum CBLAS_ORDER Order, const int N, v | |
| | | oid *A, const int lda, const int *ipiv); | |
| | | | |
| | | int wrapper_clapack_sgesv(const enum CBLAS_ORDER Order, const int N, co | |
| | | nst int NRHS, float *A, const int lda, int *ipiv, float *B, const int ldb | |
| | | ); | |
| | | int wrapper_clapack_dgesv(const enum CBLAS_ORDER Order, const int N, co | |
| | | nst int NRHS, double *A, const int lda, int *ipiv, double *B, const int ldb | |
| | | ); | |
| | | int wrapper_clapack_cgesv(const enum CBLAS_ORDER Order, const int N, co | |
| | | nst int NRHS, void *A, const int lda, int *ipiv, void *B, const int ldb | |
| | | ); | |
| | | int wrapper_clapack_zgesv(const enum CBLAS_ORDER Order, const int N, co | |
| | | nst int NRHS, void *A, const int lda, int *ipiv, void *B, const int ldb | |
| | | ); | |
| | | | |
|
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| return clapack_sgetri(Order, N, (T*)A, lda, ipiv); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| return clapack_dgetri(Order, N, (T*)A, lda, ipiv); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| return clapack_cgetri(Order, N, (T*)A, lda, ipiv); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| return clapack_zgetri(Order, N, (T*)A, lda, ipiv); | | | |
| } | | | |
| else | | | |
| { | | | |
| return -1; | | | |
| } | | | |
| } | | } | |
|
| | | #endif | |
| | | | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 16 change blocks. |
| 244 lines changed or deleted | | 85 lines changed or added | |
|
| blas_bones.hpp | | blas_bones.hpp | |
| | | | |
| skipping to change at line 47 | | skipping to change at line 47 | |
| #define arma_cgemv CGEMV | | #define arma_cgemv CGEMV | |
| #define arma_zgemv ZGEMV | | #define arma_zgemv ZGEMV | |
| | | | |
| #define arma_sgemm SGEMM | | #define arma_sgemm SGEMM | |
| #define arma_dgemm DGEMM | | #define arma_dgemm DGEMM | |
| #define arma_cgemm CGEMM | | #define arma_cgemm CGEMM | |
| #define arma_zgemm ZGEMM | | #define arma_zgemm ZGEMM | |
| | | | |
| #endif | | #endif | |
| | | | |
|
| //! \namespace blas namespace for BLAS functions | | extern "C" | |
| namespace blas | | | |
| { | | { | |
|
| extern "C" | | float arma_fortran(arma_sdot)(blas_int* n, const float* x, blas_int* in | |
| { | | cx, const float* y, blas_int* incy); | |
| float arma_fortran(arma_sdot)(blas_int* n, const float* x, blas_int* | | double arma_fortran(arma_ddot)(blas_int* n, const double* x, blas_int* in | |
| incx, const float* y, blas_int* incy); | | cx, const double* y, blas_int* incy); | |
| double arma_fortran(arma_ddot)(blas_int* n, const double* x, blas_int* | | | |
| incx, const double* y, blas_int* incy); | | | |
| | | | |
| void arma_fortran(arma_sgemv)(const char* transA, const blas_int* m, co | | | |
| nst blas_int* n, const float* alpha, const float* A, const blas_int* ldA, | | | |
| const float* x, const blas_int* incx, const float* beta, float* y, cons | | | |
| t blas_int* incy); | | | |
| void arma_fortran(arma_dgemv)(const char* transA, const blas_int* m, co | | | |
| nst blas_int* n, const double* alpha, const double* A, const blas_int* ldA, | | | |
| const double* x, const blas_int* incx, const double* beta, double* y, cons | | | |
| t blas_int* incy); | | | |
| void arma_fortran(arma_cgemv)(const char* transA, const blas_int* m, co | | | |
| nst blas_int* n, const void* alpha, const void* A, const blas_int* ldA, | | | |
| const void* x, const blas_int* incx, const void* beta, void* y, cons | | | |
| t blas_int* incy); | | | |
| void arma_fortran(arma_zgemv)(const char* transA, const blas_int* m, co | | | |
| nst blas_int* n, const void* alpha, const void* A, const blas_int* ldA, | | | |
| const void* x, const blas_int* incx, const void* beta, void* y, cons | | | |
| t blas_int* incy); | | | |
| | | | |
| void arma_fortran(arma_sgemm)(const char* transA, const char* transB, c | | | |
| onst blas_int* m, const blas_int* n, const blas_int* k, const float* alpha | | | |
| , const float* A, const blas_int* ldA, const float* B, const blas_int* ld | | | |
| B, const float* beta, float* C, const blas_int* ldC); | | | |
| void arma_fortran(arma_dgemm)(const char* transA, const char* transB, c | | | |
| onst blas_int* m, const blas_int* n, const blas_int* k, const double* alpha | | | |
| , const double* A, const blas_int* ldA, const double* B, const blas_int* ld | | | |
| B, const double* beta, double* C, const blas_int* ldC); | | | |
| void arma_fortran(arma_cgemm)(const char* transA, const char* transB, c | | | |
| onst blas_int* m, const blas_int* n, const blas_int* k, const void* alpha | | | |
| , const void* A, const blas_int* ldA, const void* B, const blas_int* ld | | | |
| B, const void* beta, void* C, const blas_int* ldC); | | | |
| void arma_fortran(arma_zgemm)(const char* transA, const char* transB, c | | | |
| onst blas_int* m, const blas_int* n, const blas_int* k, const void* alpha | | | |
| , const void* A, const blas_int* ldA, const void* B, const blas_int* ld | | | |
| B, const void* beta, void* C, const blas_int* ldC); | | | |
| | | | |
| // void arma_fortran(arma_dswap)(const blas_int* n, double* x, const | | | |
| blas_int* incx, double* y, const blas_int* incy); | | | |
| // void arma_fortran(arma_dscal)(const blas_int* n, const double* alp | | | |
| ha, double* x, const blas_int* incx); | | | |
| // void arma_fortran(arma_dcopy)(const blas_int* n, const double* x, | | | |
| const blas_int* incx, double* y, const blas_int* incy); | | | |
| // void arma_fortran(arma_daxpy)(const blas_int* n, const double* alp | | | |
| ha, const double* x, const blas_int* incx, double* y, const blas_int* incy) | | | |
| ; | | | |
| // void arma_fortran(arma_dger )(const blas_int* m, const blas_int* n | | | |
| , const double* alpha, const double* x, const blas_int* incx, const double* | | | |
| y, const blas_int* incy, double* A, const blas_int* ldA); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| eT | | | |
| dot(const uword n_elem, const eT* x, const eT* y) | | | |
| { | | | |
| arma_ignore(n_elem); | | | |
| arma_ignore(x); | | | |
| arma_ignore(y); | | | |
| | | | |
| return eT(0); | | | |
| } | | | |
| | | | |
| template<> | | | |
| inline | | | |
| float | | | |
| dot(const uword n_elem, const float* x, const float* y) | | | |
| { | | | |
| blas_int n = blas_int(n_elem); | | | |
| blas_int inc = blas_int(1); | | | |
| | | | |
| return arma_fortran(arma_sdot)(&n, x, &inc, y, &inc); | | | |
| } | | | |
| | | | |
| template<> | | | |
| inline | | | |
| double | | | |
| dot(const uword n_elem, const double* x, const double* y) | | | |
| { | | | |
| blas_int n = blas_int(n_elem); | | | |
| blas_int inc = blas_int(1); | | | |
| | | | |
| return arma_fortran(arma_ddot)(&n, x, &inc, y, &inc); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| gemv(const char* transA, const blas_int* m, const blas_int* n, const eT* | | | |
| alpha, const eT* A, const blas_int* ldA, const eT* x, const blas_int* incx, | | | |
| const eT* beta, eT* y, const blas_int* incy) | | | |
| { | | | |
| arma_type_check((is_supported_blas_type<eT>::value == false)); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_sgemv)(transA, m, n, (const T*)alpha, (const T*)A, | | | |
| ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_dgemv)(transA, m, n, (const T*)alpha, (const T*)A, | | | |
| ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| arma_fortran(arma_cgemv)(transA, m, n, (const T*)alpha, (const T*)A, | | | |
| ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| arma_fortran(arma_zgemv)(transA, m, n, (const T*)alpha, (const T*)A, | | | |
| ldA, (const T*)x, incx, (const T*)beta, (T*)y, incy); | | | |
| } | | | |
| | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| gemm(const char* transA, const char* transB, const blas_int* m, const bla | | | |
| s_int* n, const blas_int* k, const eT* alpha, const eT* A, const blas_int* | | | |
| ldA, const eT* B, const blas_int* ldB, const eT* beta, eT* C, const blas_in | | | |
| t* ldC) | | | |
| { | | | |
| arma_type_check((is_supported_blas_type<eT>::value == false)); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_sgemm)(transA, transB, m, n, k, (const T*)alpha, (c | | | |
| onst T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_dgemm)(transA, transB, m, n, k, (const T*)alpha, (c | | | |
| onst T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| arma_fortran(arma_cgemm)(transA, transB, m, n, k, (const T*)alpha, (c | | | |
| onst T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| arma_fortran(arma_zgemm)(transA, transB, m, n, k, (const T*)alpha, (c | | | |
| onst T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC); | | | |
| } | | | |
| | | | |
| } | | | |
| | | | |
|
| | | void arma_fortran(arma_sgemv)(const char* transA, const blas_int* m, cons | |
| | | t blas_int* n, const float* alpha, const float* A, const blas_int* ldA, c | |
| | | onst float* x, const blas_int* incx, const float* beta, float* y, const | |
| | | blas_int* incy); | |
| | | void arma_fortran(arma_dgemv)(const char* transA, const blas_int* m, cons | |
| | | t blas_int* n, const double* alpha, const double* A, const blas_int* ldA, c | |
| | | onst double* x, const blas_int* incx, const double* beta, double* y, const | |
| | | blas_int* incy); | |
| | | void arma_fortran(arma_cgemv)(const char* transA, const blas_int* m, cons | |
| | | t blas_int* n, const void* alpha, const void* A, const blas_int* ldA, c | |
| | | onst void* x, const blas_int* incx, const void* beta, void* y, const | |
| | | blas_int* incy); | |
| | | void arma_fortran(arma_zgemv)(const char* transA, const blas_int* m, cons | |
| | | t blas_int* n, const void* alpha, const void* A, const blas_int* ldA, c | |
| | | onst void* x, const blas_int* incx, const void* beta, void* y, const | |
| | | blas_int* incy); | |
| | | | |
| | | void arma_fortran(arma_sgemm)(const char* transA, const char* transB, con | |
| | | st blas_int* m, const blas_int* n, const blas_int* k, const float* alpha, | |
| | | const float* A, const blas_int* ldA, const float* B, const blas_int* ldB, | |
| | | const float* beta, float* C, const blas_int* ldC); | |
| | | void arma_fortran(arma_dgemm)(const char* transA, const char* transB, con | |
| | | st blas_int* m, const blas_int* n, const blas_int* k, const double* alpha, | |
| | | const double* A, const blas_int* ldA, const double* B, const blas_int* ldB, | |
| | | const double* beta, double* C, const blas_int* ldC); | |
| | | void arma_fortran(arma_cgemm)(const char* transA, const char* transB, con | |
| | | st blas_int* m, const blas_int* n, const blas_int* k, const void* alpha, | |
| | | const void* A, const blas_int* ldA, const void* B, const blas_int* ldB, | |
| | | const void* beta, void* C, const blas_int* ldC); | |
| | | void arma_fortran(arma_zgemm)(const char* transA, const char* transB, con | |
| | | st blas_int* m, const blas_int* n, const blas_int* k, const void* alpha, | |
| | | const void* A, const blas_int* ldA, const void* B, const blas_int* ldB, | |
| | | const void* beta, void* C, const blas_int* ldC); | |
| | | | |
| | | // void arma_fortran(arma_dswap)(const blas_int* n, double* x, const bl | |
| | | as_int* incx, double* y, const blas_int* incy); | |
| | | // void arma_fortran(arma_dscal)(const blas_int* n, const double* alpha | |
| | | , double* x, const blas_int* incx); | |
| | | // void arma_fortran(arma_dcopy)(const blas_int* n, const double* x, co | |
| | | nst blas_int* incx, double* y, const blas_int* incy); | |
| | | // void arma_fortran(arma_daxpy)(const blas_int* n, const double* alpha | |
| | | , const double* x, const blas_int* incx, double* y, const blas_int* incy); | |
| | | // void arma_fortran(arma_dger )(const blas_int* m, const blas_int* n, | |
| | | const double* alpha, const double* x, const blas_int* incx, const double* y | |
| | | , const blas_int* incy, double* A, const blas_int* ldA); | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 3 change blocks. |
| 169 lines changed or deleted | | 50 lines changed or added | |
|
| lapack_bones.hpp | | lapack_bones.hpp | |
| | | | |
| skipping to change at line 201 | | skipping to change at line 201 | |
| #define arma_csytrf CSYTRF | | #define arma_csytrf CSYTRF | |
| #define arma_zsytrf ZSYTRF | | #define arma_zsytrf ZSYTRF | |
| | | | |
| #define arma_ssytri SSYTRI | | #define arma_ssytri SSYTRI | |
| #define arma_dsytri DSYTRI | | #define arma_dsytri DSYTRI | |
| #define arma_csytri CSYTRI | | #define arma_csytri CSYTRI | |
| #define arma_zsytri ZSYTRI | | #define arma_zsytri ZSYTRI | |
| | | | |
| #endif | | #endif | |
| | | | |
|
| //! \namespace lapack namespace for LAPACK functions | | extern "C" | |
| namespace lapack | | | |
| { | | { | |
|
| //! \addtogroup LAPACK | | // LU factorisation | |
| //! @{ | | void arma_fortran(arma_sgetrf)(blas_int* m, blas_int* n, float* a, blas_ | |
| | | int* lda, blas_int* ipiv, blas_int* info); | |
| extern "C" | | void arma_fortran(arma_dgetrf)(blas_int* m, blas_int* n, double* a, blas_ | |
| { | | int* lda, blas_int* ipiv, blas_int* info); | |
| // LU factorisation | | void arma_fortran(arma_cgetrf)(blas_int* m, blas_int* n, void* a, blas_ | |
| void arma_fortran(arma_sgetrf)(blas_int* m, blas_int* n, float* a, bla | | int* lda, blas_int* ipiv, blas_int* info); | |
| s_int* lda, blas_int* ipiv, blas_int* info); | | void arma_fortran(arma_zgetrf)(blas_int* m, blas_int* n, void* a, blas_ | |
| void arma_fortran(arma_dgetrf)(blas_int* m, blas_int* n, double* a, bla | | int* lda, blas_int* ipiv, blas_int* info); | |
| s_int* lda, blas_int* ipiv, blas_int* info); | | | |
| void arma_fortran(arma_cgetrf)(blas_int* m, blas_int* n, void* a, bla | | // matrix inversion (using LU factorisation result) | |
| s_int* lda, blas_int* ipiv, blas_int* info); | | void arma_fortran(arma_sgetri)(blas_int* n, float* a, blas_int* lda, bla | |
| void arma_fortran(arma_zgetrf)(blas_int* m, blas_int* n, void* a, bla | | s_int* ipiv, float* work, blas_int* lwork, blas_int* info); | |
| s_int* lda, blas_int* ipiv, blas_int* info); | | void arma_fortran(arma_dgetri)(blas_int* n, double* a, blas_int* lda, bla | |
| | | s_int* ipiv, double* work, blas_int* lwork, blas_int* info); | |
| // matrix inversion (using LU factorisation result) | | void arma_fortran(arma_cgetri)(blas_int* n, void* a, blas_int* lda, bla | |
| void arma_fortran(arma_sgetri)(blas_int* n, float* a, blas_int* lda, b | | s_int* ipiv, void* work, blas_int* lwork, blas_int* info); | |
| las_int* ipiv, float* work, blas_int* lwork, blas_int* info); | | void arma_fortran(arma_zgetri)(blas_int* n, void* a, blas_int* lda, bla | |
| void arma_fortran(arma_dgetri)(blas_int* n, double* a, blas_int* lda, b | | s_int* ipiv, void* work, blas_int* lwork, blas_int* info); | |
| las_int* ipiv, double* work, blas_int* lwork, blas_int* info); | | | |
| void arma_fortran(arma_cgetri)(blas_int* n, void* a, blas_int* lda, b | | // matrix inversion (triangular matrices) | |
| las_int* ipiv, void* work, blas_int* lwork, blas_int* info); | | void arma_fortran(arma_strtri)(char* uplo, char* diag, blas_int* n, floa | |
| void arma_fortran(arma_zgetri)(blas_int* n, void* a, blas_int* lda, b | | t* a, blas_int* lda, blas_int* info); | |
| las_int* ipiv, void* work, blas_int* lwork, blas_int* info); | | void arma_fortran(arma_dtrtri)(char* uplo, char* diag, blas_int* n, doubl | |
| | | e* a, blas_int* lda, blas_int* info); | |
| // matrix inversion (triangular matrices) | | void arma_fortran(arma_ctrtri)(char* uplo, char* diag, blas_int* n, voi | |
| void arma_fortran(arma_strtri)(char* uplo, char* diag, blas_int* n, fl | | d* a, blas_int* lda, blas_int* info); | |
| oat* a, blas_int* lda, blas_int* info); | | void arma_fortran(arma_ztrtri)(char* uplo, char* diag, blas_int* n, voi | |
| void arma_fortran(arma_dtrtri)(char* uplo, char* diag, blas_int* n, dou | | d* a, blas_int* lda, blas_int* info); | |
| ble* a, blas_int* lda, blas_int* info); | | | |
| void arma_fortran(arma_ctrtri)(char* uplo, char* diag, blas_int* n, v | | // eigenvector decomposition of symmetric real matrices | |
| oid* a, blas_int* lda, blas_int* info); | | void arma_fortran(arma_ssyev)(char* jobz, char* uplo, blas_int* n, float | |
| void arma_fortran(arma_ztrtri)(char* uplo, char* diag, blas_int* n, v | | * a, blas_int* lda, float* w, float* work, blas_int* lwork, blas_int* inf | |
| oid* a, blas_int* lda, blas_int* info); | | o); | |
| | | void arma_fortran(arma_dsyev)(char* jobz, char* uplo, blas_int* n, double | |
| // eigenvector decomposition of symmetric real matrices | | * a, blas_int* lda, double* w, double* work, blas_int* lwork, blas_int* inf | |
| void arma_fortran(arma_ssyev)(char* jobz, char* uplo, blas_int* n, flo | | o); | |
| at* a, blas_int* lda, float* w, float* work, blas_int* lwork, blas_int* i | | | |
| nfo); | | // eigenvector decomposition of hermitian matrices (complex) | |
| void arma_fortran(arma_dsyev)(char* jobz, char* uplo, blas_int* n, doub | | void arma_fortran(arma_cheev)(char* jobz, char* uplo, blas_int* n, void | |
| le* a, blas_int* lda, double* w, double* work, blas_int* lwork, blas_int* i | | * a, blas_int* lda, float* w, void* work, blas_int* lwork, float* rwork | |
| nfo); | | , blas_int* info); | |
| | | void arma_fortran(arma_zheev)(char* jobz, char* uplo, blas_int* n, void | |
| // eigenvector decomposition of hermitian matrices (complex) | | * a, blas_int* lda, double* w, void* work, blas_int* lwork, double* rwork | |
| void arma_fortran(arma_cheev)(char* jobz, char* uplo, blas_int* n, vo | | , blas_int* info); | |
| id* a, blas_int* lda, float* w, void* work, blas_int* lwork, float* rwo | | | |
| rk, blas_int* info); | | // eigenvector decomposition of general real matrices | |
| void arma_fortran(arma_zheev)(char* jobz, char* uplo, blas_int* n, vo | | void arma_fortran(arma_sgeev)(char* jobvl, char* jobvr, blas_int* n, flo | |
| id* a, blas_int* lda, double* w, void* work, blas_int* lwork, double* rwo | | at* a, blas_int* lda, float* wr, float* wi, float* vl, blas_int* ldvl, | |
| rk, blas_int* info); | | float* vr, blas_int* ldvr, float* work, blas_int* lwork, blas_int* info); | |
| | | void arma_fortran(arma_dgeev)(char* jobvl, char* jobvr, blas_int* n, doub | |
| // eigenvector decomposition of general real matrices | | le* a, blas_int* lda, double* wr, double* wi, double* vl, blas_int* ldvl, d | |
| void arma_fortran(arma_sgeev)(char* jobvl, char* jobvr, blas_int* n, f | | ouble* vr, blas_int* ldvr, double* work, blas_int* lwork, blas_int* info); | |
| loat* a, blas_int* lda, float* wr, float* wi, float* vl, blas_int* ldvl, | | | |
| float* vr, blas_int* ldvr, float* work, blas_int* lwork, blas_int* info) | | // eigenvector decomposition of general complex matrices | |
| ; | | void arma_fortran(arma_cgeev)(char* jobvl, char* jobvr, blas_int* n, void | |
| void arma_fortran(arma_dgeev)(char* jobvl, char* jobvr, blas_int* n, do | | * a, blas_int* lda, void* w, void* vl, blas_int* ldvl, void* vr, blas_int* | |
| uble* a, blas_int* lda, double* wr, double* wi, double* vl, blas_int* ldvl, | | ldvr, void* work, blas_int* lwork, float* rwork, blas_int* info); | |
| double* vr, blas_int* ldvr, double* work, blas_int* lwork, blas_int* info) | | void arma_fortran(arma_zgeev)(char* jobvl, char* jobvr, blas_int* n, void | |
| ; | | * a, blas_int* lda, void* w, void* vl, blas_int* ldvl, void* vr, blas_int* | |
| | | ldvr, void* work, blas_int* lwork, double* rwork, blas_int* info); | |
| // eigenvector decomposition of general complex matrices | | | |
| void arma_fortran(arma_cgeev)(char* jobvr, char* jobvl, blas_int* n, vo | | // Cholesky decomposition | |
| id* a, blas_int* lda, void* w, void* vl, blas_int* ldvl, void* vr, blas_int | | void arma_fortran(arma_spotrf)(char* uplo, blas_int* n, float* a, blas_i | |
| * ldvr, void* work, blas_int* lwork, float* rwork, blas_int* info); | | nt* lda, blas_int* info); | |
| void arma_fortran(arma_zgeev)(char* jobvl, char* jobvr, blas_int* n, vo | | void arma_fortran(arma_dpotrf)(char* uplo, blas_int* n, double* a, blas_i | |
| id* a, blas_int* lda, void* w, void* vl, blas_int* ldvl, void* vr, blas_int | | nt* lda, blas_int* info); | |
| * ldvr, void* work, blas_int* lwork, double* rwork, blas_int* info); | | void arma_fortran(arma_cpotrf)(char* uplo, blas_int* n, void* a, blas_i | |
| | | nt* lda, blas_int* info); | |
| // Cholesky decomposition | | void arma_fortran(arma_zpotrf)(char* uplo, blas_int* n, void* a, blas_i | |
| void arma_fortran(arma_spotrf)(char* uplo, blas_int* n, float* a, blas | | nt* lda, blas_int* info); | |
| _int* lda, blas_int* info); | | | |
| void arma_fortran(arma_dpotrf)(char* uplo, blas_int* n, double* a, blas | | // matrix inversion (using Cholesky decomposition result) | |
| _int* lda, blas_int* info); | | void arma_fortran(arma_spotri)(char* uplo, blas_int* n, float* a, blas_i | |
| void arma_fortran(arma_cpotrf)(char* uplo, blas_int* n, void* a, blas | | nt* lda, blas_int* info); | |
| _int* lda, blas_int* info); | | void arma_fortran(arma_dpotri)(char* uplo, blas_int* n, double* a, blas_i | |
| void arma_fortran(arma_zpotrf)(char* uplo, blas_int* n, void* a, blas | | nt* lda, blas_int* info); | |
| _int* lda, blas_int* info); | | void arma_fortran(arma_cpotri)(char* uplo, blas_int* n, void* a, blas_i | |
| | | nt* lda, blas_int* info); | |
| // matrix inversion (using Cholesky decomposition result) | | void arma_fortran(arma_zpotri)(char* uplo, blas_int* n, void* a, blas_i | |
| void arma_fortran(arma_spotri)(char* uplo, blas_int* n, float* a, blas | | nt* lda, blas_int* info); | |
| _int* lda, blas_int* info); | | | |
| void arma_fortran(arma_dpotri)(char* uplo, blas_int* n, double* a, blas | | // QR decomposition | |
| _int* lda, blas_int* info); | | void arma_fortran(arma_sgeqrf)(blas_int* m, blas_int* n, float* a, blas_ | |
| void arma_fortran(arma_cpotri)(char* uplo, blas_int* n, void* a, blas | | int* lda, float* tau, float* work, blas_int* lwork, blas_int* info); | |
| _int* lda, blas_int* info); | | void arma_fortran(arma_dgeqrf)(blas_int* m, blas_int* n, double* a, blas_ | |
| void arma_fortran(arma_zpotri)(char* uplo, blas_int* n, void* a, blas | | int* lda, double* tau, double* work, blas_int* lwork, blas_int* info); | |
| _int* lda, blas_int* info); | | void arma_fortran(arma_cgeqrf)(blas_int* m, blas_int* n, void* a, blas_ | |
| | | int* lda, void* tau, void* work, blas_int* lwork, blas_int* info); | |
| // QR decomposition | | void arma_fortran(arma_zgeqrf)(blas_int* m, blas_int* n, void* a, blas_ | |
| void arma_fortran(arma_sgeqrf)(blas_int* m, blas_int* n, float* a, bla | | int* lda, void* tau, void* work, blas_int* lwork, blas_int* info); | |
| s_int* lda, float* tau, float* work, blas_int* lwork, blas_int* info); | | | |
| void arma_fortran(arma_dgeqrf)(blas_int* m, blas_int* n, double* a, bla | | // Q matrix calculation from QR decomposition (real matrices) | |
| s_int* lda, double* tau, double* work, blas_int* lwork, blas_int* info); | | void arma_fortran(arma_sorgqr)(blas_int* m, blas_int* n, blas_int* k, fl | |
| void arma_fortran(arma_cgeqrf)(blas_int* m, blas_int* n, void* a, bla | | oat* a, blas_int* lda, float* tau, float* work, blas_int* lwork, blas_int | |
| s_int* lda, void* tau, void* work, blas_int* lwork, blas_int* info); | | * info); | |
| void arma_fortran(arma_zgeqrf)(blas_int* m, blas_int* n, void* a, bla | | void arma_fortran(arma_dorgqr)(blas_int* m, blas_int* n, blas_int* k, dou | |
| s_int* lda, void* tau, void* work, blas_int* lwork, blas_int* info); | | ble* a, blas_int* lda, double* tau, double* work, blas_int* lwork, blas_int | |
| | | * info); | |
| // Q matrix calculation from QR decomposition (real matrices) | | | |
| void arma_fortran(arma_sorgqr)(blas_int* m, blas_int* n, blas_int* k, | | // Q matrix calculation from QR decomposition (complex matrices) | |
| float* a, blas_int* lda, float* tau, float* work, blas_int* lwork, blas_i | | void arma_fortran(arma_cungqr)(blas_int* m, blas_int* n, blas_int* k, v | |
| nt* info); | | oid* a, blas_int* lda, void* tau, void* work, blas_int* lwork, blas_int | |
| void arma_fortran(arma_dorgqr)(blas_int* m, blas_int* n, blas_int* k, d | | * info); | |
| ouble* a, blas_int* lda, double* tau, double* work, blas_int* lwork, blas_i | | void arma_fortran(arma_zungqr)(blas_int* m, blas_int* n, blas_int* k, v | |
| nt* info); | | oid* a, blas_int* lda, void* tau, void* work, blas_int* lwork, blas_int | |
| | | * info); | |
| // Q matrix calculation from QR decomposition (complex matrices) | | | |
| void arma_fortran(arma_cungqr)(blas_int* m, blas_int* n, blas_int* k, | | // SVD (real matrices) | |
| void* a, blas_int* lda, void* tau, void* work, blas_int* lwork, blas_i | | void arma_fortran(arma_sgesvd)(char* jobu, char* jobvt, blas_int* m, blas | |
| nt* info); | | _int* n, float* a, blas_int* lda, float* s, float* u, blas_int* ldu, flo | |
| void arma_fortran(arma_zungqr)(blas_int* m, blas_int* n, blas_int* k, | | at* vt, blas_int* ldvt, float* work, blas_int* lwork, blas_int* info); | |
| void* a, blas_int* lda, void* tau, void* work, blas_int* lwork, blas_i | | void arma_fortran(arma_dgesvd)(char* jobu, char* jobvt, blas_int* m, blas | |
| nt* info); | | _int* n, double* a, blas_int* lda, double* s, double* u, blas_int* ldu, dou | |
| | | ble* vt, blas_int* ldvt, double* work, blas_int* lwork, blas_int* info); | |
| // SVD (real matrices) | | | |
| void arma_fortran(arma_sgesvd)(char* jobu, char* jobvt, blas_int* m, bl | | // SVD (complex matrices) | |
| as_int* n, float* a, blas_int* lda, float* s, float* u, blas_int* ldu, f | | void arma_fortran(arma_cgesvd)(char* jobu, char* jobvt, blas_int* m, blas | |
| loat* vt, blas_int* ldvt, float* work, blas_int* lwork, blas_int* info); | | _int* n, void* a, blas_int* lda, float* s, void* u, blas_int* ldu, voi | |
| void arma_fortran(arma_dgesvd)(char* jobu, char* jobvt, blas_int* m, bl | | d* vt, blas_int* ldvt, void* work, blas_int* lwork, float* rwork, blas | |
| as_int* n, double* a, blas_int* lda, double* s, double* u, blas_int* ldu, d | | _int* info); | |
| ouble* vt, blas_int* ldvt, double* work, blas_int* lwork, blas_int* info); | | void arma_fortran(arma_zgesvd)(char* jobu, char* jobvt, blas_int* m, blas | |
| | | _int* n, void* a, blas_int* lda, double* s, void* u, blas_int* ldu, voi | |
| // SVD (complex matrices) | | d* vt, blas_int* ldvt, void* work, blas_int* lwork, double* rwork, blas | |
| void arma_fortran(arma_cgesvd)(char* jobu, char* jobvt, blas_int* m, bl | | _int* info); | |
| as_int* n, void* a, blas_int* lda, float* s, void* u, blas_int* ldu, v | | | |
| oid* vt, blas_int* ldvt, void* work, blas_int* lwork, float* rwork, bl | | // solve system of linear equations, using LU decomposition | |
| as_int* info); | | void arma_fortran(arma_sgesv)(blas_int* n, blas_int* nrhs, float* a, bla | |
| void arma_fortran(arma_zgesvd)(char* jobu, char* jobvt, blas_int* m, bl | | s_int* lda, blas_int* ipiv, float* b, blas_int* ldb, blas_int* info); | |
| as_int* n, void* a, blas_int* lda, double* s, void* u, blas_int* ldu, v | | void arma_fortran(arma_dgesv)(blas_int* n, blas_int* nrhs, double* a, bla | |
| oid* vt, blas_int* ldvt, void* work, blas_int* lwork, double* rwork, bl | | s_int* lda, blas_int* ipiv, double* b, blas_int* ldb, blas_int* info); | |
| as_int* info); | | void arma_fortran(arma_cgesv)(blas_int* n, blas_int* nrhs, void* a, bla | |
| | | s_int* lda, blas_int* ipiv, void* b, blas_int* ldb, blas_int* info); | |
| // solve system of linear equations, using LU decomposition | | void arma_fortran(arma_zgesv)(blas_int* n, blas_int* nrhs, void* a, bla | |
| void arma_fortran(arma_sgesv)(blas_int* n, blas_int* nrhs, float* a, b | | s_int* lda, blas_int* ipiv, void* b, blas_int* ldb, blas_int* info); | |
| las_int* lda, blas_int* ipiv, float* b, blas_int* ldb, blas_int* info); | | | |
| void arma_fortran(arma_dgesv)(blas_int* n, blas_int* nrhs, double* a, b | | // solve over/underdetermined system of linear equations | |
| las_int* lda, blas_int* ipiv, double* b, blas_int* ldb, blas_int* info); | | void arma_fortran(arma_sgels)(char* trans, blas_int* m, blas_int* n, blas | |
| void arma_fortran(arma_cgesv)(blas_int* n, blas_int* nrhs, void* a, b | | _int* nrhs, float* a, blas_int* lda, float* b, blas_int* ldb, float* wor | |
| las_int* lda, blas_int* ipiv, void* b, blas_int* ldb, blas_int* info); | | k, blas_int* lwork, blas_int* info); | |
| void arma_fortran(arma_zgesv)(blas_int* n, blas_int* nrhs, void* a, b | | void arma_fortran(arma_dgels)(char* trans, blas_int* m, blas_int* n, blas | |
| las_int* lda, blas_int* ipiv, void* b, blas_int* ldb, blas_int* info); | | _int* nrhs, double* a, blas_int* lda, double* b, blas_int* ldb, double* wor | |
| | | k, blas_int* lwork, blas_int* info); | |
| // solve over/underdetermined system of linear equations | | void arma_fortran(arma_cgels)(char* trans, blas_int* m, blas_int* n, blas | |
| void arma_fortran(arma_sgels)(char* trans, blas_int* m, blas_int* n, bl | | _int* nrhs, void* a, blas_int* lda, void* b, blas_int* ldb, void* wor | |
| as_int* nrhs, float* a, blas_int* lda, float* b, blas_int* ldb, float* w | | k, blas_int* lwork, blas_int* info); | |
| ork, blas_int* lwork, blas_int* info); | | void arma_fortran(arma_zgels)(char* trans, blas_int* m, blas_int* n, blas | |
| void arma_fortran(arma_dgels)(char* trans, blas_int* m, blas_int* n, bl | | _int* nrhs, void* a, blas_int* lda, void* b, blas_int* ldb, void* wor | |
| as_int* nrhs, double* a, blas_int* lda, double* b, blas_int* ldb, double* w | | k, blas_int* lwork, blas_int* info); | |
| ork, blas_int* lwork, blas_int* info); | | | |
| void arma_fortran(arma_cgels)(char* trans, blas_int* m, blas_int* n, bl | | // solve a triangular system of linear equations | |
| as_int* nrhs, void* a, blas_int* lda, void* b, blas_int* ldb, void* w | | void arma_fortran(arma_strtrs)(char* uplo, char* trans, char* diag, blas_ | |
| ork, blas_int* lwork, blas_int* info); | | int* n, blas_int* nrhs, const float* a, blas_int* lda, float* b, blas_int | |
| void arma_fortran(arma_zgels)(char* trans, blas_int* m, blas_int* n, bl | | * ldb, blas_int* info); | |
| as_int* nrhs, void* a, blas_int* lda, void* b, blas_int* ldb, void* w | | void arma_fortran(arma_dtrtrs)(char* uplo, char* trans, char* diag, blas_ | |
| ork, blas_int* lwork, blas_int* info); | | int* n, blas_int* nrhs, const double* a, blas_int* lda, double* b, blas_int | |
| | | * ldb, blas_int* info); | |
| // solve a triangular system of linear equations | | void arma_fortran(arma_ctrtrs)(char* uplo, char* trans, char* diag, blas_ | |
| void arma_fortran(arma_strtrs)(char* uplo, char* trans, char* diag, bla | | int* n, blas_int* nrhs, const void* a, blas_int* lda, void* b, blas_int | |
| s_int* n, blas_int* nrhs, const float* a, blas_int* lda, float* b, blas_i | | * ldb, blas_int* info); | |
| nt* ldb, blas_int* info); | | void arma_fortran(arma_ztrtrs)(char* uplo, char* trans, char* diag, blas_ | |
| void arma_fortran(arma_dtrtrs)(char* uplo, char* trans, char* diag, bla | | int* n, blas_int* nrhs, const void* a, blas_int* lda, void* b, blas_int | |
| s_int* n, blas_int* nrhs, const double* a, blas_int* lda, double* b, blas_i | | * ldb, blas_int* info); | |
| nt* ldb, blas_int* info); | | | |
| void arma_fortran(arma_ctrtrs)(char* uplo, char* trans, char* diag, bla | | // Schur decomposition (real matrices) | |
| s_int* n, blas_int* nrhs, const void* a, blas_int* lda, void* b, blas_i | | void arma_fortran(arma_sgees)(char* jobvs, char* sort, blas_int* select, | |
| nt* ldb, blas_int* info); | | blas_int* n, float* a, blas_int* lda, blas_int* sdim, float* wr, float* | |
| void arma_fortran(arma_ztrtrs)(char* uplo, char* trans, char* diag, bla | | wi, float* vs, blas_int* ldvs, float* work, blas_int* lwork, blas_int* bw | |
| s_int* n, blas_int* nrhs, const void* a, blas_int* lda, void* b, blas_i | | ork, blas_int* info); | |
| nt* ldb, blas_int* info); | | void arma_fortran(arma_dgees)(char* jobvs, char* sort, blas_int* select, | |
| | | blas_int* n, double* a, blas_int* lda, blas_int* sdim, double* wr, double* | |
| // Schur decomposition (real matrices) | | wi, double* vs, blas_int* ldvs, double* work, blas_int* lwork, blas_int* bw | |
| void arma_fortran(arma_sgees)(char* jobvs, char* sort, blas_int* select | | ork, blas_int* info); | |
| , blas_int* n, float* a, blas_int* lda, blas_int* sdim, float* wr, float* | | | |
| wi, float* vs, blas_int* ldvs, float* work, blas_int* lwork, blas_int* | | // Schur decomposition (complex matrices) | |
| bwork, blas_int* info); | | void arma_fortran(arma_cgees)(char* jobvs, char* sort, blas_int* select, | |
| void arma_fortran(arma_dgees)(char* jobvs, char* sort, blas_int* select | | blas_int* n, void* a, blas_int* lda, blas_int* sdim, void* w, void* vs, bla | |
| , blas_int* n, double* a, blas_int* lda, blas_int* sdim, double* wr, double | | s_int* ldvs, void* work, blas_int* lwork, float* rwork, blas_int* bwork, b | |
| * wi, double* vs, blas_int* ldvs, double* work, blas_int* lwork, blas_int* | | las_int* info); | |
| bwork, blas_int* info); | | void arma_fortran(arma_zgees)(char* jobvs, char* sort, blas_int* select, | |
| | | blas_int* n, void* a, blas_int* lda, blas_int* sdim, void* w, void* vs, bla | |
| // Schur decomposition (complex matrices) | | s_int* ldvs, void* work, blas_int* lwork, double* rwork, blas_int* bwork, b | |
| void arma_fortran(arma_cgees)(char* jobvs, char* sort, blas_int* select | | las_int* info); | |
| , blas_int* n, void* a, blas_int* lda, blas_int* sdim, void* w, void* vs, b | | | |
| las_int* ldvs, void* work, blas_int* lwork, float* rwork, blas_int* bwork, | | // solve a Sylvester equation ax + xb = c, with a and b assumed to be in | |
| blas_int* info); | | Schur form | |
| void arma_fortran(arma_zgees)(char* jobvs, char* sort, blas_int* select | | void arma_fortran(arma_strsyl)(char* transa, char* transb, blas_int* isgn | |
| , blas_int* n, void* a, blas_int* lda, blas_int* sdim, void* w, void* vs, b | | , blas_int* m, blas_int* n, const float* a, blas_int* lda, const float* b | |
| las_int* ldvs, void* work, blas_int* lwork, double* rwork, blas_int* bwork, | | , blas_int* ldb, float* c, blas_int* ldc, float* scale, blas_int* info); | |
| blas_int* info); | | void arma_fortran(arma_dtrsyl)(char* transa, char* transb, blas_int* isgn | |
| | | , blas_int* m, blas_int* n, const double* a, blas_int* lda, const double* b | |
| // solve a Sylvester equation ax + xb = c, with a and b assumed to be i | | , blas_int* ldb, double* c, blas_int* ldc, double* scale, blas_int* info); | |
| n Schur form | | void arma_fortran(arma_ctrsyl)(char* transa, char* transb, blas_int* isgn | |
| void arma_fortran(arma_strsyl)(char* transa, char* transb, blas_int* is | | , blas_int* m, blas_int* n, const void* a, blas_int* lda, const void* b | |
| gn, blas_int* m, blas_int* n, const float* a, blas_int* lda, const float* | | , blas_int* ldb, void* c, blas_int* ldc, float* scale, blas_int* info); | |
| b, blas_int* ldb, float* c, blas_int* ldc, float* scale, blas_int* info) | | void arma_fortran(arma_ztrsyl)(char* transa, char* transb, blas_int* isgn | |
| ; | | , blas_int* m, blas_int* n, const void* a, blas_int* lda, const void* b | |
| void arma_fortran(arma_dtrsyl)(char* transa, char* transb, blas_int* is | | , blas_int* ldb, void* c, blas_int* ldc, double* scale, blas_int* info); | |
| gn, blas_int* m, blas_int* n, const double* a, blas_int* lda, const double* | | | |
| b, blas_int* ldb, double* c, blas_int* ldc, double* scale, blas_int* info) | | void arma_fortran(arma_ssytrf)(char* uplo, blas_int* n, float* a, blas_i | |
| ; | | nt* lda, blas_int* ipiv, float* work, blas_int* lwork, blas_int* info); | |
| void arma_fortran(arma_ctrsyl)(char* transa, char* transb, blas_int* is | | void arma_fortran(arma_dsytrf)(char* uplo, blas_int* n, double* a, blas_i | |
| gn, blas_int* m, blas_int* n, const void* a, blas_int* lda, const void* | | nt* lda, blas_int* ipiv, double* work, blas_int* lwork, blas_int* info); | |
| b, blas_int* ldb, void* c, blas_int* ldc, float* scale, blas_int* info) | | void arma_fortran(arma_csytrf)(char* uplo, blas_int* n, void* a, blas_i | |
| ; | | nt* lda, blas_int* ipiv, void* work, blas_int* lwork, blas_int* info); | |
| void arma_fortran(arma_ztrsyl)(char* transa, char* transb, blas_int* is | | void arma_fortran(arma_zsytrf)(char* uplo, blas_int* n, void* a, blas_i | |
| gn, blas_int* m, blas_int* n, const void* a, blas_int* lda, const void* | | nt* lda, blas_int* ipiv, void* work, blas_int* lwork, blas_int* info); | |
| b, blas_int* ldb, void* c, blas_int* ldc, double* scale, blas_int* info) | | | |
| ; | | void arma_fortran(arma_ssytri)(char* uplo, blas_int* n, float* a, blas_i | |
| | | nt* lda, blas_int* ipiv, float* work, blas_int* info); | |
| void arma_fortran(arma_ssytrf)(char* uplo, blas_int* n, float* a, blas | | void arma_fortran(arma_dsytri)(char* uplo, blas_int* n, double* a, blas_i | |
| _int* lda, blas_int* ipiv, float* work, blas_int* lwork, blas_int* info); | | nt* lda, blas_int* ipiv, double* work, blas_int* info); | |
| void arma_fortran(arma_dsytrf)(char* uplo, blas_int* n, double* a, blas | | void arma_fortran(arma_csytri)(char* uplo, blas_int* n, void* a, blas_i | |
| _int* lda, blas_int* ipiv, double* work, blas_int* lwork, blas_int* info); | | nt* lda, blas_int* ipiv, void* work, blas_int* info); | |
| void arma_fortran(arma_csytrf)(char* uplo, blas_int* n, void* a, blas | | void arma_fortran(arma_zsytri)(char* uplo, blas_int* n, void* a, blas_i | |
| _int* lda, blas_int* ipiv, void* work, blas_int* lwork, blas_int* info); | | nt* lda, blas_int* ipiv, void* work, blas_int* info); | |
| void arma_fortran(arma_zsytrf)(char* uplo, blas_int* n, void* a, blas | | | |
| _int* lda, blas_int* ipiv, void* work, blas_int* lwork, blas_int* info); | | // void arma_fortran(arma_dgeqp3)(blas_int* m, blas_int* n, double* a, bl | |
| | | as_int* lda, blas_int* jpvt, double* tau, double* work, blas_int* lwork, bl | |
| void arma_fortran(arma_ssytri)(char* uplo, blas_int* n, float* a, blas | | as_int* info); | |
| _int* lda, blas_int* ipiv, float* work, blas_int* info); | | // void arma_fortran(arma_dormqr)(char* side, char* trans, blas_int* m, b | |
| void arma_fortran(arma_dsytri)(char* uplo, blas_int* n, double* a, blas | | las_int* n, blas_int* k, double* a, blas_int* lda, double* tau, double* c, | |
| _int* lda, blas_int* ipiv, double* work, blas_int* info); | | blas_int* ldc, double* work, blas_int* lwork, blas_int* info); | |
| void arma_fortran(arma_csytri)(char* uplo, blas_int* n, void* a, blas | | // void arma_fortran(arma_dposv)(char* uplo, blas_int* n, blas_int* nrhs | |
| _int* lda, blas_int* ipiv, void* work, blas_int* info); | | , double* a, blas_int* lda, double* b, blas_int* ldb, blas_int* info); | |
| void arma_fortran(arma_zsytri)(char* uplo, blas_int* n, void* a, blas | | | |
| _int* lda, blas_int* ipiv, void* work, blas_int* info); | | | |
| | | | |
| // void arma_fortran(arma_dgeqp3)(blas_int* m, blas_int* n, double* a, | | | |
| blas_int* lda, blas_int* jpvt, double* tau, double* work, blas_int* lwork, | | | |
| blas_int* info); | | | |
| // void arma_fortran(arma_dormqr)(char* side, char* trans, blas_int* m, | | | |
| blas_int* n, blas_int* k, double* a, blas_int* lda, double* tau, double* c | | | |
| , blas_int* ldc, double* work, blas_int* lwork, blas_int* info); | | | |
| // void arma_fortran(arma_dposv)(char* uplo, blas_int* n, blas_int* nr | | | |
| hs, double* a, blas_int* lda, double* b, blas_int* ldb, blas_int* info); | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| getrf(blas_int* m, blas_int* n, eT* a, blas_int* lda, blas_int* ipiv, bla | | | |
| s_int* info) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_sgetrf)(m, n, (T*)a, lda, ipiv, info); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_dgetrf)(m, n, (T*)a, lda, ipiv, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| arma_fortran(arma_cgetrf)(m, n, (T*)a, lda, ipiv, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| arma_fortran(arma_zgetrf)(m, n, (T*)a, lda, ipiv, info); | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| getri(blas_int* n, eT* a, blas_int* lda, blas_int* ipiv, eT* work, blas_ | | | |
| int* lwork, blas_int* info) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_sgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info) | | | |
| ; | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_dgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info) | | | |
| ; | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| arma_fortran(arma_cgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info) | | | |
| ; | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| arma_fortran(arma_zgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info) | | | |
| ; | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| trtri(char* uplo, char* diag, blas_int* n, eT* a, blas_int* lda, blas_int | | | |
| * info) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_strtri)(uplo, diag, n, (T*)a, lda, info); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_dtrtri)(uplo, diag, n, (T*)a, lda, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| arma_fortran(arma_ctrtri)(uplo, diag, n, (T*)a, lda, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| arma_fortran(arma_ztrtri)(uplo, diag, n, (T*)a, lda, info); | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| syev(char* jobz, char* uplo, blas_int* n, eT* a, blas_int* lda, eT* w, e | | | |
| T* work, blas_int* lwork, blas_int* info) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_ssyev)(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, | | | |
| lwork, info); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_dsyev)(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, | | | |
| lwork, info); | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| heev | | | |
| ( | | | |
| char* jobz, char* uplo, blas_int* n, | | | |
| eT* a, blas_int* lda, typename eT::value_type* w, | | | |
| eT* work, blas_int* lwork, typename eT::value_type* rwork, | | | |
| blas_int* info | | | |
| ) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| typedef typename std::complex<T> cx_T; | | | |
| arma_fortran(arma_cheev)(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*) | | | |
| work, lwork, (T*)rwork, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| typedef typename std::complex<T> cx_T; | | | |
| arma_fortran(arma_zheev)(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*) | | | |
| work, lwork, (T*)rwork, info); | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| geev | | | |
| ( | | | |
| char* jobvl, char* jobvr, blas_int* n, | | | |
| eT* a, blas_int* lda, eT* wr, eT* wi, eT* vl, | | | |
| blas_int* ldvl, eT* vr, blas_int* ldvr, | | | |
| eT* work, blas_int* lwork, | | | |
| blas_int* info | | | |
| ) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_sgeev)(jobvl, jobvr, n, (T*)a, lda, (T*)wr, (T*)wi | | | |
| , (T*)vl, ldvl, (T*)vr, ldvr, (T*)work, lwork, info); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_dgeev)(jobvl, jobvr, n, (T*)a, lda, (T*)wr, (T*)wi | | | |
| , (T*)vl, ldvl, (T*)vr, ldvr, (T*)work, lwork, info); | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| cx_geev | | | |
| ( | | | |
| char* jobvl, char* jobvr, blas_int* n, | | | |
| eT* a, blas_int* lda, eT* w, | | | |
| eT* vl, blas_int* ldvl, | | | |
| eT* vr, blas_int* ldvr, | | | |
| eT* work, blas_int* lwork, typename eT::value_type* rwork, | | | |
| blas_int* info | | | |
| ) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| typedef typename std::complex<T> cx_T; | | | |
| arma_fortran(arma_cgeev)(jobvl, jobvr, n, (cx_T*)a, lda, (cx_T*)w, (c | | | |
| x_T*)vl, ldvl, (cx_T*)vr, ldvr, (cx_T*)work, lwork, (T*)rwork, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| typedef typename std::complex<T> cx_T; | | | |
| arma_fortran(arma_zgeev)(jobvl, jobvr, n, (cx_T*)a, lda, (cx_T*)w, (c | | | |
| x_T*)vl, ldvl, (cx_T*)vr, ldvr, (cx_T*)work, lwork, (T*)rwork, info); | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| potrf(char* uplo, blas_int* n, eT* a, blas_int* lda, blas_int* info) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_spotrf)(uplo, n, (T*)a, lda, info); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_dpotrf)(uplo, n, (T*)a, lda, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| arma_fortran(arma_cpotrf)(uplo, n, (T*)a, lda, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| arma_fortran(arma_zpotrf)(uplo, n, (T*)a, lda, info); | | | |
| } | | | |
| | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| potri(char* uplo, blas_int* n, eT* a, blas_int* lda, blas_int* info) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_spotri)(uplo, n, (T*)a, lda, info); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_dpotri)(uplo, n, (T*)a, lda, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| arma_fortran(arma_cpotri)(uplo, n, (T*)a, lda, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| arma_fortran(arma_zpotri)(uplo, n, (T*)a, lda, info); | | | |
| } | | | |
| | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| geqrf(blas_int* m, blas_int* n, eT* a, blas_int* lda, eT* tau, eT* work, | | | |
| blas_int* lwork, blas_int* info) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_sgeqrf)(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork, | | | |
| info); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_dgeqrf)(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork, | | | |
| info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| arma_fortran(arma_cgeqrf)(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork, | | | |
| info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| arma_fortran(arma_zgeqrf)(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork, | | | |
| info); | | | |
| } | | | |
| | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| orgqr(blas_int* m, blas_int* n, blas_int* k, eT* a, blas_int* lda, eT* ta | | | |
| u, eT* work, blas_int* lwork, blas_int* info) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_sorgqr)(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwo | | | |
| rk, info); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_dorgqr)(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwo | | | |
| rk, info); | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| ungqr(blas_int* m, blas_int* n, blas_int* k, eT* a, blas_int* lda, eT* ta | | | |
| u, eT* work, blas_int* lwork, blas_int* info) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_cungqr)(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwo | | | |
| rk, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_zungqr)(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwo | | | |
| rk, info); | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| gesvd | | | |
| ( | | | |
| char* jobu, char* jobvt, blas_int* m, blas_int* n, eT* a, blas_int* lda | | | |
| , | | | |
| eT* s, eT* u, blas_int* ldu, eT* vt, blas_int* ldvt, | | | |
| eT* work, blas_int* lwork, blas_int* info | | | |
| ) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_sgesvd)(jobu, jobvt, m, n, (T*)a, lda, (T*)s, (T*)u | | | |
| , ldu, (T*)vt, ldvt, (T*)work, lwork, info); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_dgesvd)(jobu, jobvt, m, n, (T*)a, lda, (T*)s, (T*)u | | | |
| , ldu, (T*)vt, ldvt, (T*)work, lwork, info); | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename T> | | | |
| inline | | | |
| void | | | |
| cx_gesvd | | | |
| ( | | | |
| char* jobu, char* jobvt, blas_int* m, blas_int* n, std::complex<T>* a, | | | |
| blas_int* lda, | | | |
| T* s, std::complex<T>* u, blas_int* ldu, std::complex<T>* vt, blas_int* | | | |
| ldvt, | | | |
| std::complex<T>* work, blas_int* lwork, T* rwork, blas_int* info | | | |
| ) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<T>::value == false )); | | | |
| arma_type_check(( is_supported_blas_type< std::complex<T> >::value == f | | | |
| alse )); | | | |
| | | | |
| if(is_float<T>::value == true) | | | |
| { | | | |
| typedef float bT; | | | |
| arma_fortran(arma_cgesvd) | | | |
| ( | | | |
| jobu, jobvt, m, n, (std::complex<bT>*)a, lda, | | | |
| (bT*)s, (std::complex<bT>*)u, ldu, (std::complex<bT>*)vt, ldvt, | | | |
| (std::complex<bT>*)work, lwork, (bT*)rwork, info | | | |
| ); | | | |
| } | | | |
| else | | | |
| if(is_double<T>::value == true) | | | |
| { | | | |
| typedef double bT; | | | |
| arma_fortran(arma_zgesvd) | | | |
| ( | | | |
| jobu, jobvt, m, n, (std::complex<bT>*)a, lda, | | | |
| (bT*)s, (std::complex<bT>*)u, ldu, (std::complex<bT>*)vt, ldvt, | | | |
| (std::complex<bT>*)work, lwork, (bT*)rwork, info | | | |
| ); | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| gesv(blas_int* n, blas_int* nrhs, eT* a, blas_int* lda, blas_int* ipiv, e | | | |
| T* b, blas_int* ldb, blas_int* info) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_sgesv)(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info) | | | |
| ; | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_dgesv)(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info) | | | |
| ; | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| arma_fortran(arma_cgesv)(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info) | | | |
| ; | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| arma_fortran(arma_zgesv)(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info) | | | |
| ; | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| gels(char* trans, blas_int* m, blas_int* n, blas_int* nrhs, eT* a, blas_i | | | |
| nt* lda, eT* b, blas_int* ldb, eT* work, blas_int* lwork, blas_int* info) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_sgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, ( | | | |
| T*)work, lwork, info); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_dgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, ( | | | |
| T*)work, lwork, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| arma_fortran(arma_cgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, ( | | | |
| T*)work, lwork, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| arma_fortran(arma_zgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, ( | | | |
| T*)work, lwork, info); | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| trtrs(char* uplo, char* trans, char* diag, blas_int* n, blas_int* nrhs, c | | | |
| onst eT* a, blas_int* lda, eT* b, blas_int* ldb, blas_int* info) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_strtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T* | | | |
| )b, ldb, info); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_dtrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T* | | | |
| )b, ldb, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| arma_fortran(arma_ctrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T* | | | |
| )b, ldb, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| arma_fortran(arma_ztrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T* | | | |
| )b, ldb, info); | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| gees(char* jobvs, char* sort, blas_int* select, blas_int* n, eT* a, blas_ | | | |
| int* lda, blas_int* sdim, eT* wr, eT* wi, eT* vs, blas_int* ldvs, eT* work, | | | |
| blas_int* lwork, blas_int* bwork, blas_int* info) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(sgees)(jobvs, sort, select, n, (T*)a, lda, sdim, (T*)wr, | | | |
| (T*)wi, (T*)vs, ldvs, (T*)work, lwork, bwork, info); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(dgees)(jobvs, sort, select, n, (T*)a, lda, sdim, (T*)wr, | | | |
| (T*)wi, (T*)vs, ldvs, (T*)work, lwork, bwork, info); | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename T> | | | |
| inline | | | |
| void | | | |
| cx_gees(char* jobvs, char* sort, blas_int* select, blas_int* n, std::comp | | | |
| lex<T>* a, blas_int* lda, blas_int* sdim, std::complex<T>* w, std::complex< | | | |
| T>* vs, blas_int* ldvs, std::complex<T>* work, blas_int* lwork, T* rwork, b | | | |
| las_int* bwork, blas_int* info) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<T>::value == false )); | | | |
| arma_type_check(( is_supported_blas_type< std::complex<T> >::value == f | | | |
| alse )); | | | |
| | | | |
| if(is_float<T>::value == true) | | | |
| { | | | |
| typedef float bT; | | | |
| typedef std::complex<bT> cT; | | | |
| arma_fortran(cgees)(jobvs, sort, select, n, (cT*)a, lda, sdim, (cT*)w | | | |
| , (cT*)vs, ldvs, (cT*)work, lwork, (bT*)rwork, bwork, info); | | | |
| } | | | |
| else | | | |
| if(is_double<T>::value == true) | | | |
| { | | | |
| typedef double bT; | | | |
| typedef std::complex<bT> cT; | | | |
| arma_fortran(zgees)(jobvs, sort, select, n, (cT*)a, lda, sdim, (cT*)w | | | |
| , (cT*)vs, ldvs, (cT*)work, lwork, (bT*)rwork, bwork, info); | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| trsyl(char* transa, char* transb, blas_int* isgn, blas_int* m, blas_int* | | | |
| n, const eT* a, blas_int* lda, const eT* b, blas_int* ldb, eT* c, blas_int* | | | |
| ldc, eT* scale, blas_int* info) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(strsyl)(transa, transb, isgn, m, n, (T*)a, lda, (T*)b, l | | | |
| db, (T*)c, ldc, (T*)scale, info); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(dtrsyl)(transa, transb, isgn, m, n, (T*)a, lda, (T*)b, l | | | |
| db, (T*)c, ldc, (T*)scale, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| arma_fortran(ctrsyl)(transa, transb, isgn, m, n, (T*)a, lda, (T*)b, l | | | |
| db, (T*)c, ldc, (float*)scale, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| arma_fortran(ztrsyl)(transa, transb, isgn, m, n, (T*)a, lda, (T*)b, l | | | |
| db, (T*)c, ldc, (double*)scale, info); | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| sytrf(char* uplo, blas_int* n, eT* a, blas_int* lda, blas_int* ipiv, eT* | | | |
| work, blas_int* lwork, blas_int* info) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_ssytrf)(uplo, n, (T*)a, lda, ipiv, (T*)work, lwork, | | | |
| info); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_dsytrf)(uplo, n, (T*)a, lda, ipiv, (T*)work, lwork, | | | |
| info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| arma_fortran(arma_csytrf)(uplo, n, (T*)a, lda, ipiv, (T*)work, lwork, | | | |
| info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| arma_fortran(arma_zsytrf)(uplo, n, (T*)a, lda, ipiv, (T*)work, lwork, | | | |
| info); | | | |
| } | | | |
| } | | | |
| | | | |
| template<typename eT> | | | |
| inline | | | |
| void | | | |
| sytri(char* uplo, blas_int* n, eT* a, blas_int* lda, blas_int* ipiv, eT* | | | |
| work, blas_int* info) | | | |
| { | | | |
| arma_type_check(( is_supported_blas_type<eT>::value == false )); | | | |
| | | | |
| if(is_float<eT>::value == true) | | | |
| { | | | |
| typedef float T; | | | |
| arma_fortran(arma_ssytri)(uplo, n, (T*)a, lda, ipiv, (T*)work, info); | | | |
| } | | | |
| else | | | |
| if(is_double<eT>::value == true) | | | |
| { | | | |
| typedef double T; | | | |
| arma_fortran(arma_dsytri)(uplo, n, (T*)a, lda, ipiv, (T*)work, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_float<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<float> T; | | | |
| arma_fortran(arma_csytri)(uplo, n, (T*)a, lda, ipiv, (T*)work, info); | | | |
| } | | | |
| else | | | |
| if(is_supported_complex_double<eT>::value == true) | | | |
| { | | | |
| typedef std::complex<double> T; | | | |
| arma_fortran(arma_zsytri)(uplo, n, (T*)a, lda, ipiv, (T*)work, info); | | | |
| } | | | |
| } | | | |
| | | | |
| //! @} | | | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 2 change blocks. |
| 947 lines changed or deleted | | 226 lines changed or added | |
|
| subview_cube_meat.hpp | | subview_cube_meat.hpp | |
| | | | |
| skipping to change at line 513 | | skipping to change at line 513 | |
| // interpret the matrix as a cube with one slice | | // interpret the matrix as a cube with one slice | |
| | | | |
| for(uword col = 0; col < t_n_cols; ++col) | | for(uword col = 0; col < t_n_cols; ++col) | |
| { | | { | |
| arrayops::copy( t.slice_colptr(0, col), x.colptr(col), t_n_rows ); | | arrayops::copy( t.slice_colptr(0, col), x.colptr(col), t_n_rows ); | |
| } | | } | |
| } | | } | |
| else | | else | |
| if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols)
) | | if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols)
) | |
| { | | { | |
|
| // interpret the matrix as a cube with one column | | | |
| // and with the number of slices equal to the number of columns in the | | | |
| matrix | | | |
| | | | |
| for(uword i=0; i < t_n_slices; ++i) | | for(uword i=0; i < t_n_slices; ++i) | |
| { | | { | |
| arrayops::copy( t.slice_colptr(i, 0), x.colptr(i), t_n_rows ); | | arrayops::copy( t.slice_colptr(i, 0), x.colptr(i), t_n_rows ); | |
| } | | } | |
| } | | } | |
| else | | else | |
|
| if( (t_n_rows == 1) && (t_n_cols == x_n_cols) && (t_n_slices == x_n_rows)
) | | if( (t_n_rows == 1) && (t_n_cols == x_n_rows) && (t_n_slices == x_n_cols)
) | |
| { | | { | |
|
| // interpret the matrix as a cube with one row | | | |
| // and with the number of slices equal to the number of rows in the mat | | | |
| rix | | | |
| | | | |
| Cube<eT>& Q = *(t.m_ptr); | | Cube<eT>& Q = *(t.m_ptr); | |
| | | | |
| const uword t_aux_row1 = t.aux_row1; | | const uword t_aux_row1 = t.aux_row1; | |
| const uword t_aux_col1 = t.aux_col1; | | const uword t_aux_col1 = t.aux_col1; | |
| const uword t_aux_slice1 = t.aux_slice1; | | const uword t_aux_slice1 = t.aux_slice1; | |
| | | | |
|
| for(uword col=0; col < t_n_cols; ++col) | | for(uword slice=0; slice < t_n_slices; ++slice) | |
| { | | { | |
|
| const eT* x_colptr = x.colptr(col); | | const uword mod_slice = t_aux_slice1 + slice; | |
| | | | |
| | | const eT* x_colptr = x.colptr(slice); | |
| | | | |
| | | uword i,j; | |
| | | for(i=0, j=1; j < t_n_cols; i+=2, j+=2) | |
| | | { | |
| | | const eT tmp_i = x_colptr[i]; | |
| | | const eT tmp_j = x_colptr[j]; | |
| | | | |
| | | Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) = tmp_i; | |
| | | Q.at(t_aux_row1, t_aux_col1 + j, mod_slice) = tmp_j; | |
| | | } | |
| | | | |
|
| for(uword i=0; i < t_n_slices; ++i) | | if(i < t_n_cols) | |
| { | | { | |
|
| Q.at(t_aux_row1, t_aux_col1 + col, t_aux_slice1 + i) = x_colptr[i]; | | Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) = x_colptr[i]; | |
| } | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| if(arma_config::debug == true) | | if(arma_config::debug == true) | |
| { | | { | |
| arma_stop( arma_incompat_size_string(t, x, "copy into subcube") ); | | arma_stop( arma_incompat_size_string(t, x, "copy into subcube") ); | |
| } | | } | |
| } | | } | |
| | | | |
| skipping to change at line 588 | | skipping to change at line 594 | |
| } | | } | |
| else | | else | |
| if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols)
) | | if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols)
) | |
| { | | { | |
| for(uword i=0; i < t_n_slices; ++i) | | for(uword i=0; i < t_n_slices; ++i) | |
| { | | { | |
| arrayops::inplace_plus( t.slice_colptr(i, 0), x.colptr(i), t_n_rows )
; | | arrayops::inplace_plus( t.slice_colptr(i, 0), x.colptr(i), t_n_rows )
; | |
| } | | } | |
| } | | } | |
| else | | else | |
|
| if( (t_n_rows == 1) && (t_n_cols == x_n_cols) && (t_n_slices == x_n_rows)
) | | if( (t_n_rows == 1) && (t_n_cols == x_n_rows) && (t_n_slices == x_n_cols)
) | |
| { | | { | |
| Cube<eT>& Q = *(t.m_ptr); | | Cube<eT>& Q = *(t.m_ptr); | |
| | | | |
| const uword t_aux_row1 = t.aux_row1; | | const uword t_aux_row1 = t.aux_row1; | |
| const uword t_aux_col1 = t.aux_col1; | | const uword t_aux_col1 = t.aux_col1; | |
| const uword t_aux_slice1 = t.aux_slice1; | | const uword t_aux_slice1 = t.aux_slice1; | |
| | | | |
|
| for(uword col=0; col < t_n_cols; ++col) | | for(uword slice=0; slice < t_n_slices; ++slice) | |
| { | | { | |
|
| const eT* x_colptr = x.colptr(col); | | const uword mod_slice = t_aux_slice1 + slice; | |
| | | | |
|
| for(uword i=0; i < t_n_slices; ++i) | | const eT* x_colptr = x.colptr(slice); | |
| | | | |
| | | uword i,j; | |
| | | for(i=0, j=1; j < t_n_cols; i+=2, j+=2) | |
| { | | { | |
|
| Q.at(t_aux_row1, t_aux_col1 + col, t_aux_slice1 + i) += x_colptr[i] | | const eT tmp_i = x_colptr[i]; | |
| ; | | const eT tmp_j = x_colptr[j]; | |
| | | | |
| | | Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) += tmp_i; | |
| | | Q.at(t_aux_row1, t_aux_col1 + j, mod_slice) += tmp_j; | |
| | | } | |
| | | | |
| | | if(i < t_n_cols) | |
| | | { | |
| | | Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) += x_colptr[i]; | |
| } | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| if(arma_config::debug == true) | | if(arma_config::debug == true) | |
| { | | { | |
| arma_stop( arma_incompat_size_string(t, x, "addition") ); | | arma_stop( arma_incompat_size_string(t, x, "addition") ); | |
| } | | } | |
| } | | } | |
| | | | |
| skipping to change at line 651 | | skipping to change at line 669 | |
| } | | } | |
| else | | else | |
| if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols)
) | | if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols)
) | |
| { | | { | |
| for(uword i=0; i < t_n_slices; ++i) | | for(uword i=0; i < t_n_slices; ++i) | |
| { | | { | |
| arrayops::inplace_minus( t.slice_colptr(i, 0), x.colptr(i), t_n_rows
); | | arrayops::inplace_minus( t.slice_colptr(i, 0), x.colptr(i), t_n_rows
); | |
| } | | } | |
| } | | } | |
| else | | else | |
|
| if( (t_n_rows == 1) && (t_n_cols == x_n_cols) && (t_n_slices == x_n_rows)
) | | if( (t_n_rows == 1) && (t_n_cols == x_n_rows) && (t_n_slices == x_n_cols)
) | |
| { | | { | |
| Cube<eT>& Q = *(t.m_ptr); | | Cube<eT>& Q = *(t.m_ptr); | |
| | | | |
| const uword t_aux_row1 = t.aux_row1; | | const uword t_aux_row1 = t.aux_row1; | |
| const uword t_aux_col1 = t.aux_col1; | | const uword t_aux_col1 = t.aux_col1; | |
| const uword t_aux_slice1 = t.aux_slice1; | | const uword t_aux_slice1 = t.aux_slice1; | |
| | | | |
|
| for(uword col=0; col < t_n_cols; ++col) | | for(uword slice=0; slice < t_n_slices; ++slice) | |
| { | | { | |
|
| const eT* x_colptr = x.colptr(col); | | const uword mod_slice = t_aux_slice1 + slice; | |
| | | | |
| | | const eT* x_colptr = x.colptr(slice); | |
| | | | |
|
| for(uword i=0; i < t_n_slices; ++i) | | uword i,j; | |
| | | for(i=0, j=1; j < t_n_cols; i+=2, j+=2) | |
| { | | { | |
|
| Q.at(t_aux_row1, t_aux_col1 + col, t_aux_slice1 + i) -= x_colptr[i] | | const eT tmp_i = x_colptr[i]; | |
| ; | | const eT tmp_j = x_colptr[j]; | |
| | | | |
| | | Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) -= tmp_i; | |
| | | Q.at(t_aux_row1, t_aux_col1 + j, mod_slice) -= tmp_j; | |
| | | } | |
| | | | |
| | | if(i < t_n_cols) | |
| | | { | |
| | | Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) -= x_colptr[i]; | |
| } | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| if(arma_config::debug == true) | | if(arma_config::debug == true) | |
| { | | { | |
| arma_stop( arma_incompat_size_string(t, x, "subtraction") ); | | arma_stop( arma_incompat_size_string(t, x, "subtraction") ); | |
| } | | } | |
| } | | } | |
| | | | |
| skipping to change at line 714 | | skipping to change at line 744 | |
| } | | } | |
| else | | else | |
| if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols)
) | | if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols)
) | |
| { | | { | |
| for(uword i=0; i < t_n_slices; ++i) | | for(uword i=0; i < t_n_slices; ++i) | |
| { | | { | |
| arrayops::inplace_mul( t.slice_colptr(i, 0), x.colptr(i), t_n_rows ); | | arrayops::inplace_mul( t.slice_colptr(i, 0), x.colptr(i), t_n_rows ); | |
| } | | } | |
| } | | } | |
| else | | else | |
|
| if( (t_n_rows == 1) && (t_n_cols == x_n_cols) && (t_n_slices == x_n_rows)
) | | if( (t_n_rows == 1) && (t_n_cols == x_n_rows) && (t_n_slices == x_n_cols)
) | |
| { | | { | |
| Cube<eT>& Q = *(t.m_ptr); | | Cube<eT>& Q = *(t.m_ptr); | |
| | | | |
| const uword t_aux_row1 = t.aux_row1; | | const uword t_aux_row1 = t.aux_row1; | |
| const uword t_aux_col1 = t.aux_col1; | | const uword t_aux_col1 = t.aux_col1; | |
| const uword t_aux_slice1 = t.aux_slice1; | | const uword t_aux_slice1 = t.aux_slice1; | |
| | | | |
|
| for(uword col=0; col < t_n_cols; ++col) | | for(uword slice=0; slice < t_n_slices; ++slice) | |
| { | | { | |
|
| const eT* x_colptr = x.colptr(col); | | const uword mod_slice = t_aux_slice1 + slice; | |
| | | | |
| | | const eT* x_colptr = x.colptr(slice); | |
| | | | |
|
| for(uword i=0; i < t_n_slices; ++i) | | uword i,j; | |
| | | for(i=0, j=1; j < t_n_cols; i+=2, j+=2) | |
| { | | { | |
|
| Q.at(t_aux_row1, t_aux_col1 + col, t_aux_slice1 + i) *= x_colptr[i] | | const eT tmp_i = x_colptr[i]; | |
| ; | | const eT tmp_j = x_colptr[j]; | |
| | | | |
| | | Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) *= tmp_i; | |
| | | Q.at(t_aux_row1, t_aux_col1 + j, mod_slice) *= tmp_j; | |
| | | } | |
| | | | |
| | | if(i < t_n_cols) | |
| | | { | |
| | | Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) *= x_colptr[i]; | |
| } | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| if(arma_config::debug == true) | | if(arma_config::debug == true) | |
| { | | { | |
| arma_stop( arma_incompat_size_string(t, x, "element-wise multiplicati
on") ); | | arma_stop( arma_incompat_size_string(t, x, "element-wise multiplicati
on") ); | |
| } | | } | |
| } | | } | |
| | | | |
| skipping to change at line 777 | | skipping to change at line 819 | |
| } | | } | |
| else | | else | |
| if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols)
) | | if( (t_n_rows == x_n_rows) && (t_n_cols == 1) && (t_n_slices == x_n_cols)
) | |
| { | | { | |
| for(uword i=0; i < t_n_slices; ++i) | | for(uword i=0; i < t_n_slices; ++i) | |
| { | | { | |
| arrayops::inplace_div( t.slice_colptr(i, 0), x.colptr(i), t_n_rows ); | | arrayops::inplace_div( t.slice_colptr(i, 0), x.colptr(i), t_n_rows ); | |
| } | | } | |
| } | | } | |
| else | | else | |
|
| if( (t_n_rows == 1) && (t_n_cols == x_n_cols) && (t_n_slices == x_n_rows)
) | | if( (t_n_rows == 1) && (t_n_cols == x_n_rows) && (t_n_slices == x_n_cols)
) | |
| { | | { | |
| Cube<eT>& Q = *(t.m_ptr); | | Cube<eT>& Q = *(t.m_ptr); | |
| | | | |
| const uword t_aux_row1 = t.aux_row1; | | const uword t_aux_row1 = t.aux_row1; | |
| const uword t_aux_col1 = t.aux_col1; | | const uword t_aux_col1 = t.aux_col1; | |
| const uword t_aux_slice1 = t.aux_slice1; | | const uword t_aux_slice1 = t.aux_slice1; | |
| | | | |
|
| for(uword col=0; col < t_n_cols; ++col) | | for(uword slice=0; slice < t_n_slices; ++slice) | |
| { | | { | |
|
| const eT* x_colptr = x.colptr(col); | | const uword mod_slice = t_aux_slice1 + slice; | |
| | | | |
| | | const eT* x_colptr = x.colptr(slice); | |
| | | | |
| | | uword i,j; | |
| | | for(i=0, j=1; j < t_n_cols; i+=2, j+=2) | |
| | | { | |
| | | const eT tmp_i = x_colptr[i]; | |
| | | const eT tmp_j = x_colptr[j]; | |
| | | | |
| | | Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) /= tmp_i; | |
| | | Q.at(t_aux_row1, t_aux_col1 + j, mod_slice) /= tmp_j; | |
| | | } | |
| | | | |
|
| for(uword i=0; i < t_n_slices; ++i) | | if(i < t_n_cols) | |
| { | | { | |
|
| Q.at(t_aux_row1, t_aux_col1 + col, t_aux_slice1 + i) /= x_colptr[i]
; | | Q.at(t_aux_row1, t_aux_col1 + i, mod_slice) /= x_colptr[i]; | |
| } | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| if(arma_config::debug == true) | | if(arma_config::debug == true) | |
| { | | { | |
| arma_stop( arma_incompat_size_string(t, x, "element-wise division") )
; | | arma_stop( arma_incompat_size_string(t, x, "element-wise division") )
; | |
| } | | } | |
| } | | } | |
| | | | |
| skipping to change at line 1197 | | skipping to change at line 1251 | |
| out.set_size(in_n_rows, in_n_slices); | | out.set_size(in_n_rows, in_n_slices); | |
| | | | |
| for(uword i=0; i < in_n_slices; ++i) | | for(uword i=0; i < in_n_slices; ++i) | |
| { | | { | |
| arrayops::copy( out.colptr(i), in.slice_colptr(i, 0), in_n_rows )
; | | arrayops::copy( out.colptr(i), in.slice_colptr(i, 0), in_n_rows )
; | |
| } | | } | |
| } | | } | |
| else | | else | |
| if(in_n_rows == 1) | | if(in_n_rows == 1) | |
| { | | { | |
|
| out.set_size(in_n_slices, in_n_cols); | | | |
| | | | |
| const Cube<eT>& Q = in.m; | | const Cube<eT>& Q = in.m; | |
| | | | |
| const uword in_aux_row1 = in.aux_row1; | | const uword in_aux_row1 = in.aux_row1; | |
| const uword in_aux_col1 = in.aux_col1; | | const uword in_aux_col1 = in.aux_col1; | |
| const uword in_aux_slice1 = in.aux_slice1; | | const uword in_aux_slice1 = in.aux_slice1; | |
| | | | |
|
| for(uword col=0; col < in_n_cols; ++col) | | out.set_size(in_n_cols, in_n_slices); | |
| | | | |
| | | for(uword slice=0; slice < in_n_slices; ++slice) | |
| { | | { | |
|
| eT* out_colptr = out.colptr(col); | | const uword mod_slice = in_aux_slice1 + slice; | |
| | | | |
| | | eT* out_colptr = out.colptr(slice); | |
| | | | |
| | | uword i,j; | |
| | | for(i=0, j=1; j < in_n_cols; i+=2, j+=2) | |
| | | { | |
| | | const eT tmp_i = Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); | |
| | | const eT tmp_j = Q.at(in_aux_row1, in_aux_col1 + j, mod_slice); | |
| | | | |
| | | out_colptr[i] = tmp_i; | |
| | | out_colptr[j] = tmp_j; | |
| | | } | |
| | | | |
|
| for(uword i=0; i < in_n_slices; ++i) | | if(i < in_n_cols) | |
| { | | { | |
|
| out_colptr[i] = Q.at(in_aux_row1, in_aux_col1 + col, in_aux_sli
ce1 + i); | | out_colptr[i] = Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); | |
| } | | } | |
| } | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| out.set_size(in_n_slices); | | out.set_size(in_n_slices); | |
| | | | |
| eT* out_mem = out.memptr(); | | eT* out_mem = out.memptr(); | |
| | | | |
| | | | |
| skipping to change at line 1273 | | skipping to change at line 1339 | |
| if(out_vec_state == 0) | | if(out_vec_state == 0) | |
| { | | { | |
| if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices ==
out_n_cols) ) | | if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices ==
out_n_cols) ) | |
| { | | { | |
| for(uword i=0; i < in_n_slices; ++i) | | for(uword i=0; i < in_n_slices; ++i) | |
| { | | { | |
| arrayops::inplace_plus( out.colptr(i), in.slice_colptr(i, 0), in_
n_rows ); | | arrayops::inplace_plus( out.colptr(i), in.slice_colptr(i, 0), in_
n_rows ); | |
| } | | } | |
| } | | } | |
| else | | else | |
|
| if( (in_n_rows == 1) && (in_n_cols == out_n_cols) && (in_n_slices ==
out_n_rows) ) | | if( (in_n_rows == 1) && (in_n_cols == out_n_rows) && (in_n_slices ==
out_n_cols) ) | |
| { | | { | |
| const Cube<eT>& Q = in.m; | | const Cube<eT>& Q = in.m; | |
| | | | |
| const uword in_aux_row1 = in.aux_row1; | | const uword in_aux_row1 = in.aux_row1; | |
| const uword in_aux_col1 = in.aux_col1; | | const uword in_aux_col1 = in.aux_col1; | |
| const uword in_aux_slice1 = in.aux_slice1; | | const uword in_aux_slice1 = in.aux_slice1; | |
| | | | |
|
| for(uword col=0; col < in_n_cols; ++col) | | for(uword slice=0; slice < in_n_slices; ++slice) | |
| { | | { | |
|
| eT* out_colptr = out.colptr(col); | | const uword mod_slice = in_aux_slice1 + slice; | |
| | | | |
|
| for(uword i=0; i < in_n_slices; ++i) | | eT* out_colptr = out.colptr(slice); | |
| | | | |
| | | uword i,j; | |
| | | for(i=0, j=1; j < in_n_cols; i+=2, j+=2) | |
| { | | { | |
|
| out_colptr[i] += Q.at(in_aux_row1, in_aux_col1 + col, in_aux_sl | | const eT tmp_i = Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); | |
| ice1 + i); | | const eT tmp_j = Q.at(in_aux_row1, in_aux_col1 + j, mod_slice); | |
| | | | |
| | | out_colptr[i] += tmp_i; | |
| | | out_colptr[j] += tmp_j; | |
| | | } | |
| | | | |
| | | if(i < in_n_cols) | |
| | | { | |
| | | out_colptr[i] += Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); | |
| } | | } | |
| } | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| eT* out_mem = out.memptr(); | | eT* out_mem = out.memptr(); | |
| | | | |
| const Cube<eT>& Q = in.m; | | const Cube<eT>& Q = in.m; | |
| | | | |
| | | | |
| skipping to change at line 1347 | | skipping to change at line 1425 | |
| if(out_vec_state == 0) | | if(out_vec_state == 0) | |
| { | | { | |
| if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices ==
out_n_cols) ) | | if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices ==
out_n_cols) ) | |
| { | | { | |
| for(uword i=0; i < in_n_slices; ++i) | | for(uword i=0; i < in_n_slices; ++i) | |
| { | | { | |
| arrayops::inplace_minus( out.colptr(i), in.slice_colptr(i, 0), in
_n_rows ); | | arrayops::inplace_minus( out.colptr(i), in.slice_colptr(i, 0), in
_n_rows ); | |
| } | | } | |
| } | | } | |
| else | | else | |
|
| if( (in_n_rows == 1) && (in_n_cols == out_n_cols) && (in_n_slices ==
out_n_rows) ) | | if( (in_n_rows == 1) && (in_n_cols == out_n_rows) && (in_n_slices ==
out_n_cols) ) | |
| { | | { | |
| const Cube<eT>& Q = in.m; | | const Cube<eT>& Q = in.m; | |
| | | | |
| const uword in_aux_row1 = in.aux_row1; | | const uword in_aux_row1 = in.aux_row1; | |
| const uword in_aux_col1 = in.aux_col1; | | const uword in_aux_col1 = in.aux_col1; | |
| const uword in_aux_slice1 = in.aux_slice1; | | const uword in_aux_slice1 = in.aux_slice1; | |
| | | | |
|
| for(uword col=0; col < in_n_cols; ++col) | | for(uword slice=0; slice < in_n_slices; ++slice) | |
| { | | { | |
|
| eT* out_colptr = out.colptr(col); | | const uword mod_slice = in_aux_slice1 + slice; | |
| | | | |
| | | eT* out_colptr = out.colptr(slice); | |
| | | | |
|
| for(uword i=0; i < in_n_slices; ++i) | | uword i,j; | |
| | | for(i=0, j=1; j < in_n_cols; i+=2, j+=2) | |
| { | | { | |
|
| out_colptr[i] -= Q.at(in_aux_row1, in_aux_col1 + col, in_aux_sl | | const eT tmp_i = Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); | |
| ice1 + i); | | const eT tmp_j = Q.at(in_aux_row1, in_aux_col1 + j, mod_slice); | |
| | | | |
| | | out_colptr[i] -= tmp_i; | |
| | | out_colptr[j] -= tmp_j; | |
| | | } | |
| | | | |
| | | if(i < in_n_cols) | |
| | | { | |
| | | out_colptr[i] -= Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); | |
| } | | } | |
| } | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| eT* out_mem = out.memptr(); | | eT* out_mem = out.memptr(); | |
| | | | |
| const Cube<eT>& Q = in.m; | | const Cube<eT>& Q = in.m; | |
| | | | |
| | | | |
| skipping to change at line 1421 | | skipping to change at line 1511 | |
| if(out_vec_state == 0) | | if(out_vec_state == 0) | |
| { | | { | |
| if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices ==
out_n_cols) ) | | if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices ==
out_n_cols) ) | |
| { | | { | |
| for(uword i=0; i < in_n_slices; ++i) | | for(uword i=0; i < in_n_slices; ++i) | |
| { | | { | |
| arrayops::inplace_mul( out.colptr(i), in.slice_colptr(i, 0), in_n
_rows ); | | arrayops::inplace_mul( out.colptr(i), in.slice_colptr(i, 0), in_n
_rows ); | |
| } | | } | |
| } | | } | |
| else | | else | |
|
| if( (in_n_rows == 1) && (in_n_cols == out_n_cols) && (in_n_slices ==
out_n_rows) ) | | if( (in_n_rows == 1) && (in_n_cols == out_n_rows) && (in_n_slices ==
out_n_cols) ) | |
| { | | { | |
| const Cube<eT>& Q = in.m; | | const Cube<eT>& Q = in.m; | |
| | | | |
| const uword in_aux_row1 = in.aux_row1; | | const uword in_aux_row1 = in.aux_row1; | |
| const uword in_aux_col1 = in.aux_col1; | | const uword in_aux_col1 = in.aux_col1; | |
| const uword in_aux_slice1 = in.aux_slice1; | | const uword in_aux_slice1 = in.aux_slice1; | |
| | | | |
|
| for(uword col=0; col < in_n_cols; ++col) | | for(uword slice=0; slice < in_n_slices; ++slice) | |
| { | | { | |
|
| eT* out_colptr = out.colptr(col); | | const uword mod_slice = in_aux_slice1 + slice; | |
| | | | |
| | | eT* out_colptr = out.colptr(slice); | |
| | | | |
|
| for(uword i=0; i < in_n_slices; ++i) | | uword i,j; | |
| | | for(i=0, j=1; j < in_n_cols; i+=2, j+=2) | |
| { | | { | |
|
| out_colptr[i] *= Q.at(in_aux_row1, in_aux_col1 + col, in_aux_sl | | const eT tmp_i = Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); | |
| ice1 + i); | | const eT tmp_j = Q.at(in_aux_row1, in_aux_col1 + j, mod_slice); | |
| | | | |
| | | out_colptr[i] *= tmp_i; | |
| | | out_colptr[j] *= tmp_j; | |
| | | } | |
| | | | |
| | | if(i < in_n_cols) | |
| | | { | |
| | | out_colptr[i] *= Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); | |
| } | | } | |
| } | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| eT* out_mem = out.memptr(); | | eT* out_mem = out.memptr(); | |
| | | | |
| const Cube<eT>& Q = in.m; | | const Cube<eT>& Q = in.m; | |
| | | | |
| | | | |
| skipping to change at line 1495 | | skipping to change at line 1597 | |
| if(out_vec_state == 0) | | if(out_vec_state == 0) | |
| { | | { | |
| if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices ==
out_n_cols) ) | | if( (in_n_rows == out_n_rows) && (in_n_cols == 1) && (in_n_slices ==
out_n_cols) ) | |
| { | | { | |
| for(uword i=0; i < in_n_slices; ++i) | | for(uword i=0; i < in_n_slices; ++i) | |
| { | | { | |
| arrayops::inplace_div( out.colptr(i), in.slice_colptr(i, 0), in_n
_rows ); | | arrayops::inplace_div( out.colptr(i), in.slice_colptr(i, 0), in_n
_rows ); | |
| } | | } | |
| } | | } | |
| else | | else | |
|
| if( (in_n_rows == 1) && (in_n_cols == out_n_cols) && (in_n_slices ==
out_n_rows) ) | | if( (in_n_rows == 1) && (in_n_cols == out_n_rows) && (in_n_slices ==
out_n_cols) ) | |
| { | | { | |
| const Cube<eT>& Q = in.m; | | const Cube<eT>& Q = in.m; | |
| | | | |
| const uword in_aux_row1 = in.aux_row1; | | const uword in_aux_row1 = in.aux_row1; | |
| const uword in_aux_col1 = in.aux_col1; | | const uword in_aux_col1 = in.aux_col1; | |
| const uword in_aux_slice1 = in.aux_slice1; | | const uword in_aux_slice1 = in.aux_slice1; | |
| | | | |
|
| for(uword col=0; col < in_n_cols; ++col) | | for(uword slice=0; slice < in_n_slices; ++slice) | |
| { | | { | |
|
| eT* out_colptr = out.colptr(col); | | const uword mod_slice = in_aux_slice1 + slice; | |
| | | | |
| | | eT* out_colptr = out.colptr(slice); | |
| | | | |
| | | uword i,j; | |
| | | for(i=0, j=1; j < in_n_cols; i+=2, j+=2) | |
| | | { | |
| | | const eT tmp_i = Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); | |
| | | const eT tmp_j = Q.at(in_aux_row1, in_aux_col1 + j, mod_slice); | |
| | | | |
| | | out_colptr[i] /= tmp_i; | |
| | | out_colptr[j] /= tmp_j; | |
| | | } | |
| | | | |
|
| for(uword i=0; i < in_n_slices; ++i) | | if(i < in_n_cols) | |
| { | | { | |
|
| out_colptr[i] /= Q.at(in_aux_row1, in_aux_col1 + col, in_aux_sl
ice1 + i); | | out_colptr[i] /= Q.at(in_aux_row1, in_aux_col1 + i, mod_slice); | |
| } | | } | |
| } | | } | |
| } | | } | |
| } | | } | |
| else | | else | |
| { | | { | |
| eT* out_mem = out.memptr(); | | eT* out_mem = out.memptr(); | |
| | | | |
| const Cube<eT>& Q = in.m; | | const Cube<eT>& Q = in.m; | |
| | | | |
| | | | |
End of changes. 52 change blocks. |
| 65 lines changed or deleted | | 171 lines changed or added | |
|