| auxlib_meat.hpp | | auxlib_meat.hpp | |
| | | | |
| skipping to change at line 374 | | skipping to change at line 374 | |
| | | | |
| podarray<blas_int> ipiv(out.n_rows); | | podarray<blas_int> ipiv(out.n_rows); | |
| | | | |
| // 84 was empirically found -- it is the maximum value suggested by LAP
ACK (as provided by ATLAS v3.6) | | // 84 was empirically found -- it is the maximum value suggested by LAP
ACK (as provided by ATLAS v3.6) | |
| // based on tests with various matrix types on 32-bit and 64-bit machin
es | | // based on tests with various matrix types on 32-bit and 64-bit machin
es | |
| // | | // | |
| // the "work" array is deliberately long so that a secondary (time-cons
uming) | | // the "work" array is deliberately long so that a secondary (time-cons
uming) | |
| // memory allocation is avoided, if possible | | // memory allocation is avoided, if possible | |
| | | | |
| blas_int work_len = (std::max)(blas_int(1), n_rows*84); | | blas_int work_len = (std::max)(blas_int(1), n_rows*84); | |
|
| podarray<eT> work(work_len); | | podarray<eT> work( static_cast<u32>(work_len) ); | |
| | | | |
| lapack::getrf(&n_rows, &n_cols, out.memptr(), &n_rows, ipiv.memptr(), &
info); | | lapack::getrf(&n_rows, &n_cols, out.memptr(), &n_rows, ipiv.memptr(), &
info); | |
| | | | |
| if(info == 0) | | if(info == 0) | |
| { | | { | |
| // query for optimum size of work_len | | // query for optimum size of work_len | |
| | | | |
| blas_int work_len_tmp = -1; | | blas_int work_len_tmp = -1; | |
| lapack::getri(&n_rows, out.memptr(), &n_rows, ipiv.memptr(), work.mem
ptr(), &work_len_tmp, &info); | | lapack::getri(&n_rows, out.memptr(), &n_rows, ipiv.memptr(), work.mem
ptr(), &work_len_tmp, &info); | |
| | | | |
| if(info == 0) | | if(info == 0) | |
| { | | { | |
| blas_int proposed_work_len = static_cast<blas_int>(access::tmp_real
(work[0])); | | blas_int proposed_work_len = static_cast<blas_int>(access::tmp_real
(work[0])); | |
| | | | |
| // if necessary, allocate more memory | | // if necessary, allocate more memory | |
| if(work_len < proposed_work_len) | | if(work_len < proposed_work_len) | |
| { | | { | |
| work_len = proposed_work_len; | | work_len = proposed_work_len; | |
|
| work.set_size(work_len); | | work.set_size( static_cast<u32>(work_len) ); | |
| } | | } | |
| } | | } | |
| | | | |
| lapack::getri(&n_rows, out.memptr(), &n_rows, ipiv.memptr(), work.mem
ptr(), &work_len, &info); | | lapack::getri(&n_rows, out.memptr(), &n_rows, ipiv.memptr(), work.mem
ptr(), &work_len, &info); | |
| } | | } | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #else | | #else | |
| { | | { | |
| | | | |
| skipping to change at line 858 | | skipping to change at line 858 | |
| const blas_int* ipiv1_mem = ipiv1.memptr(); | | const blas_int* ipiv1_mem = ipiv1.memptr(); | |
| blas_int* ipiv2_mem = ipiv2.memptr(); | | blas_int* ipiv2_mem = ipiv2.memptr(); | |
| | | | |
| for(u32 i=0; i<P_rows; ++i) | | for(u32 i=0; i<P_rows; ++i) | |
| { | | { | |
| ipiv2_mem[i] = blas_int(i); | | ipiv2_mem[i] = blas_int(i); | |
| } | | } | |
| | | | |
| for(u32 i=0; i<n; ++i) | | for(u32 i=0; i<n; ++i) | |
| { | | { | |
|
| const u32 k = u32(ipiv1_mem[i]); | | const u32 k = static_cast<u32>(ipiv1_mem[i]); | |
| | | | |
| if( ipiv2_mem[i] != ipiv2_mem[k] ) | | if( ipiv2_mem[i] != ipiv2_mem[k] ) | |
| { | | { | |
| std::swap( ipiv2_mem[i], ipiv2_mem[k] ); | | std::swap( ipiv2_mem[i], ipiv2_mem[k] ); | |
| } | | } | |
| } | | } | |
| | | | |
| P.zeros(P_rows, P_rows); | | P.zeros(P_rows, P_rows); | |
| | | | |
| for(u32 row=0; row<P_rows; ++row) | | for(u32 row=0; row<P_rows; ++row) | |
| { | | { | |
|
| P.at(row, u32(ipiv2_mem[row])) = eT(1); | | P.at(row, static_cast<u32>(ipiv2_mem[row])) = eT(1); | |
| } | | } | |
| | | | |
| if(L.n_cols > U.n_rows) | | if(L.n_cols > U.n_rows) | |
| { | | { | |
| L.shed_cols(U.n_rows, L.n_cols-1); | | L.shed_cols(U.n_rows, L.n_cols-1); | |
| } | | } | |
| | | | |
| if(U.n_rows > L.n_cols) | | if(U.n_rows > L.n_cols) | |
| { | | { | |
| U.shed_rows(L.n_cols, U.n_rows-1); | | U.shed_rows(L.n_cols, U.n_rows-1); | |
| | | | |
| skipping to change at line 909 | | skipping to change at line 909 | |
| const blas_int* ipiv1_mem = ipiv1.memptr(); | | const blas_int* ipiv1_mem = ipiv1.memptr(); | |
| blas_int* ipiv2_mem = ipiv2.memptr(); | | blas_int* ipiv2_mem = ipiv2.memptr(); | |
| | | | |
| for(u32 i=0; i<P_rows; ++i) | | for(u32 i=0; i<P_rows; ++i) | |
| { | | { | |
| ipiv2_mem[i] = blas_int(i); | | ipiv2_mem[i] = blas_int(i); | |
| } | | } | |
| | | | |
| for(u32 i=0; i<n; ++i) | | for(u32 i=0; i<n; ++i) | |
| { | | { | |
|
| const u32 k = u32(ipiv1_mem[i]); | | const u32 k = static_cast<u32>(ipiv1_mem[i]); | |
| | | | |
| if( ipiv2_mem[i] != ipiv2_mem[k] ) | | if( ipiv2_mem[i] != ipiv2_mem[k] ) | |
| { | | { | |
| std::swap( ipiv2_mem[i], ipiv2_mem[k] ); | | std::swap( ipiv2_mem[i], ipiv2_mem[k] ); | |
|
| L.swap_rows( u32(ipiv2_mem[i]), u32(ipiv2_mem[k]) ); | | L.swap_rows( static_cast<u32>(ipiv2_mem[i]), static_cast<u32>(ipiv2_m
em[k]) ); | |
| } | | } | |
| } | | } | |
| | | | |
| if(L.n_cols > U.n_rows) | | if(L.n_cols > U.n_rows) | |
| { | | { | |
| L.shed_cols(U.n_rows, L.n_cols-1); | | L.shed_cols(U.n_rows, L.n_cols-1); | |
| } | | } | |
| | | | |
| if(U.n_rows > L.n_cols) | | if(U.n_rows > L.n_cols) | |
| { | | { | |
| | | | |
| skipping to change at line 952 | | skipping to change at line 952 | |
| | | | |
| // rudimentary "better-than-nothing" test for symmetry | | // rudimentary "better-than-nothing" test for symmetry | |
| //arma_debug_check( (A.at(A.n_rows-1, 0) != A.at(0, A.n_cols-1)), "auxl
ib::eig(): given matrix is not symmetric" ); | | //arma_debug_check( (A.at(A.n_rows-1, 0) != A.at(0, A.n_cols-1)), "auxl
ib::eig(): given matrix is not symmetric" ); | |
| | | | |
| char jobz = 'N'; | | char jobz = 'N'; | |
| char uplo = 'U'; | | char uplo = 'U'; | |
| | | | |
| blas_int n_rows = A.n_rows; | | blas_int n_rows = A.n_rows; | |
| blas_int lwork = (std::max)(blas_int(1), 3*n_rows-1); | | blas_int lwork = (std::max)(blas_int(1), 3*n_rows-1); | |
| | | | |
|
| eigval.set_size(n_rows); | | eigval.set_size(A.n_rows); | |
| podarray<eT> work(lwork); | | podarray<eT> work( static_cast<u32>(lwork) ); | |
| | | | |
| blas_int info; | | blas_int info; | |
| | | | |
| arma_extra_debug_print("lapack::syev()"); | | arma_extra_debug_print("lapack::syev()"); | |
| lapack::syev(&jobz, &uplo, &n_rows, A.memptr(), &n_rows, eigval.memptr(
), work.memptr(), &lwork, &info); | | lapack::syev(&jobz, &uplo, &n_rows, A.memptr(), &n_rows, eigval.memptr(
), work.memptr(), &lwork, &info); | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #else | | #else | |
| { | | { | |
| | | | |
| skipping to change at line 994 | | skipping to change at line 994 | |
| Mat<eT> A(X.get_ref()); | | Mat<eT> A(X.get_ref()); | |
| arma_debug_check( (A.is_square() == false), "eig_sym(): given matrix is
not hermitian"); | | arma_debug_check( (A.is_square() == false), "eig_sym(): given matrix is
not hermitian"); | |
| | | | |
| char jobz = 'N'; | | char jobz = 'N'; | |
| char uplo = 'U'; | | char uplo = 'U'; | |
| | | | |
| blas_int n_rows = A.n_rows; | | blas_int n_rows = A.n_rows; | |
| blas_int lda = A.n_rows; | | blas_int lda = A.n_rows; | |
| blas_int lwork = (std::max)(blas_int(1), 2*n_rows - 1); // TODO: auto
matically find best size of lwork | | blas_int lwork = (std::max)(blas_int(1), 2*n_rows - 1); // TODO: auto
matically find best size of lwork | |
| | | | |
|
| eigval.set_size(n_rows); | | eigval.set_size(A.n_rows); | |
| | | | |
|
| podarray<eT> work(lwork); | | podarray<eT> work( static_cast<u32>(lwork) ); | |
| podarray<T> rwork( (std::max)(blas_int(1), 3*n_rows - 2) ); | | podarray<T> rwork( static_cast<u32>((std::max)(blas_int(1), 3*n_rows - | |
| | | 2)) ); | |
| | | | |
| blas_int info; | | blas_int info; | |
| | | | |
| arma_extra_debug_print("lapack::heev()"); | | arma_extra_debug_print("lapack::heev()"); | |
| lapack::heev(&jobz, &uplo, &n_rows, A.memptr(), &lda, eigval.memptr(),
work.memptr(), &lwork, rwork.memptr(), &info); | | lapack::heev(&jobz, &uplo, &n_rows, A.memptr(), &lda, eigval.memptr(),
work.memptr(), &lwork, rwork.memptr(), &info); | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #else | | #else | |
| { | | { | |
| | | | |
| skipping to change at line 1039 | | skipping to change at line 1039 | |
| | | | |
| // rudimentary "better-than-nothing" test for symmetry | | // rudimentary "better-than-nothing" test for symmetry | |
| //arma_debug_check( (A.at(A.n_rows-1, 0) != A.at(0, A.n_cols-1)), "auxl
ib::eig(): given matrix is not symmetric" ); | | //arma_debug_check( (A.at(A.n_rows-1, 0) != A.at(0, A.n_cols-1)), "auxl
ib::eig(): given matrix is not symmetric" ); | |
| | | | |
| char jobz = 'V'; | | char jobz = 'V'; | |
| char uplo = 'U'; | | char uplo = 'U'; | |
| | | | |
| blas_int n_rows = eigvec.n_rows; | | blas_int n_rows = eigvec.n_rows; | |
| blas_int lwork = (std::max)(blas_int(1), 3*n_rows-1); | | blas_int lwork = (std::max)(blas_int(1), 3*n_rows-1); | |
| | | | |
|
| eigval.set_size(n_rows); | | eigval.set_size(eigvec.n_rows); | |
| podarray<eT> work(lwork); | | podarray<eT> work( static_cast<u32>(lwork) ); | |
| | | | |
| blas_int info; | | blas_int info; | |
| | | | |
| arma_extra_debug_print("lapack::syev()"); | | arma_extra_debug_print("lapack::syev()"); | |
| lapack::syev(&jobz, &uplo, &n_rows, eigvec.memptr(), &n_rows, eigval.me
mptr(), work.memptr(), &lwork, &info); | | lapack::syev(&jobz, &uplo, &n_rows, eigvec.memptr(), &n_rows, eigval.me
mptr(), work.memptr(), &lwork, &info); | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #else | | #else | |
| { | | { | |
| | | | |
| skipping to change at line 1083 | | skipping to change at line 1083 | |
| | | | |
| arma_debug_check( (eigvec.is_square() == false), "eig_sym(): given matr
ix is not hermitian" ); | | arma_debug_check( (eigvec.is_square() == false), "eig_sym(): given matr
ix is not hermitian" ); | |
| | | | |
| char jobz = 'V'; | | char jobz = 'V'; | |
| char uplo = 'U'; | | char uplo = 'U'; | |
| | | | |
| blas_int n_rows = eigvec.n_rows; | | blas_int n_rows = eigvec.n_rows; | |
| blas_int lda = eigvec.n_rows; | | blas_int lda = eigvec.n_rows; | |
| blas_int lwork = (std::max)(blas_int(1), 2*n_rows - 1); // TODO: auto
matically find best size of lwork | | blas_int lwork = (std::max)(blas_int(1), 2*n_rows - 1); // TODO: auto
matically find best size of lwork | |
| | | | |
|
| eigval.set_size(n_rows); | | eigval.set_size(eigvec.n_rows); | |
| | | | |
|
| podarray<eT> work(lwork); | | podarray<eT> work( static_cast<u32>(lwork) ); | |
| podarray<T> rwork( (std::max)(blas_int(1), 3*n_rows - 2) ); | | podarray<T> rwork( static_cast<u32>((std::max)(blas_int(1), 3*n_rows - | |
| | | 2)) ); | |
| | | | |
| blas_int info; | | blas_int info; | |
| | | | |
| arma_extra_debug_print("lapack::heev()"); | | arma_extra_debug_print("lapack::heev()"); | |
| lapack::heev(&jobz, &uplo, &n_rows, eigvec.memptr(), &lda, eigval.mempt
r(), work.memptr(), &lwork, rwork.memptr(), &info); | | lapack::heev(&jobz, &uplo, &n_rows, eigvec.memptr(), &lda, eigval.mempt
r(), work.memptr(), &lwork, rwork.memptr(), &info); | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #else | | #else | |
| { | | { | |
| | | | |
| skipping to change at line 1157 | | skipping to change at line 1157 | |
| | | | |
| case 'n': // neither | | case 'n': // neither | |
| jobvl = 'N'; | | jobvl = 'N'; | |
| jobvr = 'N'; | | jobvr = 'N'; | |
| break; | | break; | |
| | | | |
| default: | | default: | |
| arma_stop("eig_gen(): parameter 'side' is invalid"); | | arma_stop("eig_gen(): parameter 'side' is invalid"); | |
| } | | } | |
| | | | |
|
| blas_int n_rows = A.n_rows; | | u32 A_n_rows = A.n_rows; | |
| blas_int lda = A.n_rows; | | | |
| | | blas_int n_rows = A_n_rows; | |
| | | blas_int lda = A_n_rows; | |
| blas_int lwork = (std::max)(blas_int(1), 4*n_rows); // TODO: automati
cally find best size of lwork | | blas_int lwork = (std::max)(blas_int(1), 4*n_rows); // TODO: automati
cally find best size of lwork | |
| | | | |
|
| eigval.set_size(n_rows); | | eigval.set_size(A_n_rows); | |
| l_eigvec.set_size(n_rows, n_rows); | | l_eigvec.set_size(A_n_rows, A_n_rows); | |
| r_eigvec.set_size(n_rows, n_rows); | | r_eigvec.set_size(A_n_rows, A_n_rows); | |
| | | | |
|
| podarray<T> work(lwork); | | podarray<T> work( static_cast<u32>(lwork) ); | |
| podarray<T> rwork( (std::max)(blas_int(1), 3*n_rows) ); | | podarray<T> rwork( static_cast<u32>((std::max)(blas_int(1), 3*n_rows)) | |
| | | ); | |
| | | | |
|
| podarray<T> wr(n_rows); | | podarray<T> wr(A_n_rows); | |
| podarray<T> wi(n_rows); | | podarray<T> wi(A_n_rows); | |
| | | | |
| Mat<T> A_copy = A; | | Mat<T> A_copy = A; | |
| blas_int info; | | blas_int info; | |
| | | | |
| arma_extra_debug_print("lapack::geev()"); | | arma_extra_debug_print("lapack::geev()"); | |
| lapack::geev(&jobvl, &jobvr, &n_rows, A_copy.memptr(), &lda, wr.memptr(
), wi.memptr(), l_eigvec.memptr(), &n_rows, r_eigvec.memptr(), &n_rows, wor
k.memptr(), &lwork, &info); | | lapack::geev(&jobvl, &jobvr, &n_rows, A_copy.memptr(), &lda, wr.memptr(
), wi.memptr(), l_eigvec.memptr(), &n_rows, r_eigvec.memptr(), &n_rows, wor
k.memptr(), &lwork, &info); | |
| | | | |
|
| eigval.set_size(n_rows); | | eigval.set_size(A_n_rows); | |
| for(u32 i=0; i<u32(n_rows); ++i) | | for(u32 i=0; i<A_n_rows; ++i) | |
| { | | { | |
| eigval[i] = std::complex<T>(wr[i], wi[i]); | | eigval[i] = std::complex<T>(wr[i], wi[i]); | |
| } | | } | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #else | | #else | |
| { | | { | |
| arma_ignore(eigval); | | arma_ignore(eigval); | |
| arma_ignore(l_eigvec); | | arma_ignore(l_eigvec); | |
| | | | |
| skipping to change at line 1251 | | skipping to change at line 1253 | |
| | | | |
| case 'n': // neither | | case 'n': // neither | |
| jobvl = 'N'; | | jobvl = 'N'; | |
| jobvr = 'N'; | | jobvr = 'N'; | |
| break; | | break; | |
| | | | |
| default: | | default: | |
| arma_stop("eig_gen(): parameter 'side' is invalid"); | | arma_stop("eig_gen(): parameter 'side' is invalid"); | |
| } | | } | |
| | | | |
|
| blas_int n_rows = A.n_rows; | | u32 A_n_rows = A.n_rows; | |
| blas_int lda = A.n_rows; | | | |
| | | blas_int n_rows = A_n_rows; | |
| | | blas_int lda = A_n_rows; | |
| blas_int lwork = (std::max)(blas_int(1), 4*n_rows); // TODO: automati
cally find best size of lwork | | blas_int lwork = (std::max)(blas_int(1), 4*n_rows); // TODO: automati
cally find best size of lwork | |
| | | | |
|
| eigval.set_size(n_rows); | | eigval.set_size(A_n_rows); | |
| l_eigvec.set_size(n_rows, n_rows); | | l_eigvec.set_size(A_n_rows, A_n_rows); | |
| r_eigvec.set_size(n_rows, n_rows); | | r_eigvec.set_size(A_n_rows, A_n_rows); | |
| | | | |
|
| podarray<eT> work(lwork); | | podarray<eT> work( static_cast<u32>(lwork) ); | |
| podarray<T> rwork( (std::max)(blas_int(1), 3*n_rows) ); // was 2,3 | | podarray<T> rwork( static_cast<u32>((std::max)(blas_int(1), 3*n_rows)) | |
| | | ); // was 2,3 | |
| | | | |
| blas_int info; | | blas_int info; | |
| | | | |
| arma_extra_debug_print("lapack::cx_geev()"); | | arma_extra_debug_print("lapack::cx_geev()"); | |
| lapack::cx_geev(&jobvl, &jobvr, &n_rows, A.memptr(), &lda, eigval.mempt
r(), l_eigvec.memptr(), &n_rows, r_eigvec.memptr(), &n_rows, work.memptr(),
&lwork, rwork.memptr(), &info); | | lapack::cx_geev(&jobvl, &jobvr, &n_rows, A.memptr(), &lda, eigval.mempt
r(), l_eigvec.memptr(), &n_rows, r_eigvec.memptr(), &n_rows, work.memptr(),
&lwork, rwork.memptr(), &info); | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #else | | #else | |
| { | | { | |
| | | | |
| skipping to change at line 1352 | | skipping to change at line 1356 | |
| const u32 R_n_rows = R.n_rows; | | const u32 R_n_rows = R.n_rows; | |
| const u32 R_n_cols = R.n_cols; | | const u32 R_n_cols = R.n_cols; | |
| | | | |
| blas_int m = static_cast<blas_int>(R_n_rows); | | blas_int m = static_cast<blas_int>(R_n_rows); | |
| blas_int n = static_cast<blas_int>(R_n_cols); | | blas_int n = static_cast<blas_int>(R_n_cols); | |
| blas_int work_len = (std::max)(blas_int(1),n); | | blas_int work_len = (std::max)(blas_int(1),n); | |
| blas_int work_len_tmp; | | blas_int work_len_tmp; | |
| blas_int k = (std::min)(m,n); | | blas_int k = (std::min)(m,n); | |
| blas_int info; | | blas_int info; | |
| | | | |
|
| podarray<eT> tau(k); | | podarray<eT> tau( static_cast<u32>(k) ); | |
| podarray<eT> work(work_len); | | podarray<eT> work( static_cast<u32>(work_len) ); | |
| | | | |
| // query for the optimum value of work_len | | // query for the optimum value of work_len | |
| work_len_tmp = -1; | | work_len_tmp = -1; | |
| lapack::geqrf(&m, &n, R.memptr(), &m, tau.memptr(), work.memptr(), &wor
k_len_tmp, &info); | | lapack::geqrf(&m, &n, R.memptr(), &m, tau.memptr(), work.memptr(), &wor
k_len_tmp, &info); | |
| | | | |
| if(info == 0) | | if(info == 0) | |
| { | | { | |
| work_len = static_cast<blas_int>(access::tmp_real(work[0])); | | work_len = static_cast<blas_int>(access::tmp_real(work[0])); | |
|
| work.set_size(work_len); | | work.set_size( static_cast<u32>(work_len) ); | |
| } | | } | |
| | | | |
| lapack::geqrf(&m, &n, R.memptr(), &m, tau.memptr(), work.memptr(), &wor
k_len, &info); | | lapack::geqrf(&m, &n, R.memptr(), &m, tau.memptr(), work.memptr(), &wor
k_len, &info); | |
| | | | |
| Q.set_size(R_n_rows, R_n_rows); | | Q.set_size(R_n_rows, R_n_rows); | |
| | | | |
| arrayops::copy( Q.memptr(), R.memptr(), (std::min)(Q.n_elem, R.n_elem)
); | | arrayops::copy( Q.memptr(), R.memptr(), (std::min)(Q.n_elem, R.n_elem)
); | |
| | | | |
| // | | // | |
| // construct R | | // construct R | |
| | | | |
| skipping to change at line 1391 | | skipping to change at line 1395 | |
| | | | |
| if( (is_float<eT>::value == true) || (is_double<eT>::value == true) ) | | if( (is_float<eT>::value == true) || (is_double<eT>::value == true) ) | |
| { | | { | |
| // query for the optimum value of work_len | | // query for the optimum value of work_len | |
| work_len_tmp = -1; | | work_len_tmp = -1; | |
| lapack::orgqr(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr()
, &work_len_tmp, &info); | | lapack::orgqr(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr()
, &work_len_tmp, &info); | |
| | | | |
| if(info == 0) | | if(info == 0) | |
| { | | { | |
| work_len = static_cast<blas_int>(access::tmp_real(work[0])); | | work_len = static_cast<blas_int>(access::tmp_real(work[0])); | |
|
| work.set_size(work_len); | | work.set_size( static_cast<u32>(work_len) ); | |
| } | | } | |
| | | | |
| lapack::orgqr(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr()
, &work_len, &info); | | lapack::orgqr(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr()
, &work_len, &info); | |
| } | | } | |
| else | | else | |
| if( (is_supported_complex_float<eT>::value == true) || (is_supported_co
mplex_double<eT>::value == true) ) | | if( (is_supported_complex_float<eT>::value == true) || (is_supported_co
mplex_double<eT>::value == true) ) | |
| { | | { | |
| // query for the optimum value of work_len | | // query for the optimum value of work_len | |
| work_len_tmp = -1; | | work_len_tmp = -1; | |
| lapack::ungqr(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr()
, &work_len_tmp, &info); | | lapack::ungqr(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr()
, &work_len_tmp, &info); | |
| | | | |
| if(info == 0) | | if(info == 0) | |
| { | | { | |
| work_len = static_cast<blas_int>(access::tmp_real(work[0])); | | work_len = static_cast<blas_int>(access::tmp_real(work[0])); | |
|
| work.set_size(work_len); | | work.set_size( static_cast<u32>(work_len) ); | |
| } | | } | |
| | | | |
| lapack::ungqr(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr()
, &work_len, &info); | | lapack::ungqr(&m, &m, &k, Q.memptr(), &m, tau.memptr(), work.memptr()
, &work_len, &info); | |
| } | | } | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #else | | #else | |
| { | | { | |
| arma_ignore(Q); | | arma_ignore(Q); | |
| | | | |
| skipping to change at line 1459 | | skipping to change at line 1463 | |
| char jobvt = 'N'; | | char jobvt = 'N'; | |
| | | | |
| blas_int m = A.n_rows; | | blas_int m = A.n_rows; | |
| blas_int n = A.n_cols; | | blas_int n = A.n_cols; | |
| blas_int lda = A.n_rows; | | blas_int lda = A.n_rows; | |
| blas_int ldu = U.n_rows; | | blas_int ldu = U.n_rows; | |
| blas_int ldvt = V.n_rows; | | blas_int ldvt = V.n_rows; | |
| blas_int lwork = 2 * (std::max)(blas_int(1), (std::max)( (3*(std::min)
(m,n) + (std::max)(m,n)), 5*(std::min)(m,n) ) ); | | blas_int lwork = 2 * (std::max)(blas_int(1), (std::max)( (3*(std::min)
(m,n) + (std::max)(m,n)), 5*(std::min)(m,n) ) ); | |
| blas_int info; | | blas_int info; | |
| | | | |
|
| S.set_size( (std::min)(m, n) ); | | S.set_size( static_cast<u32>((std::min)(m, n)) ); | |
| | | | |
|
| podarray<eT> work(lwork); | | podarray<eT> work( static_cast<u32>(lwork) ); | |
| | | | |
| // let gesvd_() calculate the optimum size of the workspace | | // let gesvd_() calculate the optimum size of the workspace | |
| blas_int lwork_tmp = -1; | | blas_int lwork_tmp = -1; | |
| | | | |
| lapack::gesvd<eT> | | lapack::gesvd<eT> | |
| ( | | ( | |
| &jobu, &jobvt, | | &jobu, &jobvt, | |
| &m,&n, | | &m,&n, | |
| A.memptr(), &lda, | | A.memptr(), &lda, | |
| S.memptr(), | | S.memptr(), | |
| | | | |
| skipping to change at line 1485 | | skipping to change at line 1489 | |
| &info | | &info | |
| ); | | ); | |
| | | | |
| if(info == 0) | | if(info == 0) | |
| { | | { | |
| blas_int proposed_lwork = static_cast<blas_int>(work[0]); | | blas_int proposed_lwork = static_cast<blas_int>(work[0]); | |
| | | | |
| if(proposed_lwork > lwork) | | if(proposed_lwork > lwork) | |
| { | | { | |
| lwork = proposed_lwork; | | lwork = proposed_lwork; | |
|
| work.set_size(lwork); | | work.set_size( static_cast<u32>(lwork) ); | |
| } | | } | |
| | | | |
| lapack::gesvd<eT> | | lapack::gesvd<eT> | |
| ( | | ( | |
| &jobu, &jobvt, | | &jobu, &jobvt, | |
| &m, &n, | | &m, &n, | |
| A.memptr(), &lda, | | A.memptr(), &lda, | |
| S.memptr(), | | S.memptr(), | |
| U.memptr(), &ldu, | | U.memptr(), &ldu, | |
| V.memptr(), &ldvt, | | V.memptr(), &ldvt, | |
| | | | |
| skipping to change at line 1551 | | skipping to change at line 1555 | |
| char jobvt = 'N'; | | char jobvt = 'N'; | |
| | | | |
| blas_int m = A.n_rows; | | blas_int m = A.n_rows; | |
| blas_int n = A.n_cols; | | blas_int n = A.n_cols; | |
| blas_int lda = A.n_rows; | | blas_int lda = A.n_rows; | |
| blas_int ldu = U.n_rows; | | blas_int ldu = U.n_rows; | |
| blas_int ldvt = V.n_rows; | | blas_int ldvt = V.n_rows; | |
| blas_int lwork = 2 * (std::max)(blas_int(1), 2*(std::min)(m,n)+(std::m
ax)(m,n) ); | | blas_int lwork = 2 * (std::max)(blas_int(1), 2*(std::min)(m,n)+(std::m
ax)(m,n) ); | |
| blas_int info; | | blas_int info; | |
| | | | |
|
| S.set_size( (std::min)(m,n) ); | | S.set_size( static_cast<u32>((std::min)(m,n)) ); | |
| | | | |
|
| podarray<eT> work(lwork); | | podarray<eT> work( static_cast<u32>(lwork) ); | |
| podarray<T> rwork( 5*(std::min)(m,n) ); | | podarray<T> rwork( static_cast<u32>(5*(std::min)(m,n)) ); | |
| | | | |
| // let gesvd_() calculate the optimum size of the workspace | | // let gesvd_() calculate the optimum size of the workspace | |
| blas_int lwork_tmp = -1; | | blas_int lwork_tmp = -1; | |
| | | | |
| lapack::cx_gesvd<T> | | lapack::cx_gesvd<T> | |
| ( | | ( | |
| &jobu, &jobvt, | | &jobu, &jobvt, | |
| &m, &n, | | &m, &n, | |
| A.memptr(), &lda, | | A.memptr(), &lda, | |
| S.memptr(), | | S.memptr(), | |
| | | | |
| skipping to change at line 1578 | | skipping to change at line 1582 | |
| rwork.memptr(), | | rwork.memptr(), | |
| &info | | &info | |
| ); | | ); | |
| | | | |
| if(info == 0) | | if(info == 0) | |
| { | | { | |
| blas_int proposed_lwork = static_cast<blas_int>(real(work[0])); | | blas_int proposed_lwork = static_cast<blas_int>(real(work[0])); | |
| if(proposed_lwork > lwork) | | if(proposed_lwork > lwork) | |
| { | | { | |
| lwork = proposed_lwork; | | lwork = proposed_lwork; | |
|
| work.set_size(lwork); | | work.set_size( static_cast<u32>(lwork) ); | |
| } | | } | |
| | | | |
| lapack::cx_gesvd<T> | | lapack::cx_gesvd<T> | |
| ( | | ( | |
| &jobu, &jobvt, | | &jobu, &jobvt, | |
| &m, &n, | | &m, &n, | |
| A.memptr(), &lda, | | A.memptr(), &lda, | |
| S.memptr(), | | S.memptr(), | |
| U.memptr(), &ldu, | | U.memptr(), &ldu, | |
| V.memptr(), &ldvt, | | V.memptr(), &ldvt, | |
| | | | |
| skipping to change at line 1665 | | skipping to change at line 1669 | |
| char jobvt = 'A'; | | char jobvt = 'A'; | |
| | | | |
| blas_int m = A.n_rows; | | blas_int m = A.n_rows; | |
| blas_int n = A.n_cols; | | blas_int n = A.n_cols; | |
| blas_int lda = A.n_rows; | | blas_int lda = A.n_rows; | |
| blas_int ldu = U.n_rows; | | blas_int ldu = U.n_rows; | |
| blas_int ldvt = V.n_rows; | | blas_int ldvt = V.n_rows; | |
| blas_int lwork = 2 * (std::max)(blas_int(1), (std::max)( (3*(std::min)
(m,n) + (std::max)(m,n)), 5*(std::min)(m,n) ) ); | | blas_int lwork = 2 * (std::max)(blas_int(1), (std::max)( (3*(std::min)
(m,n) + (std::max)(m,n)), 5*(std::min)(m,n) ) ); | |
| blas_int info; | | blas_int info; | |
| | | | |
|
| S.set_size( (std::min)(m,n) ); | | S.set_size( static_cast<u32>((std::min)(m,n)) ); | |
| podarray<eT> work(lwork); | | podarray<eT> work( static_cast<u32>(lwork) ); | |
| | | | |
| // let gesvd_() calculate the optimum size of the workspace | | // let gesvd_() calculate the optimum size of the workspace | |
| blas_int lwork_tmp = -1; | | blas_int lwork_tmp = -1; | |
| | | | |
| lapack::gesvd<eT> | | lapack::gesvd<eT> | |
| ( | | ( | |
| &jobu, &jobvt, | | &jobu, &jobvt, | |
| &m, &n, | | &m, &n, | |
| A.memptr(), &lda, | | A.memptr(), &lda, | |
| S.memptr(), | | S.memptr(), | |
| | | | |
| skipping to change at line 1689 | | skipping to change at line 1693 | |
| work.memptr(), &lwork_tmp, | | work.memptr(), &lwork_tmp, | |
| &info | | &info | |
| ); | | ); | |
| | | | |
| if(info == 0) | | if(info == 0) | |
| { | | { | |
| blas_int proposed_lwork = static_cast<blas_int>(work[0]); | | blas_int proposed_lwork = static_cast<blas_int>(work[0]); | |
| if(proposed_lwork > lwork) | | if(proposed_lwork > lwork) | |
| { | | { | |
| lwork = proposed_lwork; | | lwork = proposed_lwork; | |
|
| work.set_size(lwork); | | work.set_size( static_cast<u32>(lwork) ); | |
| } | | } | |
| | | | |
| lapack::gesvd<eT> | | lapack::gesvd<eT> | |
| ( | | ( | |
| &jobu, &jobvt, | | &jobu, &jobvt, | |
| &m, &n, | | &m, &n, | |
| A.memptr(), &lda, | | A.memptr(), &lda, | |
| S.memptr(), | | S.memptr(), | |
| U.memptr(), &ldu, | | U.memptr(), &ldu, | |
| V.memptr(), &ldvt, | | V.memptr(), &ldvt, | |
| | | | |
| skipping to change at line 1756 | | skipping to change at line 1760 | |
| char jobvt = 'A'; | | char jobvt = 'A'; | |
| | | | |
| blas_int m = A.n_rows; | | blas_int m = A.n_rows; | |
| blas_int n = A.n_cols; | | blas_int n = A.n_cols; | |
| blas_int lda = A.n_rows; | | blas_int lda = A.n_rows; | |
| blas_int ldu = U.n_rows; | | blas_int ldu = U.n_rows; | |
| blas_int ldvt = V.n_rows; | | blas_int ldvt = V.n_rows; | |
| blas_int lwork = 2 * (std::max)(blas_int(1), 2*(std::min)(m,n)+(std::m
ax)(m,n) ); | | blas_int lwork = 2 * (std::max)(blas_int(1), 2*(std::min)(m,n)+(std::m
ax)(m,n) ); | |
| blas_int info; | | blas_int info; | |
| | | | |
|
| S.set_size( (std::min)(m,n) ); | | S.set_size( static_cast<u32>((std::min)(m,n)) ); | |
| | | | |
|
| podarray<eT> work(lwork); | | podarray<eT> work( static_cast<u32>(lwork) ); | |
| podarray<T> rwork( 5*(std::min)(m,n) ); | | podarray<T> rwork( static_cast<u32>(5*(std::min)(m,n)) ); | |
| | | | |
| // let gesvd_() calculate the optimum size of the workspace | | // let gesvd_() calculate the optimum size of the workspace | |
| blas_int lwork_tmp = -1; | | blas_int lwork_tmp = -1; | |
| lapack::cx_gesvd<T> | | lapack::cx_gesvd<T> | |
| ( | | ( | |
| &jobu, &jobvt, | | &jobu, &jobvt, | |
| &m, &n, | | &m, &n, | |
| A.memptr(), &lda, | | A.memptr(), &lda, | |
| S.memptr(), | | S.memptr(), | |
| U.memptr(), &ldu, | | U.memptr(), &ldu, | |
| | | | |
| skipping to change at line 1782 | | skipping to change at line 1786 | |
| rwork.memptr(), | | rwork.memptr(), | |
| &info | | &info | |
| ); | | ); | |
| | | | |
| if(info == 0) | | if(info == 0) | |
| { | | { | |
| blas_int proposed_lwork = static_cast<blas_int>(real(work[0])); | | blas_int proposed_lwork = static_cast<blas_int>(real(work[0])); | |
| if(proposed_lwork > lwork) | | if(proposed_lwork > lwork) | |
| { | | { | |
| lwork = proposed_lwork; | | lwork = proposed_lwork; | |
|
| work.set_size(lwork); | | work.set_size( static_cast<u32>(lwork) ); | |
| } | | } | |
| | | | |
| lapack::cx_gesvd<T> | | lapack::cx_gesvd<T> | |
| ( | | ( | |
| &jobu, &jobvt, | | &jobu, &jobvt, | |
| &m, &n, | | &m, &n, | |
| A.memptr(), &lda, | | A.memptr(), &lda, | |
| S.memptr(), | | S.memptr(), | |
| U.memptr(), &ldu, | | U.memptr(), &ldu, | |
| V.memptr(), &ldvt, | | V.memptr(), &ldvt, | |
| | | | |
| skipping to change at line 1833 | | skipping to change at line 1837 | |
| arma_extra_debug_sigprint(); | | arma_extra_debug_sigprint(); | |
| | | | |
| if(A.is_empty() || B.is_empty()) | | if(A.is_empty() || B.is_empty()) | |
| { | | { | |
| out.reset(); | | out.reset(); | |
| return false; | | return false; | |
| } | | } | |
| | | | |
| #if defined(ARMA_USE_LAPACK) | | #if defined(ARMA_USE_LAPACK) | |
| { | | { | |
|
| blas_int n = A.n_rows; | | u32 A_n_rows = A.n_rows; | |
| blas_int lda = A.n_rows; | | | |
| blas_int ldb = A.n_rows; | | blas_int n = A_n_rows; | |
| | | blas_int lda = A_n_rows; | |
| | | blas_int ldb = A_n_rows; | |
| blas_int nrhs = B.n_cols; | | blas_int nrhs = B.n_cols; | |
| blas_int info; | | blas_int info; | |
| | | | |
|
| podarray<blas_int> ipiv(n); | | podarray<blas_int> ipiv(A_n_rows); | |
| | | | |
| out = B; | | out = B; | |
| | | | |
| lapack::gesv<eT>(&n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.memptr
(), &ldb, &info); | | lapack::gesv<eT>(&n, &nrhs, A.memptr(), &lda, ipiv.memptr(), out.memptr
(), &ldb, &info); | |
| | | | |
| return (info == 0); | | return (info == 0); | |
| } | | } | |
| #else | | #else | |
| { | | { | |
| arma_ignore(out); | | arma_ignore(out); | |
| | | | |
| skipping to change at line 1887 | | skipping to change at line 1893 | |
| blas_int m = A.n_rows; | | blas_int m = A.n_rows; | |
| blas_int n = A.n_cols; | | blas_int n = A.n_cols; | |
| blas_int lda = A.n_rows; | | blas_int lda = A.n_rows; | |
| blas_int ldb = A.n_rows; | | blas_int ldb = A.n_rows; | |
| blas_int nrhs = B.n_cols; | | blas_int nrhs = B.n_cols; | |
| blas_int lwork = n + (std::max)(n, nrhs); | | blas_int lwork = n + (std::max)(n, nrhs); | |
| blas_int info; | | blas_int info; | |
| | | | |
| Mat<eT> tmp = B; | | Mat<eT> tmp = B; | |
| | | | |
|
| podarray<eT> work(lwork); | | podarray<eT> work( static_cast<u32>(lwork) ); | |
| | | | |
| arma_extra_debug_print("lapack::gels()"); | | arma_extra_debug_print("lapack::gels()"); | |
| | | | |
| // NOTE: the dgels() function in the lapack library supplied by ATLAS 3
.6 seems to have problems | | // NOTE: the dgels() function in the lapack library supplied by ATLAS 3
.6 seems to have problems | |
| | | | |
| lapack::gels<eT> | | lapack::gels<eT> | |
| ( | | ( | |
| &trans, &m, &n, &nrhs, | | &trans, &m, &n, &nrhs, | |
| A.memptr(), &lda, | | A.memptr(), &lda, | |
| tmp.memptr(), &ldb, | | tmp.memptr(), &ldb, | |
| | | | |
| skipping to change at line 1966 | | skipping to change at line 1972 | |
| eT* tmp_colmem = tmp.colptr(col); | | eT* tmp_colmem = tmp.colptr(col); | |
| | | | |
| arrayops::copy( tmp_colmem, B.colptr(col), B.n_rows ); | | arrayops::copy( tmp_colmem, B.colptr(col), B.n_rows ); | |
| | | | |
| for(u32 row=B.n_rows; row<A.n_cols; ++row) | | for(u32 row=B.n_rows; row<A.n_cols; ++row) | |
| { | | { | |
| tmp_colmem[row] = eT(0); | | tmp_colmem[row] = eT(0); | |
| } | | } | |
| } | | } | |
| | | | |
|
| podarray<eT> work(lwork); | | podarray<eT> work( static_cast<u32>(lwork) ); | |
| | | | |
| arma_extra_debug_print("lapack::gels()"); | | arma_extra_debug_print("lapack::gels()"); | |
| | | | |
| // NOTE: the dgels() function in the lapack library supplied by ATLAS 3
.6 seems to have problems | | // NOTE: the dgels() function in the lapack library supplied by ATLAS 3
.6 seems to have problems | |
| | | | |
| lapack::gels<eT> | | lapack::gels<eT> | |
| ( | | ( | |
| &trans, &m, &n, &nrhs, | | &trans, &m, &n, &nrhs, | |
| A.memptr(), &lda, | | A.memptr(), &lda, | |
| tmp.memptr(), &ldb, | | tmp.memptr(), &ldb, | |
| | | | |
End of changes. 39 change blocks. |
| 59 lines changed or deleted | | 69 lines changed or added | |
|
| blas_proto.hpp | | blas_proto.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_BLAS | | #ifdef ARMA_USE_BLAS | |
| | | | |
|
| | | #if !defined(ARMA_BLAS_CAPITALS) | |
| | | | |
| | | #define arma_sdot sdot | |
| | | #define arma_ddot ddot | |
| | | | |
| | | #define arma_sgemv sgemv | |
| | | #define arma_dgemv dgemv | |
| | | #define arma_cgemv cgemv | |
| | | #define arma_zgemv zgemv | |
| | | | |
| | | #define arma_sgemm sgemm | |
| | | #define arma_dgemm dgemm | |
| | | #define arma_cgemm cgemm | |
| | | #define arma_zgemm zgemm | |
| | | | |
| | | #else | |
| | | | |
| | | #define arma_sdot SDOT | |
| | | #define arma_ddot DDOT | |
| | | | |
| | | #define arma_sgemv SGEMV | |
| | | #define arma_dgemv DGEMV | |
| | | #define arma_cgemv CGEMV | |
| | | #define arma_zgemv ZGEMV | |
| | | | |
| | | #define arma_sgemm SGEMM | |
| | | #define arma_dgemm DGEMM | |
| | | #define arma_cgemm CGEMM | |
| | | #define arma_zgemm ZGEMM | |
| | | | |
| | | #endif | |
| | | | |
| //! \namespace blas namespace for BLAS functions | | //! \namespace blas namespace for BLAS functions | |
| namespace blas | | namespace blas | |
| { | | { | |
| extern "C" | | extern "C" | |
| { | | { | |
|
| float arma_fortran(sdot)(blas_int* n, const float* x, blas_int* incx, | | float arma_fortran(arma_sdot)(blas_int* n, const float* x, blas_int* | |
| const float* y, blas_int* incy); | | incx, const float* y, blas_int* incy); | |
| double arma_fortran(ddot)(blas_int* n, const double* x, blas_int* incx, | | double arma_fortran(arma_ddot)(blas_int* n, const double* x, blas_int* | |
| const double* y, blas_int* incy); | | incx, const double* y, blas_int* incy); | |
| | | | |
|
| void arma_fortran(sgemv)(const char* transA, const blas_int* m, const b | | void arma_fortran(arma_sgemv)(const char* transA, const blas_int* m, co | |
| las_int* n, const float* alpha, const float* A, const blas_int* ldA, cons | | nst blas_int* n, const float* alpha, const float* A, const blas_int* ldA, | |
| t float* x, const blas_int* incx, const float* beta, float* y, const bla | | const float* x, const blas_int* incx, const float* beta, float* y, cons | |
| s_int* incy); | | t blas_int* incy); | |
| void arma_fortran(dgemv)(const char* transA, const blas_int* m, const b | | void arma_fortran(arma_dgemv)(const char* transA, const blas_int* m, co | |
| las_int* n, const double* alpha, const double* A, const blas_int* ldA, cons | | nst blas_int* n, const double* alpha, const double* A, const blas_int* ldA, | |
| t double* x, const blas_int* incx, const double* beta, double* y, const bla | | const double* x, const blas_int* incx, const double* beta, double* y, cons | |
| s_int* incy); | | t blas_int* incy); | |
| void arma_fortran(cgemv)(const char* transA, const blas_int* m, const b | | void arma_fortran(arma_cgemv)(const char* transA, const blas_int* m, co | |
| las_int* n, const void* alpha, const void* A, const blas_int* ldA, cons | | nst blas_int* n, const void* alpha, const void* A, const blas_int* ldA, | |
| t void* x, const blas_int* incx, const void* beta, void* y, const bla | | const void* x, const blas_int* incx, const void* beta, void* y, cons | |
| s_int* incy); | | t blas_int* incy); | |
| void arma_fortran(zgemv)(const char* transA, const blas_int* m, const b | | void arma_fortran(arma_zgemv)(const char* transA, const blas_int* m, co | |
| las_int* n, const void* alpha, const void* A, const blas_int* ldA, cons | | nst blas_int* n, const void* alpha, const void* A, const blas_int* ldA, | |
| t void* x, const blas_int* incx, const void* beta, void* y, const bla | | const void* x, const blas_int* incx, const void* beta, void* y, cons | |
| s_int* incy); | | t blas_int* incy); | |
| | | | |
| void arma_fortran(sgemm)(const char* transA, const char* transB, const | | void arma_fortran(arma_sgemm)(const char* transA, const char* transB, c | |
| blas_int* m, const blas_int* n, const blas_int* k, const float* alpha, con | | onst blas_int* m, const blas_int* n, const blas_int* k, const float* alpha | |
| st float* A, const blas_int* ldA, const float* B, const blas_int* ldB, co | | , const float* A, const blas_int* ldA, const float* B, const blas_int* ld | |
| nst float* beta, float* C, const blas_int* ldC); | | B, const float* beta, float* C, const blas_int* ldC); | |
| void arma_fortran(dgemm)(const char* transA, const char* transB, const | | void arma_fortran(arma_dgemm)(const char* transA, const char* transB, c | |
| blas_int* m, const blas_int* n, const blas_int* k, const double* alpha, con | | onst blas_int* m, const blas_int* n, const blas_int* k, const double* alpha | |
| st double* A, const blas_int* ldA, const double* B, const blas_int* ldB, co | | , const double* A, const blas_int* ldA, const double* B, const blas_int* ld | |
| nst double* beta, double* C, const blas_int* ldC); | | B, const double* beta, double* C, const blas_int* ldC); | |
| void arma_fortran(cgemm)(const char* transA, const char* transB, const | | void arma_fortran(arma_cgemm)(const char* transA, const char* transB, c | |
| blas_int* m, const blas_int* n, const blas_int* k, const void* alpha, con | | onst blas_int* m, const blas_int* n, const blas_int* k, const void* alpha | |
| st void* A, const blas_int* ldA, const void* B, const blas_int* ldB, co | | , const void* A, const blas_int* ldA, const void* B, const blas_int* ld | |
| nst void* beta, void* C, const blas_int* ldC); | | B, const void* beta, void* C, const blas_int* ldC); | |
| void arma_fortran(zgemm)(const char* transA, const char* transB, const | | void arma_fortran(arma_zgemm)(const char* transA, const char* transB, c | |
| blas_int* m, const blas_int* n, const blas_int* k, const void* alpha, con | | onst blas_int* m, const blas_int* n, const blas_int* k, const void* alpha | |
| st void* A, const blas_int* ldA, const void* B, const blas_int* ldB, co | | , const void* A, const blas_int* ldA, const void* B, const blas_int* ld | |
| nst void* beta, void* C, const blas_int* ldC); | | B, const void* beta, void* C, const blas_int* ldC); | |
| | | | |
| // void arma_fortran(dswap)(const blas_int* n, double* x, const blas_ | | // void arma_fortran(arma_dswap)(const blas_int* n, double* x, const | |
| int* incx, double* y, const blas_int* incy); | | blas_int* incx, double* y, const blas_int* incy); | |
| // void arma_fortran(dscal)(const blas_int* n, const double* alpha, d | | // void arma_fortran(arma_dscal)(const blas_int* n, const double* alp | |
| ouble* x, const blas_int* incx); | | ha, double* x, const blas_int* incx); | |
| // void arma_fortran(dcopy)(const blas_int* n, const double* x, const | | // void arma_fortran(arma_dcopy)(const blas_int* n, const double* x, | |
| blas_int* incx, double* y, const blas_int* incy); | | const blas_int* incx, double* y, const blas_int* incy); | |
| // void arma_fortran(daxpy)(const blas_int* n, const double* alpha, c | | // void arma_fortran(arma_daxpy)(const blas_int* n, const double* alp | |
| onst double* x, const blas_int* incx, double* y, const blas_int* incy); | | ha, const double* x, const blas_int* incx, double* y, const blas_int* incy) | |
| // void arma_fortran(dger)(const blas_int* m, const blas_int* n, con | | ; | |
| st double* alpha, const double* x, const blas_int* incx, const double* y, c | | // void arma_fortran(arma_dger )(const blas_int* m, const blas_int* n | |
| onst blas_int* incy, double* A, const blas_int* ldA); | | , 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> | | template<typename eT> | |
| inline | | inline | |
| eT | | eT | |
| dot(const u32 n_elem, const eT* x, const eT* y) | | dot(const u32 n_elem, const eT* x, const eT* y) | |
| { | | { | |
| arma_ignore(n_elem); | | arma_ignore(n_elem); | |
| arma_ignore(x); | | arma_ignore(x); | |
| arma_ignore(y); | | arma_ignore(y); | |
| | | | |
| skipping to change at line 60 | | skipping to change at line 92 | |
| } | | } | |
| | | | |
| template<> | | template<> | |
| inline | | inline | |
| float | | float | |
| dot(const u32 n_elem, const float* x, const float* y) | | dot(const u32 n_elem, const float* x, const float* y) | |
| { | | { | |
| blas_int n = blas_int(n_elem); | | blas_int n = blas_int(n_elem); | |
| blas_int inc = blas_int(1); | | blas_int inc = blas_int(1); | |
| | | | |
|
| return arma_fortran(sdot)(&n, x, &inc, y, &inc); | | return arma_fortran(arma_sdot)(&n, x, &inc, y, &inc); | |
| } | | } | |
| | | | |
| template<> | | template<> | |
| inline | | inline | |
| double | | double | |
| dot(const u32 n_elem, const double* x, const double* y) | | dot(const u32 n_elem, const double* x, const double* y) | |
| { | | { | |
| blas_int n = blas_int(n_elem); | | blas_int n = blas_int(n_elem); | |
| blas_int inc = blas_int(1); | | blas_int inc = blas_int(1); | |
| | | | |
|
| return arma_fortran(ddot)(&n, x, &inc, y, &inc); | | return arma_fortran(arma_ddot)(&n, x, &inc, y, &inc); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | 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) | | 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>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_fortran(sgemv)(transA, m, n, (const T*)alpha, (const T*)A, ldA,
(const T*)x, incx, (const T*)beta, (T*)y, incy); | | 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 | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_fortran(dgemv)(transA, m, n, (const T*)alpha, (const T*)A, ldA,
(const T*)x, incx, (const T*)beta, (T*)y, incy); | | 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 | | else | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef std::complex<float> T; | | typedef std::complex<float> T; | |
|
| arma_fortran(cgemv)(transA, m, n, (const T*)alpha, (const T*)A, ldA,
(const T*)x, incx, (const T*)beta, (T*)y, incy); | | 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 | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef std::complex<double> T; | | typedef std::complex<double> T; | |
|
| arma_fortran(zgemv)(transA, m, n, (const T*)alpha, (const T*)A, ldA,
(const T*)x, incx, (const T*)beta, (T*)y, incy); | | 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> | | template<typename eT> | |
| inline | | inline | |
| void | | 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) | | 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>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_fortran(sgemm)(transA, transB, m, n, k, (const T*)alpha, (const
T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC); | | 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 | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_fortran(dgemm)(transA, transB, m, n, k, (const T*)alpha, (const
T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC); | | 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 | | else | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef std::complex<float> T; | | typedef std::complex<float> T; | |
|
| arma_fortran(cgemm)(transA, transB, m, n, k, (const T*)alpha, (const
T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC); | | 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 | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef std::complex<double> T; | | typedef std::complex<double> T; | |
|
| arma_fortran(zgemm)(transA, transB, m, n, k, (const T*)alpha, (const
T*)A, ldA, (const T*)B, ldB, (const T*)beta, (T*)C, ldC); | | 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); | |
| } | | } | |
| | | | |
| } | | } | |
| | | | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 14 change blocks. |
| 61 lines changed or deleted | | 94 lines changed or added | |
|
| lapack_proto.hpp | | lapack_proto.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 | |
| // Copyright (C) 2009 Edmund Highcock | | // Copyright (C) 2009 Edmund Highcock | |
| // | | // | |
| // 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_LAPACK | | #ifdef ARMA_USE_LAPACK | |
| | | | |
|
| | | #if !defined(ARMA_BLAS_CAPITALS) | |
| | | | |
| | | #define arma_sgetrf sgetrf | |
| | | #define arma_dgetrf dgetrf | |
| | | #define arma_cgetrf cgetrf | |
| | | #define arma_zgetrf zgetrf | |
| | | | |
| | | #define arma_sgetri sgetri | |
| | | #define arma_dgetri dgetri | |
| | | #define arma_cgetri cgetri | |
| | | #define arma_zgetri zgetri | |
| | | | |
| | | #define arma_strtri strtri | |
| | | #define arma_dtrtri dtrtri | |
| | | #define arma_ctrtri ctrtri | |
| | | #define arma_ztrtri ztrtri | |
| | | | |
| | | #define arma_ssyev ssyev | |
| | | #define arma_dsyev dsyev | |
| | | | |
| | | #define arma_cheev cheev | |
| | | #define arma_zheev zheev | |
| | | | |
| | | #define arma_sgeev sgeev | |
| | | #define arma_dgeev dgeev | |
| | | | |
| | | #define arma_cgeev cgeev | |
| | | #define arma_zgeev zgeev | |
| | | | |
| | | #define arma_spotrf spotrf | |
| | | #define arma_dpotrf dpotrf | |
| | | #define arma_cpotrf cpotrf | |
| | | #define arma_zpotrf zpotrf | |
| | | | |
| | | #define arma_sgeqrf sgeqrf | |
| | | #define arma_dgeqrf dgeqrf | |
| | | #define arma_cgeqrf cgeqrf | |
| | | #define arma_zgeqrf zgeqrf | |
| | | | |
| | | #define arma_sorgqr sorgqr | |
| | | #define arma_dorgqr dorgqr | |
| | | | |
| | | #define arma_cungqr cungqr | |
| | | #define arma_zungqr zungqr | |
| | | | |
| | | #define arma_sgesvd sgesvd | |
| | | #define arma_dgesvd dgesvd | |
| | | | |
| | | #define arma_cgesvd cgesvd | |
| | | #define arma_zgesvd zgesvd | |
| | | | |
| | | #define arma_sgesv sgesv | |
| | | #define arma_dgesv dgesv | |
| | | #define arma_cgesv cgesv | |
| | | #define arma_zgesv zgesv | |
| | | | |
| | | #define arma_sgels sgels | |
| | | #define arma_dgels dgels | |
| | | #define arma_cgels cgels | |
| | | #define arma_zgels zgels | |
| | | | |
| | | #define arma_strtrs strtrs | |
| | | #define arma_dtrtrs dtrtrs | |
| | | #define arma_ctrtrs ctrtrs | |
| | | #define arma_ztrtrs ztrtrs | |
| | | | |
| | | #else | |
| | | | |
| | | #define arma_sgetrf SGETRF | |
| | | #define arma_dgetrf DGETRF | |
| | | #define arma_cgetrf CGETRF | |
| | | #define arma_zgetrf ZGETRF | |
| | | | |
| | | #define arma_sgetri SGETRI | |
| | | #define arma_dgetri DGETRI | |
| | | #define arma_cgetri CGETRI | |
| | | #define arma_zgetri ZGETRI | |
| | | | |
| | | #define arma_strtri STRTRI | |
| | | #define arma_dtrtri DTRTRI | |
| | | #define arma_ctrtri CTRTRI | |
| | | #define arma_ztrtri ZTRTRI | |
| | | | |
| | | #define arma_ssyev SSYEV | |
| | | #define arma_dsyev DSYEV | |
| | | | |
| | | #define arma_cheev CHEEV | |
| | | #define arma_zheev ZHEEV | |
| | | | |
| | | #define arma_sgeev SGEEV | |
| | | #define arma_dgeev DGEEV | |
| | | | |
| | | #define arma_cgeev CGEEV | |
| | | #define arma_zgeev ZGEEV | |
| | | | |
| | | #define arma_spotrf SPOTRF | |
| | | #define arma_dpotrf DPOTRF | |
| | | #define arma_cpotrf CPOTRF | |
| | | #define arma_zpotrf ZPOTRF | |
| | | | |
| | | #define arma_sgeqrf SGEQRF | |
| | | #define arma_dgeqrf DGEQRF | |
| | | #define arma_cgeqrf CGEQRF | |
| | | #define arma_zgeqrf ZGEQRF | |
| | | | |
| | | #define arma_sorgqr SORGQR | |
| | | #define arma_dorgqr DORGQR | |
| | | | |
| | | #define arma_cungqr CUNGQR | |
| | | #define arma_zungqr ZUNGQR | |
| | | | |
| | | #define arma_sgesvd SGESVD | |
| | | #define arma_dgesvd DGESVD | |
| | | | |
| | | #define arma_cgesvd CGESVD | |
| | | #define arma_zgesvd ZGESVD | |
| | | | |
| | | #define arma_sgesv SGESV | |
| | | #define arma_dgesv DGESV | |
| | | #define arma_cgesv CGESV | |
| | | #define arma_zgesv ZGESV | |
| | | | |
| | | #define arma_sgels SGELS | |
| | | #define arma_dgels DGELS | |
| | | #define arma_cgels CGELS | |
| | | #define arma_zgels ZGELS | |
| | | | |
| | | #define arma_strtrs STRTRS | |
| | | #define arma_dtrtrs DTRTRS | |
| | | #define arma_ctrtrs CTRTRS | |
| | | #define arma_ztrtrs ZTRTRS | |
| | | | |
| | | #endif | |
| | | | |
| //! \namespace lapack namespace for LAPACK functions | | //! \namespace lapack namespace for LAPACK functions | |
| namespace lapack | | namespace lapack | |
| { | | { | |
| //! \addtogroup LAPACK | | //! \addtogroup LAPACK | |
| //! @{ | | //! @{ | |
| | | | |
| extern "C" | | extern "C" | |
| { | | { | |
| // LU factorisation | | // LU factorisation | |
|
| void arma_fortran(sgetrf)(blas_int* m, blas_int* n, float* a, blas_int | | void arma_fortran(arma_sgetrf)(blas_int* m, blas_int* n, float* a, bla | |
| * lda, blas_int* ipiv, blas_int* info); | | s_int* lda, blas_int* ipiv, blas_int* info); | |
| void arma_fortran(dgetrf)(blas_int* m, blas_int* n, double* a, blas_int | | void arma_fortran(arma_dgetrf)(blas_int* m, blas_int* n, double* a, bla | |
| * lda, blas_int* ipiv, blas_int* info); | | s_int* lda, blas_int* ipiv, blas_int* info); | |
| void arma_fortran(cgetrf)(blas_int* m, blas_int* n, void* a, blas_int | | void arma_fortran(arma_cgetrf)(blas_int* m, blas_int* n, void* a, bla | |
| * lda, blas_int* ipiv, blas_int* info); | | s_int* lda, blas_int* ipiv, blas_int* info); | |
| void arma_fortran(zgetrf)(blas_int* m, blas_int* n, void* a, blas_int | | void arma_fortran(arma_zgetrf)(blas_int* m, blas_int* n, void* a, bla | |
| * lda, blas_int* ipiv, blas_int* info); | | s_int* lda, blas_int* ipiv, blas_int* info); | |
| | | | |
| // matrix inversion (using LU factorisation result) | | // matrix inversion (using LU factorisation result) | |
|
| void arma_fortran(sgetri)(blas_int* n, float* a, blas_int* lda, blas_i | | void arma_fortran(arma_sgetri)(blas_int* n, float* a, blas_int* lda, b | |
| nt* ipiv, float* work, blas_int* lwork, blas_int* info); | | las_int* ipiv, float* work, blas_int* lwork, blas_int* info); | |
| void arma_fortran(dgetri)(blas_int* n, double* a, blas_int* lda, blas_i | | void arma_fortran(arma_dgetri)(blas_int* n, double* a, blas_int* lda, b | |
| nt* ipiv, double* work, blas_int* lwork, blas_int* info); | | las_int* ipiv, double* work, blas_int* lwork, blas_int* info); | |
| void arma_fortran(cgetri)(blas_int* n, void* a, blas_int* lda, blas_i | | void arma_fortran(arma_cgetri)(blas_int* n, void* a, blas_int* lda, b | |
| nt* ipiv, void* work, blas_int* lwork, blas_int* info); | | las_int* ipiv, void* work, blas_int* lwork, blas_int* info); | |
| void arma_fortran(zgetri)(blas_int* n, void* a, blas_int* lda, blas_i | | void arma_fortran(arma_zgetri)(blas_int* n, void* a, blas_int* lda, b | |
| nt* ipiv, void* work, blas_int* lwork, blas_int* info); | | las_int* ipiv, void* work, blas_int* lwork, blas_int* info); | |
| | | | |
| // matrix inversion (triangular matrices) | | // matrix inversion (triangular matrices) | |
|
| void arma_fortran(strtri)(char* uplo, char* diag, blas_int* n, float* | | void arma_fortran(arma_strtri)(char* uplo, char* diag, blas_int* n, fl | |
| a, blas_int* lda, blas_int* info); | | oat* a, blas_int* lda, blas_int* info); | |
| void arma_fortran(dtrtri)(char* uplo, char* diag, blas_int* n, double* | | void arma_fortran(arma_dtrtri)(char* uplo, char* diag, blas_int* n, dou | |
| a, blas_int* lda, blas_int* info); | | ble* a, blas_int* lda, blas_int* info); | |
| void arma_fortran(ctrtri)(char* uplo, char* diag, blas_int* n, void* | | void arma_fortran(arma_ctrtri)(char* uplo, char* diag, blas_int* n, v | |
| a, blas_int* lda, blas_int* info); | | oid* a, blas_int* lda, blas_int* info); | |
| void arma_fortran(ztrtri)(char* uplo, char* diag, blas_int* n, void* | | void arma_fortran(arma_ztrtri)(char* uplo, char* diag, blas_int* n, v | |
| a, blas_int* lda, blas_int* info); | | oid* a, blas_int* lda, blas_int* info); | |
| | | | |
| // eigenvector decomposition of symmetric real matrices | | // eigenvector decomposition of symmetric real matrices | |
|
| void arma_fortran(ssyev)(char* jobz, char* uplo, blas_int* n, float* a | | void arma_fortran(arma_ssyev)(char* jobz, char* uplo, blas_int* n, flo | |
| , blas_int* lda, float* w, float* work, blas_int* lwork, blas_int* info); | | at* a, blas_int* lda, float* w, float* work, blas_int* lwork, blas_int* i | |
| void arma_fortran(dsyev)(char* jobz, char* uplo, blas_int* n, double* a | | nfo); | |
| , blas_int* lda, double* w, double* work, blas_int* lwork, blas_int* info); | | void arma_fortran(arma_dsyev)(char* jobz, char* uplo, blas_int* n, doub | |
| | | le* a, blas_int* lda, double* w, double* work, blas_int* lwork, blas_int* i | |
| | | nfo); | |
| | | | |
| // eigenvector decomposition of hermitian matrices (complex) | | // eigenvector decomposition of hermitian matrices (complex) | |
|
| void arma_fortran(cheev)(char* jobz, char* uplo, blas_int* n, void* a | | void arma_fortran(arma_cheev)(char* jobz, char* uplo, blas_int* n, vo | |
| , blas_int* lda, float* w, void* work, blas_int* lwork, float* rwork, b | | id* a, blas_int* lda, float* w, void* work, blas_int* lwork, float* rwo | |
| las_int* info); | | rk, blas_int* info); | |
| void arma_fortran(zheev)(char* jobz, char* uplo, blas_int* n, void* a | | void arma_fortran(arma_zheev)(char* jobz, char* uplo, blas_int* n, vo | |
| , blas_int* lda, double* w, void* work, blas_int* lwork, double* rwork, b | | id* a, blas_int* lda, double* w, void* work, blas_int* lwork, double* rwo | |
| las_int* info); | | rk, blas_int* info); | |
| | | | |
| // eigenvector decomposition of general real matrices | | // eigenvector decomposition of general real matrices | |
|
| void arma_fortran(sgeev)(char* jobvl, char* jobvr, blas_int* n, float* | | void arma_fortran(arma_sgeev)(char* jobvl, char* jobvr, blas_int* n, f | |
| a, blas_int* lda, float* wr, float* wi, float* vl, blas_int* ldvl, flo | | loat* a, blas_int* lda, float* wr, float* wi, float* vl, blas_int* ldvl, | |
| at* vr, blas_int* ldvr, float* work, blas_int* lwork, blas_int* info); | | float* vr, blas_int* ldvr, float* work, blas_int* lwork, blas_int* info) | |
| void arma_fortran(dgeev)(char* jobvl, char* jobvr, blas_int* n, double* | | ; | |
| a, blas_int* lda, double* wr, double* wi, double* vl, blas_int* ldvl, doub | | void arma_fortran(arma_dgeev)(char* jobvl, char* jobvr, blas_int* n, do | |
| le* vr, blas_int* ldvr, double* work, blas_int* lwork, blas_int* info); | | uble* a, blas_int* lda, double* wr, double* wi, double* vl, blas_int* ldvl, | |
| | | double* vr, blas_int* ldvr, double* work, blas_int* lwork, blas_int* info) | |
| | | ; | |
| | | | |
| // eigenvector decomposition of general complex matrices | | // eigenvector decomposition of general complex matrices | |
|
| void arma_fortran(cgeev)(char* jobvr, char* jobvl, blas_int* n, void* a | | void arma_fortran(arma_cgeev)(char* jobvr, char* jobvl, blas_int* n, vo | |
| , blas_int* lda, void* w, void* vl, blas_int* ldvl, void* vr, blas_int* ldv | | id* a, blas_int* lda, void* w, void* vl, blas_int* ldvl, void* vr, blas_int | |
| r, void* work, blas_int* lwork, float* rwork, blas_int* info); | | * ldvr, void* work, blas_int* lwork, float* rwork, blas_int* info); | |
| void arma_fortran(zgeev)(char* jobvl, char* jobvr, blas_int* n, void* a | | void arma_fortran(arma_zgeev)(char* jobvl, char* jobvr, blas_int* n, vo | |
| , blas_int* lda, void* w, void* vl, blas_int* ldvl, void* vr, blas_int* ldv | | id* a, blas_int* lda, void* w, void* vl, blas_int* ldvl, void* vr, blas_int | |
| r, void* work, blas_int* lwork, double* rwork, blas_int* info); | | * ldvr, void* work, blas_int* lwork, double* rwork, blas_int* info); | |
| | | | |
| // Cholesky decomposition | | // Cholesky decomposition | |
|
| void arma_fortran(spotrf)(char* uplo, blas_int* n, float* a, blas_int* | | void arma_fortran(arma_spotrf)(char* uplo, blas_int* n, float* a, blas | |
| lda, blas_int* info); | | _int* lda, blas_int* info); | |
| void arma_fortran(dpotrf)(char* uplo, blas_int* n, double* a, blas_int* | | void arma_fortran(arma_dpotrf)(char* uplo, blas_int* n, double* a, blas | |
| lda, blas_int* info); | | _int* lda, blas_int* info); | |
| void arma_fortran(cpotrf)(char* uplo, blas_int* n, void* a, blas_int* | | void arma_fortran(arma_cpotrf)(char* uplo, blas_int* n, void* a, blas | |
| lda, blas_int* info); | | _int* lda, blas_int* info); | |
| void arma_fortran(zpotrf)(char* uplo, blas_int* n, void* a, blas_int* | | void arma_fortran(arma_zpotrf)(char* uplo, blas_int* n, void* a, blas | |
| lda, blas_int* info); | | _int* lda, blas_int* info); | |
| | | | |
| // QR decomposition | | // QR decomposition | |
|
| void arma_fortran(sgeqrf)(blas_int* m, blas_int* n, float* a, blas_int | | void arma_fortran(arma_sgeqrf)(blas_int* m, blas_int* n, float* a, bla | |
| * lda, float* tau, float* work, blas_int* lwork, blas_int* info); | | s_int* lda, float* tau, float* work, blas_int* lwork, blas_int* info); | |
| void arma_fortran(dgeqrf)(blas_int* m, blas_int* n, double* a, blas_int | | void arma_fortran(arma_dgeqrf)(blas_int* m, blas_int* n, double* a, bla | |
| * lda, double* tau, double* work, blas_int* lwork, blas_int* info); | | s_int* lda, double* tau, double* work, blas_int* lwork, blas_int* info); | |
| void arma_fortran(cgeqrf)(blas_int* m, blas_int* n, void* a, blas_int | | void arma_fortran(arma_cgeqrf)(blas_int* m, blas_int* n, void* a, bla | |
| * lda, void* tau, void* work, blas_int* lwork, blas_int* info); | | s_int* lda, void* tau, void* work, blas_int* lwork, blas_int* info); | |
| void arma_fortran(zgeqrf)(blas_int* m, blas_int* n, void* a, blas_int | | void arma_fortran(arma_zgeqrf)(blas_int* m, blas_int* n, void* a, bla | |
| * lda, void* tau, void* work, blas_int* lwork, blas_int* info); | | s_int* lda, void* tau, void* work, blas_int* lwork, blas_int* info); | |
| | | | |
| // Q matrix calculation from QR decomposition (real matrices) | | // Q matrix calculation from QR decomposition (real matrices) | |
|
| void arma_fortran(sorgqr)(blas_int* m, blas_int* n, blas_int* k, float | | void arma_fortran(arma_sorgqr)(blas_int* m, blas_int* n, blas_int* k, | |
| * a, blas_int* lda, float* tau, float* work, blas_int* lwork, blas_int* i | | float* a, blas_int* lda, float* tau, float* work, blas_int* lwork, blas_i | |
| nfo); | | nt* info); | |
| void arma_fortran(dorgqr)(blas_int* m, blas_int* n, blas_int* k, double | | void arma_fortran(arma_dorgqr)(blas_int* m, blas_int* n, blas_int* k, d | |
| * a, blas_int* lda, double* tau, double* work, blas_int* lwork, blas_int* i | | ouble* a, blas_int* lda, double* tau, double* work, blas_int* lwork, blas_i | |
| nfo); | | nt* info); | |
| | | | |
| // Q matrix calculation from QR decomposition (complex matrices) | | // Q matrix calculation from QR decomposition (complex matrices) | |
|
| void arma_fortran(cungqr)(blas_int* m, blas_int* n, blas_int* k, void | | void arma_fortran(arma_cungqr)(blas_int* m, blas_int* n, blas_int* k, | |
| * a, blas_int* lda, void* tau, void* work, blas_int* lwork, blas_int* i | | void* a, blas_int* lda, void* tau, void* work, blas_int* lwork, blas_i | |
| nfo); | | nt* info); | |
| void arma_fortran(zungqr)(blas_int* m, blas_int* n, blas_int* k, void | | void arma_fortran(arma_zungqr)(blas_int* m, blas_int* n, blas_int* k, | |
| * a, blas_int* lda, void* tau, void* work, blas_int* lwork, blas_int* i | | void* a, blas_int* lda, void* tau, void* work, blas_int* lwork, blas_i | |
| nfo); | | nt* info); | |
| | | | |
| // SVD (real matrices) | | // SVD (real matrices) | |
|
| void arma_fortran(sgesvd)(char* jobu, char* jobvt, blas_int* m, blas_in | | void arma_fortran(arma_sgesvd)(char* jobu, char* jobvt, blas_int* m, bl | |
| t* n, float* a, blas_int* lda, float* s, float* u, blas_int* ldu, float* | | as_int* n, float* a, blas_int* lda, float* s, float* u, blas_int* ldu, f | |
| vt, blas_int* ldvt, float* work, blas_int* lwork, blas_int* info); | | loat* vt, blas_int* ldvt, float* work, blas_int* lwork, blas_int* info); | |
| void arma_fortran(dgesvd)(char* jobu, char* jobvt, blas_int* m, blas_in | | void arma_fortran(arma_dgesvd)(char* jobu, char* jobvt, blas_int* m, bl | |
| t* n, double* a, blas_int* lda, double* s, double* u, blas_int* ldu, double | | as_int* n, double* a, blas_int* lda, double* s, double* u, blas_int* ldu, d | |
| * vt, blas_int* ldvt, double* work, blas_int* lwork, blas_int* info); | | ouble* vt, blas_int* ldvt, double* work, blas_int* lwork, blas_int* info); | |
| | | | |
| // SVD (complex matrices) | | // SVD (complex matrices) | |
|
| void arma_fortran(cgesvd)(char* jobu, char* jobvt, blas_int* m, blas_in | | void arma_fortran(arma_cgesvd)(char* jobu, char* jobvt, blas_int* m, bl | |
| t* n, void* a, blas_int* lda, float* s, void* u, blas_int* ldu, void* | | as_int* n, void* a, blas_int* lda, float* s, void* u, blas_int* ldu, v | |
| vt, blas_int* ldvt, void* work, blas_int* lwork, float* rwork, blas_in | | oid* vt, blas_int* ldvt, void* work, blas_int* lwork, float* rwork, bl | |
| t* info); | | as_int* info); | |
| void arma_fortran(zgesvd)(char* jobu, char* jobvt, blas_int* m, blas_in | | void arma_fortran(arma_zgesvd)(char* jobu, char* jobvt, blas_int* m, bl | |
| t* n, void* a, blas_int* lda, double* s, void* u, blas_int* ldu, void* | | as_int* n, void* a, blas_int* lda, double* s, void* u, blas_int* ldu, v | |
| vt, blas_int* ldvt, void* work, blas_int* lwork, double* rwork, blas_in | | oid* vt, blas_int* ldvt, void* work, blas_int* lwork, double* rwork, bl | |
| t* info); | | as_int* info); | |
| | | | |
| // solve system of linear equations, using LU decomposition | | // solve system of linear equations, using LU decomposition | |
|
| void arma_fortran(sgesv)(blas_int* n, blas_int* nrhs, float* a, blas_i | | void arma_fortran(arma_sgesv)(blas_int* n, blas_int* nrhs, float* a, b | |
| nt* lda, blas_int* ipiv, float* b, blas_int* ldb, blas_int* info); | | las_int* lda, blas_int* ipiv, float* b, blas_int* ldb, blas_int* info); | |
| void arma_fortran(dgesv)(blas_int* n, blas_int* nrhs, double* a, blas_i | | void arma_fortran(arma_dgesv)(blas_int* n, blas_int* nrhs, double* a, b | |
| nt* lda, blas_int* ipiv, double* b, blas_int* ldb, blas_int* info); | | las_int* lda, blas_int* ipiv, double* b, blas_int* ldb, blas_int* info); | |
| void arma_fortran(cgesv)(blas_int* n, blas_int* nrhs, void* a, blas_i | | void arma_fortran(arma_cgesv)(blas_int* n, blas_int* nrhs, void* a, b | |
| nt* lda, blas_int* ipiv, void* b, blas_int* ldb, blas_int* info); | | las_int* lda, blas_int* ipiv, void* b, blas_int* ldb, blas_int* info); | |
| void arma_fortran(zgesv)(blas_int* n, blas_int* nrhs, void* a, blas_i | | void arma_fortran(arma_zgesv)(blas_int* n, blas_int* nrhs, void* a, b | |
| nt* lda, blas_int* ipiv, void* b, blas_int* ldb, blas_int* info); | | las_int* lda, blas_int* ipiv, void* b, blas_int* ldb, blas_int* info); | |
| | | | |
| // solve over/underdetermined system of linear equations | | // solve over/underdetermined system of linear equations | |
|
| void arma_fortran(sgels)(char* trans, blas_int* m, blas_int* n, blas_in | | void arma_fortran(arma_sgels)(char* trans, blas_int* m, blas_int* n, bl | |
| t* nrhs, float* a, blas_int* lda, float* b, blas_int* ldb, float* work, | | as_int* nrhs, float* a, blas_int* lda, float* b, blas_int* ldb, float* w | |
| blas_int* lwork, blas_int* info); | | ork, blas_int* lwork, blas_int* info); | |
| void arma_fortran(dgels)(char* trans, blas_int* m, blas_int* n, blas_in | | void arma_fortran(arma_dgels)(char* trans, blas_int* m, blas_int* n, bl | |
| t* nrhs, double* a, blas_int* lda, double* b, blas_int* ldb, double* work, | | as_int* nrhs, double* a, blas_int* lda, double* b, blas_int* ldb, double* w | |
| blas_int* lwork, blas_int* info); | | ork, blas_int* lwork, blas_int* info); | |
| void arma_fortran(cgels)(char* trans, blas_int* m, blas_int* n, blas_in | | void arma_fortran(arma_cgels)(char* trans, blas_int* m, blas_int* n, bl | |
| t* nrhs, void* a, blas_int* lda, void* b, blas_int* ldb, void* work, | | as_int* nrhs, void* a, blas_int* lda, void* b, blas_int* ldb, void* w | |
| blas_int* lwork, blas_int* info); | | ork, blas_int* lwork, blas_int* info); | |
| void arma_fortran(zgels)(char* trans, blas_int* m, blas_int* n, blas_in | | void arma_fortran(arma_zgels)(char* trans, blas_int* m, blas_int* n, bl | |
| t* nrhs, void* a, blas_int* lda, void* b, blas_int* ldb, void* work, | | as_int* nrhs, void* a, blas_int* lda, void* b, blas_int* ldb, void* w | |
| blas_int* lwork, blas_int* info); | | ork, blas_int* lwork, blas_int* info); | |
| | | | |
| // solve a triangular system of linear equations | | // solve a triangular system of linear equations | |
|
| void arma_fortran(strtrs)(char* uplo, char* trans, char* diag, blas_int | | void arma_fortran(arma_strtrs)(char* uplo, char* trans, char* diag, bla | |
| * n, blas_int* nrhs, const float* a, blas_int* lda, float* b, blas_int* l | | s_int* n, blas_int* nrhs, const float* a, blas_int* lda, float* b, blas_i | |
| db, blas_int* info); | | nt* ldb, blas_int* info); | |
| void arma_fortran(dtrtrs)(char* uplo, char* trans, char* diag, blas_int | | void arma_fortran(arma_dtrtrs)(char* uplo, char* trans, char* diag, bla | |
| * n, blas_int* nrhs, const double* a, blas_int* lda, double* b, blas_int* l | | s_int* n, blas_int* nrhs, const double* a, blas_int* lda, double* b, blas_i | |
| db, blas_int* info); | | nt* ldb, blas_int* info); | |
| void arma_fortran(ctrtrs)(char* uplo, char* trans, char* diag, blas_int | | void arma_fortran(arma_ctrtrs)(char* uplo, char* trans, char* diag, bla | |
| * n, blas_int* nrhs, const void* a, blas_int* lda, void* b, blas_int* l | | s_int* n, blas_int* nrhs, const void* a, blas_int* lda, void* b, blas_i | |
| db, blas_int* info); | | nt* ldb, blas_int* info); | |
| void arma_fortran(ztrtrs)(char* uplo, char* trans, char* diag, blas_int | | void arma_fortran(arma_ztrtrs)(char* uplo, char* trans, char* diag, bla | |
| * n, blas_int* nrhs, const void* a, blas_int* lda, void* b, blas_int* l | | s_int* n, blas_int* nrhs, const void* a, blas_int* lda, void* b, blas_i | |
| db, blas_int* info); | | nt* ldb, blas_int* info); | |
| | | | |
| // void arma_fortran(dgeqp3)(blas_int* m, blas_int* n, double* a, blas_ | | // void arma_fortran(arma_dgeqp3)(blas_int* m, blas_int* n, double* a, | |
| int* lda, blas_int* jpvt, double* tau, double* work, blas_int* lwork, blas_ | | blas_int* lda, blas_int* jpvt, double* tau, double* work, blas_int* lwork, | |
| int* info); | | blas_int* info); | |
| // void arma_fortran(dormqr)(char* side, char* trans, blas_int* m, blas | | // void arma_fortran(arma_dormqr)(char* side, char* trans, blas_int* m, | |
| _int* n, blas_int* k, double* a, blas_int* lda, double* tau, double* c, bla | | blas_int* n, blas_int* k, double* a, blas_int* lda, double* tau, double* c | |
| s_int* ldc, double* work, blas_int* lwork, blas_int* info); | | , blas_int* ldc, double* work, blas_int* lwork, blas_int* info); | |
| // void arma_fortran(dposv)(char* uplo, blas_int* n, blas_int* nrhs, d | | // void arma_fortran(arma_dposv)(char* uplo, blas_int* n, blas_int* nr | |
| ouble* a, blas_int* lda, double* b, blas_int* ldb, blas_int* info); | | hs, double* a, blas_int* lda, double* b, blas_int* ldb, blas_int* info); | |
| // void arma_fortran(dgees)(char* jobvs, char* sort, blas_int* select, | | // void arma_fortran(arma_dgees)(char* jobvs, char* sort, blas_int* se | |
| blas_int* n, double* a, blas_int* lda, blas_int* sdim, double* wr, double* | | lect, blas_int* n, double* a, blas_int* lda, blas_int* sdim, double* wr, do | |
| wi, double* vs, blas_int* ldvs, double* work, blas_int* lwork, blas_int* b | | uble* wi, double* vs, blas_int* ldvs, double* work, blas_int* lwork, blas_i | |
| work, blas_int* info); | | nt* bwork, blas_int* info); | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| getrf(blas_int* m, blas_int* n, eT* a, blas_int* lda, blas_int* ipiv, bla
s_int* info) | | 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>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_fortran(sgetrf)(m, n, (T*)a, lda, ipiv, info); | | arma_fortran(arma_sgetrf)(m, n, (T*)a, lda, ipiv, info); | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_fortran(dgetrf)(m, n, (T*)a, lda, ipiv, info); | | arma_fortran(arma_dgetrf)(m, n, (T*)a, lda, ipiv, info); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef std::complex<float> T; | | typedef std::complex<float> T; | |
|
| arma_fortran(cgetrf)(m, n, (T*)a, lda, ipiv, info); | | arma_fortran(arma_cgetrf)(m, n, (T*)a, lda, ipiv, info); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef std::complex<double> T; | | typedef std::complex<double> T; | |
|
| arma_fortran(zgetrf)(m, n, (T*)a, lda, ipiv, info); | | arma_fortran(arma_zgetrf)(m, n, (T*)a, lda, ipiv, info); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| getri(blas_int* n, eT* a, blas_int* lda, blas_int* ipiv, eT* work, blas_
int* lwork, blas_int* info) | | 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>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_fortran(sgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info); | | arma_fortran(arma_sgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info)
; | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_fortran(dgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info); | | arma_fortran(arma_dgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info)
; | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef std::complex<float> T; | | typedef std::complex<float> T; | |
|
| arma_fortran(cgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info); | | arma_fortran(arma_cgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info)
; | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef std::complex<double> T; | | typedef std::complex<double> T; | |
|
| arma_fortran(zgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info); | | arma_fortran(arma_zgetri)(n, (T*)a, lda, ipiv, (T*)work, lwork, info)
; | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| trtri(char* uplo, char* diag, blas_int* n, eT* a, blas_int* lda, blas_int
* info) | | 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>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_fortran(strtri)(uplo, diag, n, (T*)a, lda, info); | | arma_fortran(arma_strtri)(uplo, diag, n, (T*)a, lda, info); | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_fortran(dtrtri)(uplo, diag, n, (T*)a, lda, info); | | arma_fortran(arma_dtrtri)(uplo, diag, n, (T*)a, lda, info); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef std::complex<float> T; | | typedef std::complex<float> T; | |
|
| arma_fortran(ctrtri)(uplo, diag, n, (T*)a, lda, info); | | arma_fortran(arma_ctrtri)(uplo, diag, n, (T*)a, lda, info); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef std::complex<double> T; | | typedef std::complex<double> T; | |
|
| arma_fortran(ztrtri)(uplo, diag, n, (T*)a, lda, info); | | arma_fortran(arma_ztrtri)(uplo, diag, n, (T*)a, lda, info); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | 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) | | 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>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_fortran(ssyev)(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, lwork
, info); | | arma_fortran(arma_ssyev)(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work,
lwork, info); | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_fortran(dsyev)(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work, lwork
, info); | | arma_fortran(arma_dsyev)(jobz, uplo, n, (T*)a, lda, (T*)w, (T*)work,
lwork, info); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| heev | | heev | |
| ( | | ( | |
| char* jobz, char* uplo, blas_int* n, | | char* jobz, char* uplo, blas_int* n, | |
| eT* a, blas_int* lda, typename eT::value_type* w, | | eT* a, blas_int* lda, typename eT::value_type* w, | |
| eT* work, blas_int* lwork, typename eT::value_type* rwork, | | eT* work, blas_int* lwork, typename eT::value_type* rwork, | |
| blas_int* info | | blas_int* info | |
| ) | | ) | |
| { | | { | |
| arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
| typedef typename std::complex<T> cx_T; | | typedef typename std::complex<T> cx_T; | |
|
| arma_fortran(cheev)(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*)work,
lwork, (T*)rwork, info); | | arma_fortran(arma_cheev)(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*)
work, lwork, (T*)rwork, info); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
| typedef typename std::complex<T> cx_T; | | typedef typename std::complex<T> cx_T; | |
|
| arma_fortran(zheev)(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*)work,
lwork, (T*)rwork, info); | | arma_fortran(arma_zheev)(jobz, uplo, n, (cx_T*)a, lda, (T*)w, (cx_T*)
work, lwork, (T*)rwork, info); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| geev | | geev | |
| ( | | ( | |
| char* jobvl, char* jobvr, blas_int* n, | | char* jobvl, char* jobvr, blas_int* n, | |
| eT* a, blas_int* lda, eT* wr, eT* wi, eT* vl, | | eT* a, blas_int* lda, eT* wr, eT* wi, eT* vl, | |
| blas_int* ldvl, eT* vr, blas_int* ldvr, | | blas_int* ldvl, eT* vr, blas_int* ldvr, | |
| eT* work, blas_int* lwork, | | eT* work, blas_int* lwork, | |
| blas_int* info | | blas_int* info | |
| ) | | ) | |
| { | | { | |
| arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_fortran(sgeev)(jobvl, jobvr, n, (T*)a, lda, (T*)wr, (T*)wi, (T*
)vl, ldvl, (T*)vr, ldvr, (T*)work, lwork, info); | | 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 | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_fortran(dgeev)(jobvl, jobvr, n, (T*)a, lda, (T*)wr, (T*)wi, (T*
)vl, ldvl, (T*)vr, ldvr, (T*)work, lwork, info); | | 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> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| cx_geev | | cx_geev | |
| ( | | ( | |
| char* jobvl, char* jobvr, blas_int* n, | | char* jobvl, char* jobvr, blas_int* n, | |
| eT* a, blas_int* lda, eT* w, | | eT* a, blas_int* lda, eT* w, | |
| | | | |
| skipping to change at line 300 | | skipping to change at line 434 | |
| eT* work, blas_int* lwork, typename eT::value_type* rwork, | | eT* work, blas_int* lwork, typename eT::value_type* rwork, | |
| blas_int* info | | blas_int* info | |
| ) | | ) | |
| { | | { | |
| arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
| typedef typename std::complex<T> cx_T; | | typedef typename std::complex<T> cx_T; | |
|
| arma_fortran(cgeev)(jobvl, jobvr, n, (cx_T*)a, lda, (cx_T*)w, (cx_T*)
vl, ldvl, (cx_T*)vr, ldvr, (cx_T*)work, lwork, (T*)rwork, info); | | 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 | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
| typedef typename std::complex<T> cx_T; | | typedef typename std::complex<T> cx_T; | |
|
| arma_fortran(zgeev)(jobvl, jobvr, n, (cx_T*)a, lda, (cx_T*)w, (cx_T*)
vl, ldvl, (cx_T*)vr, ldvr, (cx_T*)work, lwork, (T*)rwork, info); | | 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> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| potrf(char* uplo, blas_int* n, eT* a, blas_int* lda, blas_int* info) | | potrf(char* uplo, blas_int* n, eT* a, blas_int* lda, blas_int* info) | |
| { | | { | |
| arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_fortran(spotrf)(uplo, n, (T*)a, lda, info); | | arma_fortran(arma_spotrf)(uplo, n, (T*)a, lda, info); | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_fortran(dpotrf)(uplo, n, (T*)a, lda, info); | | arma_fortran(arma_dpotrf)(uplo, n, (T*)a, lda, info); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef std::complex<float> T; | | typedef std::complex<float> T; | |
|
| arma_fortran(cpotrf)(uplo, n, (T*)a, lda, info); | | arma_fortran(arma_cpotrf)(uplo, n, (T*)a, lda, info); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef std::complex<double> T; | | typedef std::complex<double> T; | |
|
| arma_fortran(zpotrf)(uplo, n, (T*)a, lda, info); | | arma_fortran(arma_zpotrf)(uplo, n, (T*)a, lda, info); | |
| } | | } | |
| | | | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| geqrf(blas_int* m, blas_int* n, eT* a, blas_int* lda, eT* tau, eT* work,
blas_int* lwork, blas_int* info) | | 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>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_fortran(sgeqrf)(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork, info
); | | arma_fortran(arma_sgeqrf)(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork,
info); | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_fortran(dgeqrf)(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork, info
); | | arma_fortran(arma_dgeqrf)(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork,
info); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef std::complex<float> T; | | typedef std::complex<float> T; | |
|
| arma_fortran(cgeqrf)(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork, info
); | | arma_fortran(arma_cgeqrf)(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork,
info); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef std::complex<double> T; | | typedef std::complex<double> T; | |
|
| arma_fortran(zgeqrf)(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork, info
); | | arma_fortran(arma_zgeqrf)(m, n, (T*)a, lda, (T*)tau, (T*)work, lwork,
info); | |
| } | | } | |
| | | | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | 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) | | 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>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_fortran(sorgqr)(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwork, i
nfo); | | arma_fortran(arma_sorgqr)(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwo
rk, info); | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_fortran(dorgqr)(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwork, i
nfo); | | arma_fortran(arma_dorgqr)(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwo
rk, info); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | 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) | | 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>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_fortran(cungqr)(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwork, i
nfo); | | arma_fortran(arma_cungqr)(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwo
rk, info); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_fortran(zungqr)(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwork, i
nfo); | | arma_fortran(arma_zungqr)(m, n, k, (T*)a, lda, (T*)tau, (T*)work, lwo
rk, info); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | void | |
| gesvd | | gesvd | |
| ( | | ( | |
| char* jobu, char* jobvt, blas_int* m, blas_int* n, eT* a, blas_int* lda
, | | 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* s, eT* u, blas_int* ldu, eT* vt, blas_int* ldvt, | |
| eT* work, blas_int* lwork, blas_int* info | | eT* work, blas_int* lwork, blas_int* info | |
| ) | | ) | |
| { | | { | |
| arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_fortran(sgesvd)(jobu, jobvt, m, n, (T*)a, lda, (T*)s, (T*)u, ldu
, (T*)vt, ldvt, (T*)work, lwork, info); | | arma_fortran(arma_sgesvd)(jobu, jobvt, m, n, (T*)a, lda, (T*)s, (T*)u
, ldu, (T*)vt, ldvt, (T*)work, lwork, info); | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_fortran(dgesvd)(jobu, jobvt, m, n, (T*)a, lda, (T*)s, (T*)u, ldu
, (T*)vt, ldvt, (T*)work, lwork, info); | | 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> | | template<typename T> | |
| inline | | inline | |
| void | | void | |
| cx_gesvd | | cx_gesvd | |
| ( | | ( | |
| char* jobu, char* jobvt, blas_int* m, blas_int* n, std::complex<T>* a,
blas_int* lda, | | 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, | | 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 | | std::complex<T>* work, blas_int* lwork, T* rwork, blas_int* info | |
| ) | | ) | |
| { | | { | |
| arma_type_check<is_supported_blas_type<T>::value == false>::apply(); | | arma_type_check<is_supported_blas_type<T>::value == false>::apply(); | |
| arma_type_check<is_supported_blas_type< std::complex<T> >::value == fal
se>::apply(); | | arma_type_check<is_supported_blas_type< std::complex<T> >::value == fal
se>::apply(); | |
| | | | |
| if(is_float<T>::value == true) | | if(is_float<T>::value == true) | |
| { | | { | |
| typedef float bT; | | typedef float bT; | |
|
| arma_fortran(cgesvd) | | arma_fortran(arma_cgesvd) | |
| ( | | ( | |
| jobu, jobvt, m, n, (std::complex<bT>*)a, lda, | | jobu, jobvt, m, n, (std::complex<bT>*)a, lda, | |
| (bT*)s, (std::complex<bT>*)u, ldu, (std::complex<bT>*)vt, ldvt, | | (bT*)s, (std::complex<bT>*)u, ldu, (std::complex<bT>*)vt, ldvt, | |
| (std::complex<bT>*)work, lwork, (bT*)rwork, info | | (std::complex<bT>*)work, lwork, (bT*)rwork, info | |
| ); | | ); | |
| } | | } | |
| else | | else | |
| if(is_double<T>::value == true) | | if(is_double<T>::value == true) | |
| { | | { | |
| typedef double bT; | | typedef double bT; | |
|
| arma_fortran(zgesvd) | | arma_fortran(arma_zgesvd) | |
| ( | | ( | |
| jobu, jobvt, m, n, (std::complex<bT>*)a, lda, | | jobu, jobvt, m, n, (std::complex<bT>*)a, lda, | |
| (bT*)s, (std::complex<bT>*)u, ldu, (std::complex<bT>*)vt, ldvt, | | (bT*)s, (std::complex<bT>*)u, ldu, (std::complex<bT>*)vt, ldvt, | |
| (std::complex<bT>*)work, lwork, (bT*)rwork, info | | (std::complex<bT>*)work, lwork, (bT*)rwork, info | |
| ); | | ); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | 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) | | 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>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_fortran(sgesv)(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); | | arma_fortran(arma_sgesv)(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info)
; | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_fortran(dgesv)(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); | | arma_fortran(arma_dgesv)(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info)
; | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef std::complex<float> T; | | typedef std::complex<float> T; | |
|
| arma_fortran(cgesv)(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); | | arma_fortran(arma_cgesv)(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info)
; | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef std::complex<double> T; | | typedef std::complex<double> T; | |
|
| arma_fortran(zgesv)(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info); | | arma_fortran(arma_zgesv)(n, nrhs, (T*)a, lda, ipiv, (T*)b, ldb, info)
; | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | 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) | | 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>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_fortran(sgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)wo
rk, lwork, info); | | arma_fortran(arma_sgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (
T*)work, lwork, info); | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_fortran(dgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)wo
rk, lwork, info); | | arma_fortran(arma_dgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (
T*)work, lwork, info); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef std::complex<float> T; | | typedef std::complex<float> T; | |
|
| arma_fortran(cgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)wo
rk, lwork, info); | | arma_fortran(arma_cgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (
T*)work, lwork, info); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef std::complex<double> T; | | typedef std::complex<double> T; | |
|
| arma_fortran(zgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (T*)wo
rk, lwork, info); | | arma_fortran(arma_zgels)(trans, m, n, nrhs, (T*)a, lda, (T*)b, ldb, (
T*)work, lwork, info); | |
| } | | } | |
| } | | } | |
| | | | |
| template<typename eT> | | template<typename eT> | |
| inline | | inline | |
| void | | 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) | | 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>::apply(); | | arma_type_check<is_supported_blas_type<eT>::value == false>::apply(); | |
| | | | |
| if(is_float<eT>::value == true) | | if(is_float<eT>::value == true) | |
| { | | { | |
| typedef float T; | | typedef float T; | |
|
| arma_fortran(strtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*)b, l
db, info); | | arma_fortran(arma_strtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*
)b, ldb, info); | |
| } | | } | |
| else | | else | |
| if(is_double<eT>::value == true) | | if(is_double<eT>::value == true) | |
| { | | { | |
| typedef double T; | | typedef double T; | |
|
| arma_fortran(dtrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*)b, l
db, info); | | arma_fortran(arma_dtrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*
)b, ldb, info); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_float<eT>::value == true) | | if(is_supported_complex_float<eT>::value == true) | |
| { | | { | |
| typedef std::complex<float> T; | | typedef std::complex<float> T; | |
|
| arma_fortran(ctrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*)b, l
db, info); | | arma_fortran(arma_ctrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*
)b, ldb, info); | |
| } | | } | |
| else | | else | |
| if(is_supported_complex_double<eT>::value == true) | | if(is_supported_complex_double<eT>::value == true) | |
| { | | { | |
| typedef std::complex<double> T; | | typedef std::complex<double> T; | |
|
| arma_fortran(ztrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*)b, l
db, info); | | arma_fortran(arma_ztrtrs)(uplo, trans, diag, n, nrhs, (T*)a, lda, (T*
)b, ldb, info); | |
| } | | } | |
| } | | } | |
| | | | |
| //! @} | | //! @} | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 66 change blocks. |
| 183 lines changed or deleted | | 321 lines changed or added | |
|