32 #ifndef REMORA_KERNELS_CBLAS_SYRK_HPP 33 #define REMORA_KERNELS_CBLAS_SYRK_HPP 36 #include <type_traits> 38 namespace remora{
namespace bindings {
41 CBLAS_ORDER
const order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE trans,
43 float alpha,
float const *A,
int lda,
44 float beta,
float *C,
int ldc
55 CBLAS_ORDER
const order, CBLAS_UPLO uplo, CBLAS_TRANSPOSE trans,
57 double alpha,
double const *A,
int lda,
58 double beta,
double *C,
int ldc
70 template <
bool Upper,
typename MatA,
typename MatC>
72 matrix_expression<MatA, cpu_tag>
const& A,
73 matrix_expression<MatC, cpu_tag>& C,
74 typename MatC::value_type alpha,
77 REMORA_SIZE_CHECK(A().size1() == C().size1());
78 REMORA_SIZE_CHECK(C().size1() == C().size2());
80 CBLAS_ORDER stor_ord = (CBLAS_ORDER) storage_order<typename MatC::orientation >::value;
81 CBLAS_UPLO uplo = Upper?CblasUpper: CblasLower;
82 CBLAS_TRANSPOSE trans = std::is_same<typename MatA::orientation,typename MatC::orientation>::value?CblasNoTrans:CblasTrans;
83 std::size_t n = C().size1();
84 std::size_t k = A().size2();
87 auto storageA = A().raw_storage();
88 auto storageC = C().raw_storage();
89 syrk(stor_ord, uplo, trans,
90 (
int)n, (
int)k, alpha,
92 storageA.leading_dimension,
93 typename MatC::value_type(1),
95 storageC.leading_dimension
99 template<
class M1,
class M2>
100 struct has_optimized_syrk: std::integral_constant<bool,
101 allowed_cblas_type<typename M1::value_type>::type::value
102 && std::is_same<typename M1::value_type, typename M2::value_type>::value
103 && std::is_base_of<dense_tag, typename M1::storage_type::storage_tag>::value
104 && std::is_base_of<dense_tag, typename M2::storage_type::storage_tag>::value