32 #ifndef SHARK_LINALG_BLAS_KERNELS_CBLAS_TPMV_HPP 33 #define SHARK_LINALG_BLAS_KERNELS_CBLAS_TPMV_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,
49 float* X,
int const incX
51 cblas_stpmv(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,
64 double* X,
int const incX
66 cblas_dtpmv(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,
80 std::complex<float>* X,
int const incX
82 cblas_ctpmv(Order, uplo, transA, unit, N,
83 reinterpret_cast<cblas_float_complex_type const *>(A),
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,
95 std::complex<double>* X,
int const incX
97 cblas_ztpmv(Order, uplo, transA, unit, N,
98 reinterpret_cast<cblas_double_complex_type const *>(A),
99 reinterpret_cast<cblas_double_complex_type *>(X), incX
103 template <
typename TriangularA,
typename VectorX>
105 matrix_expression<TriangularA>
const& A,
106 vector_expression<VectorX> &x,
111 bool upper = TriangularA::orientation::triangular_type::is_upper;
112 bool unit = TriangularA::orientation::triangular_type::is_unit;
113 std::size_t n = A().size1();
114 CBLAS_DIAG cblasUnit = unit?CblasUnit:CblasNonUnit;
115 CBLAS_UPLO cblasUplo = upper?CblasUpper:CblasLower;
116 CBLAS_ORDER stor_ord= (CBLAS_ORDER)storage_order<typename TriangularA::orientation::orientation>::value;
118 tpmv(stor_ord, cblasUplo, CblasNoTrans, cblasUnit, (
int)n,
125 template<
class Storage1,
class Storage2,
class T1,
class T2>
126 struct optimized_tpmv_detail{
127 typedef boost::mpl::false_ type;
130 struct optimized_tpmv_detail<
131 packed_tag, dense_tag,
134 typedef boost::mpl::true_ type;
137 struct optimized_tpmv_detail<
138 packed_tag, dense_tag,
141 typedef boost::mpl::true_ type;
145 struct optimized_tpmv_detail<
146 packed_tag, dense_tag,
147 std::complex<double>, std::complex<double>
149 typedef boost::mpl::true_ type;
152 struct optimized_tpmv_detail<
153 packed_tag, dense_tag,
154 std::complex<float>, std::complex<float>
156 typedef boost::mpl::true_ type;
159 template<
class M,
class V>
160 struct has_optimized_tpmv
161 :
public optimized_tpmv_detail<
162 typename M::storage_category,
163 typename V::storage_category,
164 typename M::value_type,
165 typename V::value_type