remove use of ATLAS
This commit is contained in:
@@ -55,7 +55,6 @@ set(ARMA_USE_WRAPPER true)
|
||||
|
||||
set(ARMA_USE_LAPACK false)
|
||||
set(ARMA_USE_BLAS false)
|
||||
set(ARMA_USE_ATLAS false)
|
||||
set(ARMA_USE_HDF5_ALT false)
|
||||
set(ARMA_USE_ARPACK false)
|
||||
set(ARMA_USE_EXTERN_RNG false)
|
||||
@@ -326,7 +325,6 @@ else()
|
||||
|
||||
include(ARMA_FindMKL)
|
||||
include(ARMA_FindOpenBLAS)
|
||||
include(ARMA_FindATLAS)
|
||||
include(ARMA_FindBLAS)
|
||||
include(ARMA_FindLAPACK)
|
||||
|
||||
@@ -336,7 +334,6 @@ else()
|
||||
|
||||
message(STATUS " MKL_FOUND = ${MKL_FOUND}" )
|
||||
message(STATUS " OpenBLAS_FOUND = ${OpenBLAS_FOUND}" )
|
||||
message(STATUS " ATLAS_FOUND = ${ATLAS_FOUND}" )
|
||||
message(STATUS " BLAS_FOUND = ${BLAS_FOUND}" )
|
||||
message(STATUS " LAPACK_FOUND = ${LAPACK_FOUND}" )
|
||||
|
||||
@@ -379,11 +376,6 @@ else()
|
||||
|
||||
else()
|
||||
|
||||
if(OpenBLAS_FOUND AND ATLAS_FOUND)
|
||||
message(STATUS "")
|
||||
message(STATUS "*** NOTE: found both OpenBLAS and ATLAS; ATLAS will not be used")
|
||||
endif()
|
||||
|
||||
if(OpenBLAS_FOUND AND BLAS_FOUND)
|
||||
message(STATUS "")
|
||||
message(STATUS "*** NOTE: found both OpenBLAS and BLAS; BLAS will not be used")
|
||||
@@ -413,14 +405,6 @@ else()
|
||||
|
||||
else()
|
||||
|
||||
if(ATLAS_FOUND)
|
||||
set(ARMA_USE_ATLAS true)
|
||||
set(ARMA_ATLAS_INCLUDE_DIR ${ATLAS_INCLUDE_DIR})
|
||||
set(ARMA_LIBS ${ARMA_LIBS} ${ATLAS_LIBRARIES})
|
||||
|
||||
message(STATUS "ATLAS_INCLUDE_DIR = ${ATLAS_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
if(BLAS_FOUND)
|
||||
set(ARMA_USE_BLAS true)
|
||||
set(ARMA_LIBS ${ARMA_LIBS} ${BLAS_LIBRARIES})
|
||||
@@ -533,7 +517,6 @@ message(STATUS "*** Result of configuration:")
|
||||
message(STATUS "*** ARMA_USE_WRAPPER = ${ARMA_USE_WRAPPER}")
|
||||
message(STATUS "*** ARMA_USE_LAPACK = ${ARMA_USE_LAPACK}")
|
||||
message(STATUS "*** ARMA_USE_BLAS = ${ARMA_USE_BLAS}")
|
||||
message(STATUS "*** ARMA_USE_ATLAS = ${ARMA_USE_ATLAS}")
|
||||
message(STATUS "*** ARMA_USE_HDF5_ALT = ${ARMA_USE_HDF5_ALT}")
|
||||
message(STATUS "*** ARMA_USE_ARPACK = ${ARMA_USE_ARPACK}")
|
||||
message(STATUS "*** ARMA_USE_EXTERN_RNG = ${ARMA_USE_EXTERN_RNG}")
|
||||
|
||||
@@ -30,16 +30,15 @@ Copyright 2017-2022 Data61 / CSIRO
|
||||
8. [Windows: Compiling and Linking](#8-windows-compiling-and-linking)
|
||||
|
||||
9. [Support for OpenBLAS and Intel MKL](#9-support-for-openblas-and-intel-mkl)
|
||||
10. [Support for ATLAS](#10-support-for-atlas)
|
||||
11. [Caveat on use of C++11 auto Keyword](#11-caveat-on-use-of-c11-auto-keyword)
|
||||
12. [Support for OpenMP](#12-support-for-openmp)
|
||||
10. [Caveat on use of C++11 auto Keyword](#10-caveat-on-use-of-c11-auto-keyword)
|
||||
11. [Support for OpenMP](#11-support-for-openmp)
|
||||
|
||||
13. [Documentation of Functions and Classes](#13-documentation-of-functions-and-classes)
|
||||
14. [API Stability and Versioning](#14-api-stability-and-versioning)
|
||||
15. [Bug Reports and Frequently Asked Questions](#15-bug-reports-and-frequently-asked-questions)
|
||||
12. [Documentation of Functions and Classes](#12-documentation-of-functions-and-classes)
|
||||
13. [API Stability and Versioning](#13-api-stability-and-versioning)
|
||||
14. [Bug Reports and Frequently Asked Questions](#14-bug-reports-and-frequently-asked-questions)
|
||||
|
||||
16. [MEX Interface to Octave/Matlab](#16-mex-interface-to-octavematlab)
|
||||
17. [Related Software Using Armadillo](#17-related-software-using-armadillo)
|
||||
15. [MEX Interface to Octave/Matlab](#15-mex-interface-to-octavematlab)
|
||||
16. [Related Software Using Armadillo](#16-related-software-using-armadillo)
|
||||
|
||||
---
|
||||
|
||||
@@ -358,16 +357,7 @@ Comment out the line containing:
|
||||
|
||||
---
|
||||
|
||||
### 10: Support for ATLAS
|
||||
|
||||
If OpenBLAS is not available, Armadillo can use the ATLAS library for faster versions
|
||||
of a subset of LAPACK and BLAS functions.
|
||||
LAPACK should still be installed to obtain full functionality.
|
||||
The minimum recommended version of ATLAS is 3.10.
|
||||
|
||||
---
|
||||
|
||||
### 11: Caveat on use of C++11 auto Keyword
|
||||
### 10: Caveat on use of C++11 auto Keyword
|
||||
|
||||
Use of the C++11 `auto` keyword is not recommended with Armadillo objects and expressions.
|
||||
|
||||
@@ -376,7 +366,7 @@ that are not properly handled by `auto`.
|
||||
|
||||
---
|
||||
|
||||
### 12: Support for OpenMP
|
||||
### 11: Support for OpenMP
|
||||
|
||||
Armadillo can use OpenMP to automatically speed up computationally
|
||||
expensive element-wise functions such as exp(), log(), cos(), etc.
|
||||
@@ -387,7 +377,7 @@ For GCC and Clang compilers, use the following options to enable both C++11 and
|
||||
|
||||
---
|
||||
|
||||
### 13: Documentation of Functions and Classes
|
||||
### 12: Documentation of Functions and Classes
|
||||
|
||||
The documentation of Armadillo functions and classes is available at:
|
||||
http://arma.sourceforge.net/docs.html
|
||||
@@ -397,7 +387,7 @@ Use a web browser to view it.
|
||||
|
||||
---
|
||||
|
||||
### 14: API Stability and Versioning
|
||||
### 13: API Stability and Versioning
|
||||
|
||||
Each release of Armadillo has its public API (functions, classes, constants)
|
||||
described in the accompanying API documentation (docs.html) specific
|
||||
@@ -432,7 +422,7 @@ implementation details, and may change or be removed without notice.
|
||||
|
||||
---
|
||||
|
||||
### 15: Bug Reports and Frequently Asked Questions
|
||||
### 14: Bug Reports and Frequently Asked Questions
|
||||
|
||||
Armadillo has gone through extensive testing and has been successfully
|
||||
used in production environments. However, as with almost all software,
|
||||
@@ -452,14 +442,14 @@ http://arma.sourceforge.net/faq.html
|
||||
|
||||
---
|
||||
|
||||
### 16: MEX Interface to Octave/Matlab
|
||||
### 15: MEX Interface to Octave/Matlab
|
||||
|
||||
The `mex_interface` folder contains examples of how to interface
|
||||
Octave/Matlab with C++ code that uses Armadillo matrices.
|
||||
|
||||
---
|
||||
|
||||
### 17: Related Software Using Armadillo
|
||||
### 16: Related Software Using Armadillo
|
||||
|
||||
* ensmallen: fast non-linear numerical optimisation library
|
||||
http://ensmallen.org/
|
||||
|
||||
@@ -696,7 +696,7 @@ it is possible to use other types instead, eg. <i>fmat</i>
|
||||
</li>
|
||||
<br>
|
||||
<li>
|
||||
Functions which use LAPACK or ATLAS (generally matrix decompositions) are only valid for the following types:
|
||||
Functions which use LAPACK (generally matrix decompositions) are only valid for the following types:
|
||||
<i>mat</i>, <i>dmat</i>, <i>fmat</i>, <i>cx_mat</i>, <i>cx_dmat</i>, <i>cx_fmat</i>
|
||||
</li>
|
||||
<br>
|
||||
|
||||
@@ -73,7 +73,6 @@
|
||||
#endif
|
||||
|
||||
|
||||
#include "armadillo_bits/include_atlas.hpp"
|
||||
#include "armadillo_bits/include_hdf5.hpp"
|
||||
#include "armadillo_bits/include_superlu.hpp"
|
||||
|
||||
@@ -124,14 +123,12 @@ namespace arma
|
||||
|
||||
#include "armadillo_bits/def_blas.hpp"
|
||||
#include "armadillo_bits/def_lapack.hpp"
|
||||
#include "armadillo_bits/def_atlas.hpp"
|
||||
#include "armadillo_bits/def_arpack.hpp"
|
||||
#include "armadillo_bits/def_superlu.hpp"
|
||||
#include "armadillo_bits/def_hdf5.hpp"
|
||||
|
||||
#include "armadillo_bits/translate_blas.hpp"
|
||||
#include "armadillo_bits/translate_lapack.hpp"
|
||||
#include "armadillo_bits/translate_atlas.hpp"
|
||||
#include "armadillo_bits/translate_arpack.hpp"
|
||||
#include "armadillo_bits/translate_superlu.hpp"
|
||||
|
||||
|
||||
@@ -44,13 +44,6 @@ struct arma_config
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
static constexpr bool atlas = true;
|
||||
#else
|
||||
static constexpr bool atlas = false;
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(ARMA_USE_LAPACK)
|
||||
static constexpr bool lapack = true;
|
||||
#else
|
||||
|
||||
@@ -30,25 +30,7 @@ auxlib::inv(Mat<eT>& A)
|
||||
|
||||
if(A.is_empty()) { return true; }
|
||||
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
arma_debug_assert_atlas_size(A);
|
||||
|
||||
podarray<int> ipiv(A.n_rows);
|
||||
|
||||
int info = 0;
|
||||
|
||||
arma_extra_debug_print("atlas::clapack_getrf()");
|
||||
info = atlas::clapack_getrf(atlas::CblasColMajor, A.n_rows, A.n_cols, A.memptr(), A.n_rows, ipiv.memptr());
|
||||
|
||||
if(info != 0) { return false; }
|
||||
|
||||
arma_extra_debug_print("atlas::clapack_getri()");
|
||||
info = atlas::clapack_getri(atlas::CblasColMajor, A.n_rows, A.memptr(), A.n_rows, ipiv.memptr());
|
||||
|
||||
return (info == 0);
|
||||
}
|
||||
#elif defined(ARMA_USE_LAPACK)
|
||||
#if defined(ARMA_USE_LAPACK)
|
||||
{
|
||||
arma_debug_assert_blas_size(A);
|
||||
|
||||
@@ -89,7 +71,7 @@ auxlib::inv(Mat<eT>& A)
|
||||
#else
|
||||
{
|
||||
arma_ignore(A);
|
||||
arma_stop_logic_error("inv(): use of ATLAS or LAPACK must be enabled");
|
||||
arma_stop_logic_error("inv(): use of LAPACK must be enabled");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -166,27 +148,7 @@ auxlib::inv_sympd(Mat<eT>& A)
|
||||
|
||||
if(A.is_empty()) { return true; }
|
||||
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
arma_debug_assert_atlas_size(A);
|
||||
|
||||
int info = 0;
|
||||
|
||||
arma_extra_debug_print("atlas::clapack_potrf()");
|
||||
info = atlas::clapack_potrf(atlas::CblasColMajor, atlas::CblasLower, A.n_rows, A.memptr(), A.n_rows);
|
||||
|
||||
if(info != 0) { return false; }
|
||||
|
||||
arma_extra_debug_print("atlas::clapack_potri()");
|
||||
info = atlas::clapack_potri(atlas::CblasColMajor, atlas::CblasLower, A.n_rows, A.memptr(), A.n_rows);
|
||||
|
||||
if(info != 0) { return false; }
|
||||
|
||||
A = symmatl(A);
|
||||
|
||||
return true;
|
||||
}
|
||||
#elif defined(ARMA_USE_LAPACK)
|
||||
#if defined(ARMA_USE_LAPACK)
|
||||
{
|
||||
arma_debug_assert_blas_size(A);
|
||||
|
||||
@@ -213,7 +175,7 @@ auxlib::inv_sympd(Mat<eT>& A)
|
||||
#else
|
||||
{
|
||||
arma_ignore(A);
|
||||
arma_stop_logic_error("inv_sympd(): use of ATLAS or LAPACK must be enabled");
|
||||
arma_stop_logic_error("inv_sympd(): use of LAPACK must be enabled");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -361,33 +323,7 @@ auxlib::det(eT& out_val, Mat<eT>& A)
|
||||
|
||||
if(A.is_empty()) { out_val = eT(1); return true; }
|
||||
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
arma_debug_assert_atlas_size(A);
|
||||
|
||||
podarray<int> ipiv(A.n_rows);
|
||||
|
||||
arma_extra_debug_print("atlas::clapack_getrf()");
|
||||
const int info = atlas::clapack_getrf(atlas::CblasColMajor, A.n_rows, A.n_cols, A.memptr(), A.n_rows, ipiv.memptr());
|
||||
|
||||
if(info < 0) { return false; }
|
||||
|
||||
// on output A appears to be L+U_alt, where U_alt is U with the main diagonal set to zero
|
||||
eT val = A.at(0,0);
|
||||
for(uword i=1; i < A.n_rows; ++i) { val *= A.at(i,i); }
|
||||
|
||||
int sign = +1;
|
||||
for(uword i=0; i < A.n_rows; ++i)
|
||||
{
|
||||
// NOTE: no adjustment required, as the clapack version of getrf() assumes counting from 0
|
||||
if( int(i) != ipiv.mem[i] ) { sign *= -1; }
|
||||
}
|
||||
|
||||
out_val = (sign < 0) ? eT(-val) : eT(val);
|
||||
|
||||
return true;
|
||||
}
|
||||
#elif defined(ARMA_USE_LAPACK)
|
||||
#if defined(ARMA_USE_LAPACK)
|
||||
{
|
||||
arma_debug_assert_blas_size(A);
|
||||
|
||||
@@ -421,7 +357,7 @@ auxlib::det(eT& out_val, Mat<eT>& A)
|
||||
{
|
||||
arma_ignore(out_val);
|
||||
arma_ignore(A);
|
||||
arma_stop_logic_error("det(): use of ATLAS or LAPACK must be enabled");
|
||||
arma_stop_logic_error("det(): use of LAPACK must be enabled");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -446,44 +382,7 @@ auxlib::log_det(eT& out_val, typename get_pod_type<eT>::result& out_sign, Mat<eT
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
arma_debug_assert_atlas_size(A);
|
||||
|
||||
podarray<int> ipiv(A.n_rows);
|
||||
|
||||
arma_extra_debug_print("atlas::clapack_getrf()");
|
||||
const int info = atlas::clapack_getrf(atlas::CblasColMajor, A.n_rows, A.n_cols, A.memptr(), A.n_rows, ipiv.memptr());
|
||||
|
||||
if(info < 0) { return false; }
|
||||
|
||||
// on output A appears to be L+U_alt, where U_alt is U with the main diagonal set to zero
|
||||
|
||||
sword sign = (is_cx<eT>::no) ? ( (access::tmp_real( A.at(0,0) ) < T(0)) ? -1 : +1 ) : +1;
|
||||
eT val = (is_cx<eT>::no) ? std::log( (access::tmp_real( A.at(0,0) ) < T(0)) ? A.at(0,0)*T(-1) : A.at(0,0) ) : std::log( A.at(0,0) );
|
||||
|
||||
for(uword i=1; i < A.n_rows; ++i)
|
||||
{
|
||||
const eT x = A.at(i,i);
|
||||
|
||||
sign *= (is_cx<eT>::no) ? ( (access::tmp_real(x) < T(0)) ? -1 : +1 ) : +1;
|
||||
val += (is_cx<eT>::no) ? std::log( (access::tmp_real(x) < T(0)) ? x*T(-1) : x ) : std::log(x);
|
||||
}
|
||||
|
||||
for(uword i=0; i < A.n_rows; ++i)
|
||||
{
|
||||
if( int(i) != ipiv.mem[i] ) // NOTE: no adjustment required, as the clapack version of getrf() assumes counting from 0
|
||||
{
|
||||
sign *= -1;
|
||||
}
|
||||
}
|
||||
|
||||
out_val = val;
|
||||
out_sign = T(sign);
|
||||
|
||||
return true;
|
||||
}
|
||||
#elif defined(ARMA_USE_LAPACK)
|
||||
#if defined(ARMA_USE_LAPACK)
|
||||
{
|
||||
arma_debug_assert_blas_size(A);
|
||||
|
||||
@@ -529,7 +428,7 @@ auxlib::log_det(eT& out_val, typename get_pod_type<eT>::result& out_sign, Mat<eT
|
||||
arma_ignore(A);
|
||||
arma_ignore(out_val);
|
||||
arma_ignore(out_sign);
|
||||
arma_stop_logic_error("log_det(): use of ATLAS or LAPACK must be enabled");
|
||||
arma_stop_logic_error("log_det(): use of LAPACK must be enabled");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -548,26 +447,7 @@ auxlib::log_det_sympd(typename get_pod_type<eT>::result& out_val, Mat<eT>& A)
|
||||
|
||||
if(A.is_empty()) { out_val = T(0); return true; }
|
||||
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
arma_debug_assert_atlas_size(A);
|
||||
|
||||
int info = 0;
|
||||
|
||||
arma_extra_debug_print("atlas::clapack_potrf()");
|
||||
info = atlas::clapack_potrf(atlas::CblasColMajor, atlas::CblasLower, A.n_rows, A.memptr(), A.n_rows);
|
||||
|
||||
if(info != 0) { return false; }
|
||||
|
||||
T val = std::log( access::tmp_real(A.at(0,0)) );
|
||||
|
||||
for(uword i=1; i < A.n_rows; ++i) { val += std::log( access::tmp_real(A.at(i,i)) ); }
|
||||
|
||||
out_val = T(2) * val;
|
||||
|
||||
return true;
|
||||
}
|
||||
#elif defined(ARMA_USE_LAPACK)
|
||||
#if defined(ARMA_USE_LAPACK)
|
||||
{
|
||||
arma_debug_assert_blas_size(A);
|
||||
|
||||
@@ -592,7 +472,7 @@ auxlib::log_det_sympd(typename get_pod_type<eT>::result& out_val, Mat<eT>& A)
|
||||
{
|
||||
arma_ignore(out_val);
|
||||
arma_ignore(A);
|
||||
arma_stop_logic_error("det(): use of ATLAS or LAPACK must be enabled");
|
||||
arma_stop_logic_error("det(): use of LAPACK must be enabled");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -621,39 +501,24 @@ auxlib::lu(Mat<eT>& L, Mat<eT>& U, podarray<blas_int>& ipiv, const Base<eT,T1>&
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(ARMA_USE_ATLAS) || defined(ARMA_USE_LAPACK)
|
||||
#if defined(ARMA_USE_LAPACK)
|
||||
{
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
arma_debug_assert_atlas_size(U);
|
||||
|
||||
ipiv.set_size( (std::min)(U_n_rows, U_n_cols) );
|
||||
|
||||
arma_extra_debug_print("atlas::clapack_getrf()");
|
||||
int info = atlas::clapack_getrf(atlas::CblasColMajor, U_n_rows, U_n_cols, U.memptr(), U_n_rows, ipiv.memptr());
|
||||
|
||||
if(info < 0) { return false; }
|
||||
}
|
||||
#elif defined(ARMA_USE_LAPACK)
|
||||
{
|
||||
arma_debug_assert_blas_size(U);
|
||||
|
||||
ipiv.set_size( (std::min)(U_n_rows, U_n_cols) );
|
||||
|
||||
blas_int info = 0;
|
||||
|
||||
blas_int n_rows = blas_int(U_n_rows);
|
||||
blas_int n_cols = blas_int(U_n_cols);
|
||||
|
||||
arma_extra_debug_print("lapack::getrf()");
|
||||
lapack::getrf(&n_rows, &n_cols, U.memptr(), &n_rows, ipiv.memptr(), &info);
|
||||
|
||||
if(info < 0) { return false; }
|
||||
|
||||
// take into account that Fortran counts from 1
|
||||
arrayops::inplace_minus(ipiv.memptr(), blas_int(1), ipiv.n_elem);
|
||||
}
|
||||
#endif
|
||||
arma_debug_assert_blas_size(U);
|
||||
|
||||
ipiv.set_size( (std::min)(U_n_rows, U_n_cols) );
|
||||
|
||||
blas_int info = 0;
|
||||
|
||||
blas_int n_rows = blas_int(U_n_rows);
|
||||
blas_int n_cols = blas_int(U_n_cols);
|
||||
|
||||
arma_extra_debug_print("lapack::getrf()");
|
||||
lapack::getrf(&n_rows, &n_cols, U.memptr(), &n_rows, ipiv.memptr(), &info);
|
||||
|
||||
if(info < 0) { return false; }
|
||||
|
||||
// take into account that Fortran counts from 1
|
||||
arrayops::inplace_minus(ipiv.memptr(), blas_int(1), ipiv.n_elem);
|
||||
|
||||
L.copy_size(U);
|
||||
|
||||
@@ -680,7 +545,7 @@ auxlib::lu(Mat<eT>& L, Mat<eT>& U, podarray<blas_int>& ipiv, const Base<eT,T1>&
|
||||
}
|
||||
#else
|
||||
{
|
||||
arma_stop_logic_error("lu(): use of ATLAS or LAPACK must be enabled");
|
||||
arma_stop_logic_error("lu(): use of LAPACK must be enabled");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -2455,18 +2320,7 @@ auxlib::chol_simple(Mat<eT>& X)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
arma_debug_assert_atlas_size(X);
|
||||
|
||||
int info = 0;
|
||||
|
||||
arma_extra_debug_print("atlas::clapack_potrf()");
|
||||
info = atlas::clapack_potrf(atlas::CblasColMajor, atlas::CblasUpper, X.n_rows, X.memptr(), X.n_rows);
|
||||
|
||||
return (info == 0);
|
||||
}
|
||||
#elif defined(ARMA_USE_LAPACK)
|
||||
#if defined(ARMA_USE_LAPACK)
|
||||
{
|
||||
arma_debug_assert_blas_size(X);
|
||||
|
||||
@@ -2483,7 +2337,7 @@ auxlib::chol_simple(Mat<eT>& X)
|
||||
{
|
||||
arma_ignore(X);
|
||||
|
||||
arma_stop_logic_error("chol(): use of ATLAS or LAPACK must be enabled");
|
||||
arma_stop_logic_error("chol(): use of LAPACK must be enabled");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -2498,22 +2352,7 @@ auxlib::chol(Mat<eT>& X, const uword layout)
|
||||
{
|
||||
arma_extra_debug_sigprint();
|
||||
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
arma_debug_assert_atlas_size(X);
|
||||
|
||||
int info = 0;
|
||||
|
||||
arma_extra_debug_print("atlas::clapack_potrf()");
|
||||
info = atlas::clapack_potrf(atlas::CblasColMajor, ((layout == 0) ? atlas::CblasUpper : atlas::CblasLower), X.n_rows, X.memptr(), X.n_rows);
|
||||
|
||||
if(info != 0) { return false; }
|
||||
|
||||
X = (layout == 0) ? trimatu(X) : trimatl(X); // trimatu() and trimatl() return the same type
|
||||
|
||||
return true;
|
||||
}
|
||||
#elif defined(ARMA_USE_LAPACK)
|
||||
#if defined(ARMA_USE_LAPACK)
|
||||
{
|
||||
arma_debug_assert_blas_size(X);
|
||||
|
||||
@@ -2535,7 +2374,7 @@ auxlib::chol(Mat<eT>& X, const uword layout)
|
||||
arma_ignore(X);
|
||||
arma_ignore(layout);
|
||||
|
||||
arma_stop_logic_error("chol(): use of ATLAS or LAPACK must be enabled");
|
||||
arma_stop_logic_error("chol(): use of LAPACK must be enabled");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -4208,18 +4047,7 @@ auxlib::solve_square_fast(Mat<typename T1::elem_type>& out, Mat<typename T1::ele
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
arma_debug_assert_atlas_size(A);
|
||||
|
||||
podarray<int> ipiv(A_n_rows + 2); // +2 for paranoia: old versions of Atlas might be trashing memory
|
||||
|
||||
arma_extra_debug_print("atlas::clapack_gesv()");
|
||||
int info = atlas::clapack_gesv<eT>(atlas::CblasColMajor, A_n_rows, B_n_cols, A.memptr(), A_n_rows, ipiv.memptr(), out.memptr(), A_n_rows);
|
||||
|
||||
return (info == 0);
|
||||
}
|
||||
#elif defined(ARMA_USE_LAPACK)
|
||||
#if defined(ARMA_USE_LAPACK)
|
||||
{
|
||||
arma_debug_assert_blas_size(A);
|
||||
|
||||
@@ -4238,7 +4066,7 @@ auxlib::solve_square_fast(Mat<typename T1::elem_type>& out, Mat<typename T1::ele
|
||||
}
|
||||
#else
|
||||
{
|
||||
arma_stop_logic_error("solve(): use of ATLAS or LAPACK must be enabled");
|
||||
arma_stop_logic_error("solve(): use of LAPACK must be enabled");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -4578,18 +4406,7 @@ auxlib::solve_sympd_fast_common(Mat<typename T1::elem_type>& out, Mat<typename T
|
||||
return true;
|
||||
}
|
||||
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
arma_debug_assert_atlas_size(A, out);
|
||||
|
||||
int info = 0;
|
||||
|
||||
arma_extra_debug_print("atlas::clapack_posv()");
|
||||
info = atlas::clapack_posv<eT>(atlas::CblasColMajor, atlas::CblasLower, A_n_rows, B_n_cols, A.memptr(), A_n_rows, out.memptr(), B_n_rows);
|
||||
|
||||
return (info == 0);
|
||||
}
|
||||
#elif defined(ARMA_USE_LAPACK)
|
||||
#if defined(ARMA_USE_LAPACK)
|
||||
{
|
||||
arma_debug_assert_blas_size(A, out);
|
||||
|
||||
@@ -4610,7 +4427,7 @@ auxlib::solve_sympd_fast_common(Mat<typename T1::elem_type>& out, Mat<typename T
|
||||
arma_ignore(out);
|
||||
arma_ignore(A);
|
||||
arma_ignore(B_expr);
|
||||
arma_stop_logic_error("solve(): use of ATLAS or LAPACK must be enabled");
|
||||
arma_stop_logic_error("solve(): use of LAPACK must be enabled");
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -111,12 +111,6 @@
|
||||
//// You may also need to enable or disable the following options:
|
||||
//// ARMA_BLAS_LONG, ARMA_BLAS_LONG_LONG, ARMA_USE_FORTRAN_HIDDEN_ARGS
|
||||
|
||||
// #define ARMA_USE_ATLAS
|
||||
// #define ARMA_ATLAS_INCLUDE_DIR /usr/include/
|
||||
//// If you're using ATLAS and the compiler can't find cblas.h and/or clapack.h
|
||||
//// uncomment the above define and specify the appropriate include directory.
|
||||
//// Make sure the directory has a trailing /
|
||||
|
||||
#if !defined(ARMA_USE_OPENMP)
|
||||
// #define ARMA_USE_OPENMP
|
||||
//// Uncomment the above line to forcefully enable use of OpenMP for parallelisation.
|
||||
@@ -249,11 +243,6 @@
|
||||
#undef ARMA_SUPERLU_INCLUDE_DIR
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DONT_USE_ATLAS)
|
||||
#undef ARMA_USE_ATLAS
|
||||
#undef ARMA_ATLAS_INCLUDE_DIR
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DONT_USE_WRAPPER)
|
||||
#undef ARMA_USE_WRAPPER
|
||||
#undef ARMA_USE_HDF5_ALT
|
||||
|
||||
@@ -111,12 +111,6 @@
|
||||
//// You may also need to enable or disable the following options:
|
||||
//// ARMA_BLAS_LONG, ARMA_BLAS_LONG_LONG, ARMA_USE_FORTRAN_HIDDEN_ARGS
|
||||
|
||||
#cmakedefine ARMA_USE_ATLAS
|
||||
#define ARMA_ATLAS_INCLUDE_DIR ${ARMA_ATLAS_INCLUDE_DIR}/
|
||||
//// If you're using ATLAS and the compiler can't find cblas.h and/or clapack.h
|
||||
//// uncomment the above define and specify the appropriate include directory.
|
||||
//// Make sure the directory has a trailing /
|
||||
|
||||
#if !defined(ARMA_USE_OPENMP)
|
||||
// #define ARMA_USE_OPENMP
|
||||
//// Uncomment the above line to forcefully enable use of OpenMP for parallelisation.
|
||||
@@ -249,11 +243,6 @@
|
||||
#undef ARMA_SUPERLU_INCLUDE_DIR
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DONT_USE_ATLAS)
|
||||
#undef ARMA_USE_ATLAS
|
||||
#undef ARMA_ATLAS_INCLUDE_DIR
|
||||
#endif
|
||||
|
||||
#if defined(ARMA_DONT_USE_WRAPPER)
|
||||
#undef ARMA_USE_WRAPPER
|
||||
#undef ARMA_USE_HDF5_ALT
|
||||
|
||||
@@ -1,136 +0,0 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
#ifdef ARMA_USE_ATLAS
|
||||
|
||||
|
||||
//! \namespace atlas namespace for ATLAS functions (imported from the global namespace)
|
||||
namespace atlas
|
||||
{
|
||||
using ::CblasColMajor;
|
||||
using ::CblasNoTrans;
|
||||
using ::CblasTrans;
|
||||
using ::CblasConjTrans;
|
||||
using ::CblasLower;
|
||||
using ::CblasUpper;
|
||||
|
||||
#if defined(ARMA_USE_WRAPPER)
|
||||
extern "C"
|
||||
{
|
||||
float wrapper_cblas_sasum(const int N, const float *X, const int incX);
|
||||
double wrapper_cblas_dasum(const int N, const double *X, const int incX);
|
||||
|
||||
float wrapper_cblas_snrm2(const int N, const float *X, const int incX);
|
||||
double wrapper_cblas_dnrm2(const int N, const double *X, const int incX);
|
||||
|
||||
float wrapper_cblas_sdot(const int N, const float *X, const int incX, const float *Y, const int incY);
|
||||
double wrapper_cblas_ddot(const int N, const double *X, const int incX, const double *Y, const int incY);
|
||||
|
||||
void wrapper_cblas_cdotu_sub(const int N, const void *X, const int incX, const void *Y, const int incY, void *dotu);
|
||||
void wrapper_cblas_zdotu_sub(const int N, const void *X, const int incX, const void *Y, const int incY, void *dotu);
|
||||
|
||||
|
||||
void wrapper_cblas_sgemv(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const float alpha,
|
||||
const float *A, const int lda, const float *X, const int incX, const float beta, float *Y, const int incY);
|
||||
|
||||
void wrapper_cblas_dgemv(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const double alpha,
|
||||
const double *A, const int lda, const double *X, const int incX, const double beta, double *Y, const int incY);
|
||||
|
||||
void wrapper_cblas_cgemv(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const void *alpha,
|
||||
const void *A, const int lda, const void *X, const int incX, const void *beta, void *Y, const int incY);
|
||||
|
||||
void wrapper_cblas_zgemv(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const void *alpha,
|
||||
const void *A, const int lda, const void *X, const int incX, const void *beta, void *Y, const int incY);
|
||||
|
||||
|
||||
|
||||
void wrapper_cblas_sgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB,
|
||||
const int M, const int N, const int K, const float alpha,
|
||||
const float *A, const int lda, const float *B, const int ldb, const float beta, float *C, const int ldc);
|
||||
|
||||
void wrapper_cblas_dgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB,
|
||||
const int M, const int N, const int K, const double alpha,
|
||||
const double *A, const int lda, const double *B, const int ldb, const double beta, double *C, const int ldc);
|
||||
|
||||
void wrapper_cblas_cgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB,
|
||||
const int M, const int N, const int K, const void *alpha,
|
||||
const void *A, const int lda, const void *B, const int ldb, const void *beta, void *C, const int ldc);
|
||||
|
||||
void wrapper_cblas_zgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB,
|
||||
const int M, const int N, const int K, const void *alpha,
|
||||
const void *A, const int lda, const void *B, const int ldb, const void *beta, void *C, const int ldc);
|
||||
|
||||
|
||||
|
||||
void wrapper_cblas_ssyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans,
|
||||
const int N, const int K, const float alpha,
|
||||
const float *A, const int lda, const float beta, float *C, const int ldc);
|
||||
|
||||
void wrapper_cblas_dsyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans,
|
||||
const int N, const int K, const double alpha,
|
||||
const double *A, const int lda, const double beta, double *C, const int ldc);
|
||||
|
||||
|
||||
|
||||
void wrapper_cblas_cherk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans,
|
||||
const int N, const int K, const float alpha,
|
||||
const void *A, const int lda, const float beta, void *C, const int ldc);
|
||||
|
||||
void wrapper_cblas_zherk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans,
|
||||
const int N, const int K, const double alpha,
|
||||
const void *A, const int lda, const double beta, void *C, const int ldc);
|
||||
|
||||
|
||||
|
||||
int wrapper_clapack_sgetrf(const enum CBLAS_ORDER Order, const int M, const int N, float *A, const int lda, int *ipiv);
|
||||
int wrapper_clapack_dgetrf(const enum CBLAS_ORDER Order, const int M, const int N, double *A, const int lda, int *ipiv);
|
||||
int wrapper_clapack_cgetrf(const enum CBLAS_ORDER Order, const int M, const int N, void *A, const int lda, int *ipiv);
|
||||
int wrapper_clapack_zgetrf(const enum CBLAS_ORDER Order, const int M, const int N, void *A, const int lda, int *ipiv);
|
||||
|
||||
int wrapper_clapack_sgetri(const enum CBLAS_ORDER Order, const int N, float *A, const int lda, const int *ipiv);
|
||||
int wrapper_clapack_dgetri(const enum CBLAS_ORDER Order, const int N, double *A, const int lda, const int *ipiv);
|
||||
int wrapper_clapack_cgetri(const enum CBLAS_ORDER Order, const int N, void *A, const int lda, const int *ipiv);
|
||||
int wrapper_clapack_zgetri(const enum CBLAS_ORDER Order, const int N, void *A, const int lda, const int *ipiv);
|
||||
|
||||
int wrapper_clapack_sgesv(const enum CBLAS_ORDER Order, const int N, const int NRHS, float *A, const int lda, int *ipiv, float *B, const int ldb);
|
||||
int wrapper_clapack_dgesv(const enum CBLAS_ORDER Order, const int N, const int NRHS, double *A, const int lda, int *ipiv, double *B, const int ldb);
|
||||
int wrapper_clapack_cgesv(const enum CBLAS_ORDER Order, const int N, const int NRHS, void *A, const int lda, int *ipiv, void *B, const int ldb);
|
||||
int wrapper_clapack_zgesv(const enum CBLAS_ORDER Order, const int N, const int NRHS, void *A, const int lda, int *ipiv, void *B, const int ldb);
|
||||
|
||||
|
||||
|
||||
int wrapper_clapack_spotrf(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const int N, float *A, const int lda);
|
||||
int wrapper_clapack_dpotrf(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const int N, double *A, const int lda);
|
||||
int wrapper_clapack_cpotrf(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const int N, void *A, const int lda);
|
||||
int wrapper_clapack_zpotrf(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const int N, void *A, const int lda);
|
||||
|
||||
int wrapper_clapack_spotri(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const int N, float *A, const int lda);
|
||||
int wrapper_clapack_dpotri(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const int N, double *A, const int lda);
|
||||
int wrapper_clapack_cpotri(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const int N, void *A, const int lda);
|
||||
int wrapper_clapack_zpotri(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const int N, void *A, const int lda);
|
||||
|
||||
int wrapper_clapack_sposv(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const int N, const int NRHS, float *A, const int lda, float *B, const int ldb);
|
||||
int wrapper_clapack_dposv(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const int N, const int NRHS, double *A, const int lda, double *B, const int ldb);
|
||||
int wrapper_clapack_cposv(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const int N, const int NRHS, void *A, const int lda, void *B, const int ldb);
|
||||
int wrapper_clapack_zposv(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const int N, const int NRHS, void *A, const int lda, void *B, const int ldb);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,44 +0,0 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
#if !defined(ARMA_ATLAS_INCLUDE_DIR)
|
||||
extern "C"
|
||||
{
|
||||
#include <cblas.h>
|
||||
#include <clapack.h>
|
||||
}
|
||||
#else
|
||||
#define ARMA_STR1(x) x
|
||||
#define ARMA_STR2(x) ARMA_STR1(x)
|
||||
|
||||
#define ARMA_CBLAS ARMA_STR2(ARMA_ATLAS_INCLUDE_DIR)ARMA_STR2(cblas.h)
|
||||
#define ARMA_CLAPACK ARMA_STR2(ARMA_ATLAS_INCLUDE_DIR)ARMA_STR2(clapack.h)
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include ARMA_INCFILE_WRAP(ARMA_CBLAS)
|
||||
#include ARMA_INCFILE_WRAP(ARMA_CLAPACK)
|
||||
}
|
||||
|
||||
#undef ARMA_STR1
|
||||
#undef ARMA_STR2
|
||||
#undef ARMA_CBLAS
|
||||
#undef ARMA_CLAPACK
|
||||
#endif
|
||||
#endif
|
||||
@@ -239,7 +239,7 @@ class gemm_emul
|
||||
|
||||
|
||||
//! \brief
|
||||
//! Wrapper for ATLAS/BLAS dgemm function, using template arguments to control the arguments passed to dgemm.
|
||||
//! Wrapper for BLAS dgemm function, using template arguments to control the arguments passed to dgemm.
|
||||
//! Matrix 'C' is assumed to have been set to the correct size (ie. taking into account transposes)
|
||||
|
||||
template<const bool do_trans_A=false, const bool do_trans_B=false, const bool use_alpha=false, const bool use_beta=false>
|
||||
@@ -272,31 +272,7 @@ class gemm
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
arma_extra_debug_print("atlas::cblas_gemm()");
|
||||
|
||||
arma_debug_assert_atlas_size(A,B);
|
||||
|
||||
atlas::cblas_gemm<eT>
|
||||
(
|
||||
atlas::CblasColMajor,
|
||||
(do_trans_A) ? ( is_cx<eT>::yes ? CblasConjTrans : atlas::CblasTrans ) : atlas::CblasNoTrans,
|
||||
(do_trans_B) ? ( is_cx<eT>::yes ? CblasConjTrans : atlas::CblasTrans ) : atlas::CblasNoTrans,
|
||||
C.n_rows,
|
||||
C.n_cols,
|
||||
(do_trans_A) ? A.n_rows : A.n_cols,
|
||||
(use_alpha) ? alpha : eT(1),
|
||||
A.mem,
|
||||
(do_trans_A) ? A.n_rows : C.n_rows,
|
||||
B.mem,
|
||||
(do_trans_B) ? C.n_cols : ( (do_trans_A) ? A.n_rows : A.n_cols ),
|
||||
(use_beta) ? beta : eT(0),
|
||||
C.memptr(),
|
||||
C.n_rows
|
||||
);
|
||||
}
|
||||
#elif defined(ARMA_USE_BLAS)
|
||||
#if defined(ARMA_USE_BLAS)
|
||||
{
|
||||
arma_extra_debug_print("blas::gemm()");
|
||||
|
||||
|
||||
@@ -209,7 +209,7 @@ class gemv_emul_helper
|
||||
|
||||
|
||||
//! \brief
|
||||
//! Partial emulation of ATLAS/BLAS gemv().
|
||||
//! Partial emulation of BLAS gemv().
|
||||
//! 'y' is assumed to have been set to the correct size (ie. taking into account the transpose)
|
||||
|
||||
template<const bool do_trans_A=false, const bool use_alpha=false, const bool use_beta=false>
|
||||
@@ -293,7 +293,7 @@ class gemv_emul
|
||||
|
||||
|
||||
//! \brief
|
||||
//! Wrapper for ATLAS/BLAS gemv function, using template arguments to control the arguments passed to gemv.
|
||||
//! Wrapper for BLAS gemv function, using template arguments to control the arguments passed to gemv.
|
||||
//! 'y' is assumed to have been set to the correct size (ie. taking into account the transpose)
|
||||
|
||||
template<const bool do_trans_A=false, const bool use_alpha=false, const bool use_beta=false>
|
||||
@@ -315,56 +315,7 @@ class gemv
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
arma_debug_assert_atlas_size(A);
|
||||
|
||||
if(is_cx<eT>::no)
|
||||
{
|
||||
// use gemm() instead of gemv() to work around a speed issue in Atlas 3.8.4
|
||||
|
||||
arma_extra_debug_print("atlas::cblas_gemm()");
|
||||
|
||||
atlas::cblas_gemm<eT>
|
||||
(
|
||||
atlas::CblasColMajor,
|
||||
(do_trans_A) ? ( is_cx<eT>::yes ? CblasConjTrans : atlas::CblasTrans ) : atlas::CblasNoTrans,
|
||||
atlas::CblasNoTrans,
|
||||
(do_trans_A) ? A.n_cols : A.n_rows,
|
||||
1,
|
||||
(do_trans_A) ? A.n_rows : A.n_cols,
|
||||
(use_alpha) ? alpha : eT(1),
|
||||
A.mem,
|
||||
A.n_rows,
|
||||
x,
|
||||
(do_trans_A) ? A.n_rows : A.n_cols,
|
||||
(use_beta) ? beta : eT(0),
|
||||
y,
|
||||
(do_trans_A) ? A.n_cols : A.n_rows
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
arma_extra_debug_print("atlas::cblas_gemv()");
|
||||
|
||||
atlas::cblas_gemv<eT>
|
||||
(
|
||||
atlas::CblasColMajor,
|
||||
(do_trans_A) ? ( is_cx<eT>::yes ? CblasConjTrans : atlas::CblasTrans ) : atlas::CblasNoTrans,
|
||||
A.n_rows,
|
||||
A.n_cols,
|
||||
(use_alpha) ? alpha : eT(1),
|
||||
A.mem,
|
||||
A.n_rows,
|
||||
x,
|
||||
1,
|
||||
(use_beta) ? beta : eT(0),
|
||||
y,
|
||||
1
|
||||
);
|
||||
}
|
||||
}
|
||||
#elif defined(ARMA_USE_BLAS)
|
||||
#if defined(ARMA_USE_BLAS)
|
||||
{
|
||||
arma_extra_debug_print("blas::gemv()");
|
||||
|
||||
|
||||
@@ -326,7 +326,7 @@ class herk
|
||||
|
||||
if(A.is_vec())
|
||||
{
|
||||
// work around poor handling of vectors by herk() in ATLAS 3.8.4 and standard BLAS
|
||||
// work around poor handling of vectors by herk() in standard BLAS
|
||||
|
||||
herk_vec<do_trans_A, use_alpha, use_beta>::apply(C,A,alpha,beta);
|
||||
|
||||
@@ -340,41 +340,7 @@ class herk
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
if(use_beta == true)
|
||||
{
|
||||
typedef typename std::complex<T> eT;
|
||||
|
||||
// use a temporary matrix, as we can't assume that matrix C is already symmetric
|
||||
Mat<eT> D(C.n_rows, C.n_cols, arma_nozeros_indicator());
|
||||
|
||||
herk<do_trans_A, use_alpha, false>::apply_blas_type(D,A,alpha);
|
||||
|
||||
// NOTE: assuming beta=1; this is okay for now, as currently glue_times only uses beta=1
|
||||
arrayops::inplace_plus(C.memptr(), D.memptr(), C.n_elem);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
atlas::cblas_herk<T>
|
||||
(
|
||||
atlas::CblasColMajor,
|
||||
atlas::CblasUpper,
|
||||
(do_trans_A) ? CblasConjTrans : atlas::CblasNoTrans,
|
||||
C.n_cols,
|
||||
(do_trans_A) ? A.n_rows : A.n_cols,
|
||||
(use_alpha) ? alpha : T(1),
|
||||
A.mem,
|
||||
(do_trans_A) ? A.n_rows : C.n_cols,
|
||||
(use_beta) ? beta : T(0),
|
||||
C.memptr(),
|
||||
C.n_cols
|
||||
);
|
||||
|
||||
herk_helper::inplace_conj_copy_upper_tri_to_lower_tri(C);
|
||||
}
|
||||
#elif defined(ARMA_USE_BLAS)
|
||||
#if defined(ARMA_USE_BLAS)
|
||||
{
|
||||
if(use_beta == true)
|
||||
{
|
||||
|
||||
@@ -286,7 +286,7 @@ class syrk
|
||||
|
||||
if(A.is_vec())
|
||||
{
|
||||
// work around poor handling of vectors by syrk() in ATLAS 3.8.4 and standard BLAS
|
||||
// work around poor handling of vectors by syrk() in standard BLAS
|
||||
|
||||
syrk_vec<do_trans_A, use_alpha, use_beta>::apply(C,A,alpha,beta);
|
||||
|
||||
@@ -301,39 +301,7 @@ class syrk
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
if(use_beta == true)
|
||||
{
|
||||
// use a temporary matrix, as we can't assume that matrix C is already symmetric
|
||||
Mat<eT> D(C.n_rows, C.n_cols, arma_nozeros_indicator());
|
||||
|
||||
syrk<do_trans_A, use_alpha, false>::apply_blas_type(D,A,alpha);
|
||||
|
||||
// NOTE: assuming beta=1; this is okay for now, as currently glue_times only uses beta=1
|
||||
arrayops::inplace_plus(C.memptr(), D.memptr(), C.n_elem);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
atlas::cblas_syrk<eT>
|
||||
(
|
||||
atlas::CblasColMajor,
|
||||
atlas::CblasUpper,
|
||||
(do_trans_A) ? atlas::CblasTrans : atlas::CblasNoTrans,
|
||||
C.n_cols,
|
||||
(do_trans_A) ? A.n_rows : A.n_cols,
|
||||
(use_alpha) ? alpha : eT(1),
|
||||
A.mem,
|
||||
(do_trans_A) ? A.n_rows : C.n_cols,
|
||||
(use_beta) ? beta : eT(0),
|
||||
C.memptr(),
|
||||
C.n_cols
|
||||
);
|
||||
|
||||
syrk_helper::inplace_copy_upper_tri_to_lower_tri(C);
|
||||
}
|
||||
#elif defined(ARMA_USE_BLAS)
|
||||
#if defined(ARMA_USE_BLAS)
|
||||
{
|
||||
if(use_beta == true)
|
||||
{
|
||||
|
||||
@@ -114,13 +114,7 @@ op_dot::direct_dot(const uword n_elem, const eT* const A, const eT* const B)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
arma_extra_debug_print("atlas::cblas_dot()");
|
||||
|
||||
return atlas::cblas_dot(n_elem, A, B);
|
||||
}
|
||||
#elif defined(ARMA_USE_BLAS)
|
||||
#if defined(ARMA_USE_BLAS)
|
||||
{
|
||||
arma_extra_debug_print("blas::dot()");
|
||||
|
||||
@@ -149,13 +143,7 @@ op_dot::direct_dot(const uword n_elem, const eT* const A, const eT* const B)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
arma_extra_debug_print("atlas::cblas_cx_dot()");
|
||||
|
||||
return atlas::cblas_cx_dot(n_elem, A, B);
|
||||
}
|
||||
#elif defined(ARMA_USE_BLAS)
|
||||
#if defined(ARMA_USE_BLAS)
|
||||
{
|
||||
arma_extra_debug_print("blas::dot()");
|
||||
|
||||
@@ -451,12 +439,6 @@ op_cdot::direct_cdot(const uword n_elem, const eT* const A, const eT* const B)
|
||||
|
||||
return result[0];
|
||||
}
|
||||
#elif defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
// TODO: use dedicated atlas functions cblas_cdotc_sub() and cblas_zdotc_sub() and retune threshold
|
||||
|
||||
return op_cdot::direct_cdot_arma(n_elem, A, B);
|
||||
}
|
||||
#else
|
||||
{
|
||||
return op_cdot::direct_cdot_arma(n_elem, A, B);
|
||||
|
||||
@@ -233,11 +233,7 @@ op_norm::vec_norm_1_direct_std(const Mat<eT>& X)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
return atlas::cblas_asum(N,A);
|
||||
}
|
||||
#elif defined(ARMA_USE_BLAS)
|
||||
#if defined(ARMA_USE_BLAS)
|
||||
{
|
||||
return blas::asum(N,A);
|
||||
}
|
||||
@@ -534,11 +530,7 @@ op_norm::vec_norm_2_direct_std(const Mat<eT>& X)
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ARMA_USE_ATLAS)
|
||||
{
|
||||
result = atlas::cblas_nrm2(N,A);
|
||||
}
|
||||
#elif defined(ARMA_USE_BLAS)
|
||||
#if defined(ARMA_USE_BLAS)
|
||||
{
|
||||
result = blas::nrm2(N,A);
|
||||
}
|
||||
|
||||
@@ -1,509 +0,0 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
//
|
||||
// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au)
|
||||
// Copyright 2008-2016 National ICT Australia (NICTA)
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
#ifdef ARMA_USE_ATLAS
|
||||
|
||||
|
||||
//! \namespace atlas namespace for ATLAS functions (imported from the global namespace)
|
||||
namespace atlas
|
||||
{
|
||||
|
||||
template<typename eT>
|
||||
inline static const eT& tmp_real(const eT& X) { return X; }
|
||||
|
||||
template<typename T>
|
||||
inline static const T tmp_real(const std::complex<T>& X) { return X.real(); }
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
eT
|
||||
cblas_asum(const int N, const eT* X)
|
||||
{
|
||||
arma_type_check((is_supported_blas_type<eT>::value == false));
|
||||
|
||||
if(is_float<eT>::value)
|
||||
{
|
||||
typedef float T;
|
||||
return eT( arma_wrapper(cblas_sasum)(N, (const T*)X, 1) );
|
||||
}
|
||||
else
|
||||
if(is_double<eT>::value)
|
||||
{
|
||||
typedef double T;
|
||||
return eT( arma_wrapper(cblas_dasum)(N, (const T*)X, 1) );
|
||||
}
|
||||
|
||||
return eT(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
eT
|
||||
cblas_nrm2(const int N, const eT* X)
|
||||
{
|
||||
arma_type_check((is_supported_blas_type<eT>::value == false));
|
||||
|
||||
if(is_float<eT>::value)
|
||||
{
|
||||
typedef float T;
|
||||
return eT( arma_wrapper(cblas_snrm2)(N, (const T*)X, 1) );
|
||||
}
|
||||
else
|
||||
if(is_double<eT>::value)
|
||||
{
|
||||
typedef double T;
|
||||
return eT( arma_wrapper(cblas_dnrm2)(N, (const T*)X, 1) );
|
||||
}
|
||||
|
||||
return eT(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
eT
|
||||
cblas_dot(const int N, const eT* X, const eT* Y)
|
||||
{
|
||||
arma_type_check((is_supported_blas_type<eT>::value == false));
|
||||
|
||||
if(is_float<eT>::value)
|
||||
{
|
||||
typedef float T;
|
||||
return eT( arma_wrapper(cblas_sdot)(N, (const T*)X, 1, (const T*)Y, 1) );
|
||||
}
|
||||
else
|
||||
if(is_double<eT>::value)
|
||||
{
|
||||
typedef double T;
|
||||
return eT( arma_wrapper(cblas_ddot)(N, (const T*)X, 1, (const T*)Y, 1) );
|
||||
}
|
||||
|
||||
return eT(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
arma_inline
|
||||
eT
|
||||
cblas_cx_dot(const int N, const eT* X, const eT* Y)
|
||||
{
|
||||
arma_type_check((is_supported_blas_type<eT>::value == false));
|
||||
|
||||
if(is_cx_float<eT>::value)
|
||||
{
|
||||
typedef typename std::complex<float> T;
|
||||
|
||||
T out;
|
||||
arma_wrapper(cblas_cdotu_sub)(N, (const T*)X, 1, (const T*)Y, 1, &out);
|
||||
|
||||
return eT(out);
|
||||
}
|
||||
else
|
||||
if(is_cx_double<eT>::value)
|
||||
{
|
||||
typedef typename std::complex<double> T;
|
||||
|
||||
T out;
|
||||
arma_wrapper(cblas_zdotu_sub)(N, (const T*)X, 1, (const T*)Y, 1, &out);
|
||||
|
||||
return eT(out);
|
||||
}
|
||||
|
||||
return eT(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
void
|
||||
cblas_gemv
|
||||
(
|
||||
const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA,
|
||||
const int M, const int N,
|
||||
const eT alpha,
|
||||
const eT *A, const int lda,
|
||||
const eT *X, const int incX,
|
||||
const eT beta,
|
||||
eT *Y, const int incY
|
||||
)
|
||||
{
|
||||
arma_type_check((is_supported_blas_type<eT>::value == false));
|
||||
|
||||
if(is_float<eT>::value)
|
||||
{
|
||||
typedef float T;
|
||||
arma_wrapper(cblas_sgemv)(Order, TransA, M, N, (const T)tmp_real(alpha), (const T*)A, lda, (const T*)X, incX, (const T)tmp_real(beta), (T*)Y, incY);
|
||||
}
|
||||
else
|
||||
if(is_double<eT>::value)
|
||||
{
|
||||
typedef double T;
|
||||
arma_wrapper(cblas_dgemv)(Order, TransA, M, N, (const T)tmp_real(alpha), (const T*)A, lda, (const T*)X, incX, (const T)tmp_real(beta), (T*)Y, incY);
|
||||
}
|
||||
else
|
||||
if(is_cx_float<eT>::value)
|
||||
{
|
||||
typedef std::complex<float> T;
|
||||
arma_wrapper(cblas_cgemv)(Order, TransA, M, N, (const T*)&alpha, (const T*)A, lda, (const T*)X, incX, (const T*)&beta, (T*)Y, incY);
|
||||
}
|
||||
else
|
||||
if(is_cx_double<eT>::value)
|
||||
{
|
||||
typedef std::complex<double> T;
|
||||
arma_wrapper(cblas_zgemv)(Order, TransA, M, N, (const T*)&alpha, (const T*)A, lda, (const T*)X, incX, (const T*)&beta, (T*)Y, incY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
void
|
||||
cblas_gemm
|
||||
(
|
||||
const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA,
|
||||
const enum CBLAS_TRANSPOSE TransB, const int M, const int N,
|
||||
const int K, const eT alpha, const eT *A,
|
||||
const int lda, const eT *B, const int ldb,
|
||||
const eT beta, eT *C, const int ldc
|
||||
)
|
||||
{
|
||||
arma_type_check((is_supported_blas_type<eT>::value == false));
|
||||
|
||||
if(is_float<eT>::value)
|
||||
{
|
||||
typedef float T;
|
||||
arma_wrapper(cblas_sgemm)(Order, TransA, TransB, M, N, K, (const T)tmp_real(alpha), (const T*)A, lda, (const T*)B, ldb, (const T)tmp_real(beta), (T*)C, ldc);
|
||||
}
|
||||
else
|
||||
if(is_double<eT>::value)
|
||||
{
|
||||
typedef double T;
|
||||
arma_wrapper(cblas_dgemm)(Order, TransA, TransB, M, N, K, (const T)tmp_real(alpha), (const T*)A, lda, (const T*)B, ldb, (const T)tmp_real(beta), (T*)C, ldc);
|
||||
}
|
||||
else
|
||||
if(is_cx_float<eT>::value)
|
||||
{
|
||||
typedef std::complex<float> T;
|
||||
arma_wrapper(cblas_cgemm)(Order, TransA, TransB, M, N, K, (const T*)&alpha, (const T*)A, lda, (const T*)B, ldb, (const T*)&beta, (T*)C, ldc);
|
||||
}
|
||||
else
|
||||
if(is_cx_double<eT>::value)
|
||||
{
|
||||
typedef std::complex<double> T;
|
||||
arma_wrapper(cblas_zgemm)(Order, TransA, TransB, M, N, K, (const T*)&alpha, (const T*)A, lda, (const T*)B, ldb, (const T*)&beta, (T*)C, ldc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
void
|
||||
cblas_syrk
|
||||
(
|
||||
const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans,
|
||||
const int N, const int K, const eT alpha,
|
||||
const eT* A, const int lda, const eT beta, eT* C, const int ldc
|
||||
)
|
||||
{
|
||||
arma_type_check((is_supported_blas_type<eT>::value == false));
|
||||
|
||||
if(is_float<eT>::value)
|
||||
{
|
||||
typedef float T;
|
||||
arma_wrapper(cblas_ssyrk)(Order, Uplo, Trans, N, K, (const T)alpha, (const T*)A, lda, (const T)beta, (T*)C, ldc);
|
||||
}
|
||||
else
|
||||
if(is_double<eT>::value)
|
||||
{
|
||||
typedef double T;
|
||||
arma_wrapper(cblas_dsyrk)(Order, Uplo, Trans, N, K, (const T)alpha, (const T*)A, lda, (const T)beta, (T*)C, ldc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename T>
|
||||
inline
|
||||
void
|
||||
cblas_herk
|
||||
(
|
||||
const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans,
|
||||
const int N, const int K, const T alpha,
|
||||
const std::complex<T>* A, const int lda, const T beta, std::complex<T>* C, const int ldc
|
||||
)
|
||||
{
|
||||
arma_type_check((is_supported_blas_type<T>::value == false));
|
||||
|
||||
if(is_float<T>::value)
|
||||
{
|
||||
typedef float TT;
|
||||
typedef std::complex<float> cx_TT;
|
||||
|
||||
arma_wrapper(cblas_cherk)(Order, Uplo, Trans, N, K, (const TT)alpha, (const cx_TT*)A, lda, (const TT)beta, (cx_TT*)C, ldc);
|
||||
}
|
||||
else
|
||||
if(is_double<T>::value)
|
||||
{
|
||||
typedef double TT;
|
||||
typedef std::complex<double> cx_TT;
|
||||
|
||||
arma_wrapper(cblas_zherk)(Order, Uplo, Trans, N, K, (const TT)alpha, (const cx_TT*)A, lda, (const TT)beta, (cx_TT*)C, ldc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
int
|
||||
clapack_getrf
|
||||
(
|
||||
const enum CBLAS_ORDER Order, const int M, const int N,
|
||||
eT *A, const int lda, int *ipiv
|
||||
)
|
||||
{
|
||||
arma_type_check((is_supported_blas_type<eT>::value == false));
|
||||
|
||||
if(is_float<eT>::value)
|
||||
{
|
||||
typedef float T;
|
||||
return arma_wrapper(clapack_sgetrf)(Order, M, N, (T*)A, lda, ipiv);
|
||||
}
|
||||
else
|
||||
if(is_double<eT>::value)
|
||||
{
|
||||
typedef double T;
|
||||
return arma_wrapper(clapack_dgetrf)(Order, M, N, (T*)A, lda, ipiv);
|
||||
}
|
||||
else
|
||||
if(is_cx_float<eT>::value)
|
||||
{
|
||||
typedef std::complex<float> T;
|
||||
return arma_wrapper(clapack_cgetrf)(Order, M, N, (T*)A, lda, ipiv);
|
||||
}
|
||||
else
|
||||
if(is_cx_double<eT>::value)
|
||||
{
|
||||
typedef std::complex<double> T;
|
||||
return arma_wrapper(clapack_zgetrf)(Order, M, N, (T*)A, lda, ipiv);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
int
|
||||
clapack_getri
|
||||
(
|
||||
const enum CBLAS_ORDER Order, const int N, eT *A,
|
||||
const int lda, const int *ipiv
|
||||
)
|
||||
{
|
||||
arma_type_check((is_supported_blas_type<eT>::value == false));
|
||||
|
||||
if(is_float<eT>::value)
|
||||
{
|
||||
typedef float T;
|
||||
return arma_wrapper(clapack_sgetri)(Order, N, (T*)A, lda, ipiv);
|
||||
}
|
||||
else
|
||||
if(is_double<eT>::value)
|
||||
{
|
||||
typedef double T;
|
||||
return arma_wrapper(clapack_dgetri)(Order, N, (T*)A, lda, ipiv);
|
||||
}
|
||||
else
|
||||
if(is_cx_float<eT>::value)
|
||||
{
|
||||
typedef std::complex<float> T;
|
||||
return arma_wrapper(clapack_cgetri)(Order, N, (T*)A, lda, ipiv);
|
||||
}
|
||||
else
|
||||
if(is_cx_double<eT>::value)
|
||||
{
|
||||
typedef std::complex<double> T;
|
||||
return arma_wrapper(clapack_zgetri)(Order, N, (T*)A, lda, ipiv);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
int
|
||||
clapack_gesv
|
||||
(
|
||||
const enum CBLAS_ORDER Order,
|
||||
const int N, const int NRHS,
|
||||
eT* A, const int lda, int* ipiv,
|
||||
eT* B, const int ldb
|
||||
)
|
||||
{
|
||||
arma_type_check((is_supported_blas_type<eT>::value == false));
|
||||
|
||||
if(is_float<eT>::value)
|
||||
{
|
||||
typedef float T;
|
||||
return arma_wrapper(clapack_sgesv)(Order, N, NRHS, (T*)A, lda, ipiv, (T*)B, ldb);
|
||||
}
|
||||
else
|
||||
if(is_double<eT>::value)
|
||||
{
|
||||
typedef double T;
|
||||
return arma_wrapper(clapack_dgesv)(Order, N, NRHS, (T*)A, lda, ipiv, (T*)B, ldb);
|
||||
}
|
||||
else
|
||||
if(is_cx_float<eT>::value)
|
||||
{
|
||||
typedef std::complex<float> T;
|
||||
return arma_wrapper(clapack_cgesv)(Order, N, NRHS, (T*)A, lda, ipiv, (T*)B, ldb);
|
||||
}
|
||||
else
|
||||
if(is_cx_double<eT>::value)
|
||||
{
|
||||
typedef std::complex<double> T;
|
||||
return arma_wrapper(clapack_zgesv)(Order, N, NRHS, (T*)A, lda, ipiv, (T*)B, ldb);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
int
|
||||
clapack_potrf(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const int N, eT *A, const int lda)
|
||||
{
|
||||
arma_type_check((is_supported_blas_type<eT>::value == false));
|
||||
|
||||
if(is_float<eT>::value)
|
||||
{
|
||||
typedef float T;
|
||||
return arma_wrapper(clapack_spotrf)(Order, Uplo, N, (T*)A, lda);
|
||||
}
|
||||
else
|
||||
if(is_double<eT>::value)
|
||||
{
|
||||
typedef double T;
|
||||
return arma_wrapper(clapack_dpotrf)(Order, Uplo, N, (T*)A, lda);
|
||||
}
|
||||
else
|
||||
if(is_cx_float<eT>::value)
|
||||
{
|
||||
typedef std::complex<float> T;
|
||||
return arma_wrapper(clapack_cpotrf)(Order, Uplo, N, (T*)A, lda);
|
||||
}
|
||||
else
|
||||
if(is_cx_double<eT>::value)
|
||||
{
|
||||
typedef std::complex<double> T;
|
||||
return arma_wrapper(clapack_zpotrf)(Order, Uplo, N, (T*)A, lda);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
int
|
||||
clapack_potri(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const int N, eT *A, const int lda)
|
||||
{
|
||||
arma_type_check((is_supported_blas_type<eT>::value == false));
|
||||
|
||||
if(is_float<eT>::value)
|
||||
{
|
||||
typedef float T;
|
||||
return arma_wrapper(clapack_spotri)(Order, Uplo, N, (T*)A, lda);
|
||||
}
|
||||
else
|
||||
if(is_double<eT>::value)
|
||||
{
|
||||
typedef double T;
|
||||
return arma_wrapper(clapack_dpotri)(Order, Uplo, N, (T*)A, lda);
|
||||
}
|
||||
else
|
||||
if(is_cx_float<eT>::value)
|
||||
{
|
||||
typedef std::complex<float> T;
|
||||
return arma_wrapper(clapack_cpotri)(Order, Uplo, N, (T*)A, lda);
|
||||
}
|
||||
else
|
||||
if(is_cx_double<eT>::value)
|
||||
{
|
||||
typedef std::complex<double> T;
|
||||
return arma_wrapper(clapack_zpotri)(Order, Uplo, N, (T*)A, lda);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<typename eT>
|
||||
inline
|
||||
int
|
||||
clapack_posv(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const int N, const int NRHS, eT *A, const int lda, eT *B, const int ldb)
|
||||
{
|
||||
arma_type_check((is_supported_blas_type<eT>::value == false));
|
||||
|
||||
if(is_float<eT>::value)
|
||||
{
|
||||
typedef float T;
|
||||
return arma_wrapper(clapack_sposv)(Order, Uplo, N, NRHS, (T*)A, lda, (T*)B, ldb);
|
||||
}
|
||||
else
|
||||
if(is_double<eT>::value)
|
||||
{
|
||||
typedef double T;
|
||||
return arma_wrapper(clapack_dposv)(Order, Uplo, N, NRHS, (T*)A, lda, (T*)B, ldb);
|
||||
}
|
||||
else
|
||||
if(is_cx_float<eT>::value)
|
||||
{
|
||||
typedef std::complex<float> T;
|
||||
return arma_wrapper(clapack_cposv)(Order, Uplo, N, NRHS, (T*)A, lda, (T*)B, ldb);
|
||||
}
|
||||
else
|
||||
if(is_cx_double<eT>::value)
|
||||
{
|
||||
typedef std::complex<double> T;
|
||||
return arma_wrapper(clapack_zposv)(Order, Uplo, N, NRHS, (T*)A, lda, (T*)B, ldb);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user