31 #ifndef ELEMENTWISE_PRODUCT_IMPL_H_
32 #define ELEMENTWISE_PRODUCT_IMPL_H_
41 #include <viennacl/linalg/matrix_operations.hpp>
42 #endif // HAVE_VIENNACL
50 namespace implementation
56 template <enum Backend,
class Matrix>
60 typedef typename Matrix::Scalar
T;
63 static void compute(Matrix A, Matrix B, Matrix C);
68 template <
class Matrix>
72 typedef typename Matrix::Scalar
T;
96 "Dimension mismatch! A(%d x %d) vs B(%d x %d)\n",
123 C_eig = A_eig.array() * B_eig.array();
130 template <
class Matrix>
131 struct elementwise_product<Backend::VIENNACL, Matrix>
134 typedef typename Matrix::Scalar
T;
137 typedef CGPUMatrix<T> ReturnType;
149 static ReturnType
compute(CGPUMatrix<T> A, CGPUMatrix<T> B)
151 REQUIRE(A.matrix,
"Matrix A is not initialized!\n");
152 REQUIRE(B.matrix,
"Matrix A is not initialized!\n");
154 REQUIRE(A.num_rows == B.num_rows && A.num_cols == B.num_cols,
155 "Dimension mismatch! A(%d x %d) vs B(%d x %d)\n",
156 A.num_rows, A.num_cols, B.num_rows, B.num_cols);
158 ReturnType retMatrix(A.num_rows, A.num_cols);
176 static void compute(CGPUMatrix<T> A, CGPUMatrix<T> B, CGPUMatrix<T> C)
178 C.vcl_matrix() = viennacl::linalg::element_prod(A.vcl_matrix(), B.vcl_matrix());
182 #endif // HAVE_VIENNACL
189 #endif // ELEMENTWISE_PRODUCT_IMPL_H_
static void compute(Matrix A, Matrix B, Matrix C)
static ReturnType compute(SGMatrix< T > A, SGMatrix< T > B)
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > MatrixXt
all of classes and functions are contained in the shogun namespace
static void compute(SGMatrix< T > A, SGMatrix< T > B, SGMatrix< T > C)