32 #ifndef REMORA_KERNELS_CBLAS_TPMV_HPP 33 #define REMORA_KERNELS_CBLAS_TPMV_HPP 36 #include <type_traits> 38 namespace remora{
namespace bindings {
41 CBLAS_ORDER
const Order,
42 CBLAS_UPLO
const uplo,
43 CBLAS_TRANSPOSE
const transA,
44 CBLAS_DIAG
const unit,
47 float* X,
int const incX
49 cblas_stpmv(Order, uplo, transA, unit, N,
56 CBLAS_ORDER
const Order,
57 CBLAS_UPLO
const uplo,
58 CBLAS_TRANSPOSE
const transA,
59 CBLAS_DIAG
const unit,
62 double* X,
int const incX
64 cblas_dtpmv(Order, uplo, transA, unit, N,
72 CBLAS_ORDER
const Order,
73 CBLAS_UPLO
const uplo,
74 CBLAS_TRANSPOSE
const transA,
75 CBLAS_DIAG
const unit,
77 std::complex<float>
const *A,
78 std::complex<float>* X,
int const incX
80 cblas_ctpmv(Order, uplo, transA, unit, N,
81 reinterpret_cast<cblas_float_complex_type const *>(A),
82 reinterpret_cast<cblas_float_complex_type *>(X), incX
87 CBLAS_ORDER
const Order,
88 CBLAS_UPLO
const uplo,
89 CBLAS_TRANSPOSE
const transA,
90 CBLAS_DIAG
const unit,
92 std::complex<double>
const *A,
93 std::complex<double>* X,
int const incX
95 cblas_ztpmv(Order, uplo, transA, unit, N,
96 reinterpret_cast<cblas_double_complex_type const *>(A),
97 reinterpret_cast<cblas_double_complex_type *>(X), incX
101 template <
typename MatA,
typename VectorX>
103 matrix_expression<MatA, cpu_tag>
const& A,
104 vector_expression<VectorX, cpu_tag> &x,
107 REMORA_SIZE_CHECK(x().size() == A().size2());
108 REMORA_SIZE_CHECK(A().size2() == A().size1());
109 bool upper = MatA::orientation::triangular_type::is_upper;
110 bool unit = MatA::orientation::triangular_type::is_unit;
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 MatA::orientation::orientation>::value;
116 auto storageA = A().raw_storage();
117 auto storagex = x().raw_storage();
118 tpmv(stor_ord, cblasUplo, CblasNoTrans, cblasUnit, (
int)n,
125 template<
class M,
class V>
126 struct has_optimized_tpmv: std::integral_constant<bool,
127 allowed_cblas_type<typename M::value_type>::type::value
128 && std::is_same<typename M::value_type, typename V::value_type>::value
129 && std::is_base_of<packed_tag, typename M::storage_type::storage_tag>::value
130 && std::is_base_of<dense_tag, typename V::storage_type::storage_tag>::value