32 #ifndef SHARK_LINALG_BLAS_KERNELS_CBLAS_TRMV_HPP 33 #define SHARK_LINALG_BLAS_KERNELS_CBLAS_TRMV_HPP 36 #include "../../matrix_proxy.hpp" 37 #include "../../vector_expression.hpp" 38 #include <boost/mpl/bool.hpp> 40 namespace shark {
namespace blas {
namespace bindings {
43 CBLAS_ORDER
const Order,
44 CBLAS_UPLO
const uplo,
45 CBLAS_TRANSPOSE
const transA,
46 CBLAS_DIAG
const unit,
48 float const *A,
int const lda,
49 float* X,
int const incX
51 cblas_strmv(Order, uplo, transA, unit, N,
58 CBLAS_ORDER
const Order,
59 CBLAS_UPLO
const uplo,
60 CBLAS_TRANSPOSE
const transA,
61 CBLAS_DIAG
const unit,
63 double const *A,
int const lda,
64 double* X,
int const incX
66 cblas_dtrmv(Order, uplo, transA, unit, N,
74 CBLAS_ORDER
const Order,
75 CBLAS_UPLO
const uplo,
76 CBLAS_TRANSPOSE
const transA,
77 CBLAS_DIAG
const unit,
79 std::complex<float>
const *A,
int const lda,
80 std::complex<float>* X,
int const incX
82 cblas_ctrmv(Order, uplo, transA, unit, N,
83 reinterpret_cast<cblas_float_complex_type const *>(A), lda,
84 reinterpret_cast<cblas_float_complex_type *>(X), incX
89 CBLAS_ORDER
const Order,
90 CBLAS_UPLO
const uplo,
91 CBLAS_TRANSPOSE
const transA,
92 CBLAS_DIAG
const unit,
94 std::complex<double>
const *A,
int const lda,
95 std::complex<double>* X,
int const incX
97 cblas_ztrmv(Order, uplo, transA, unit, N,
98 reinterpret_cast<cblas_double_complex_type const *>(A), lda,
99 reinterpret_cast<cblas_double_complex_type *>(X), incX
103 template <
bool upper,
bool unit,
typename MatrA,
typename VectorX>
105 matrix_expression<MatrA>
const& A,
106 vector_expression<VectorX> &x,
111 std::size_t n = A().size1();
112 CBLAS_DIAG cblasUnit = unit?CblasUnit:CblasNonUnit;
113 CBLAS_UPLO cblasUplo = upper?CblasUpper:CblasLower;
114 CBLAS_ORDER stor_ord= (CBLAS_ORDER)storage_order<typename MatrA::orientation>::value;
116 trmv(stor_ord, cblasUplo, CblasNoTrans, cblasUnit, (
int)n,
118 traits::leading_dimension(A),
124 template<
class Storage1,
class Storage2,
class T1,
class T2>
125 struct optimized_trmv_detail{
126 typedef boost::mpl::false_ type;
129 struct optimized_trmv_detail<
130 dense_tag, dense_tag,
133 typedef boost::mpl::true_ type;
136 struct optimized_trmv_detail<
137 dense_tag, dense_tag,
140 typedef boost::mpl::true_ type;
144 struct optimized_trmv_detail<
145 dense_tag, dense_tag,
146 std::complex<double>, std::complex<double>
148 typedef boost::mpl::true_ type;
151 struct optimized_trmv_detail<
152 dense_tag, dense_tag,
153 std::complex<float>, std::complex<float>
155 typedef boost::mpl::true_ type;
158 template<
class M1,
class M2>
159 struct has_optimized_trmv
160 :
public optimized_trmv_detail<
161 typename M1::storage_category,
162 typename M2::storage_category,
163 typename M1::value_type,
164 typename M2::value_type