31 #ifndef ELEMENTWISE_PRODUCT_IMPL_H_
32 #define ELEMENTWISE_PRODUCT_IMPL_H_
43 #include <viennacl/linalg/matrix_operations.hpp>
44 #endif // HAVE_VIENNACL
52 namespace implementation
58 template <enum Backend,
class Matrix>
62 typedef typename Matrix::Scalar
T;
65 static void compute(Matrix A, Matrix B, Matrix C);
71 template <
class Matrix>
75 typedef typename Matrix::Scalar
T;
99 "Dimension mismatch! A(%d x %d) vs B(%d x %d)\n",
126 C_eig = A_eig.array() * B_eig.array();
129 #endif // HAVE_EIGEN3
134 template <
class Matrix>
135 struct elementwise_product<Backend::VIENNACL, Matrix>
138 typedef typename Matrix::Scalar
T;
141 typedef CGPUMatrix<T> ReturnType;
153 static ReturnType
compute(CGPUMatrix<T> A, CGPUMatrix<T> B)
155 REQUIRE(A.matrix,
"Matrix A is not initialized!\n");
156 REQUIRE(B.matrix,
"Matrix A is not initialized!\n");
158 REQUIRE(A.num_rows == B.num_rows && A.num_cols == B.num_cols,
159 "Dimension mismatch! A(%d x %d) vs B(%d x %d)\n",
160 A.num_rows, A.num_cols, B.num_rows, B.num_cols);
162 ReturnType retMatrix(A.num_rows, A.num_cols);
180 static void compute(CGPUMatrix<T> A, CGPUMatrix<T> B, CGPUMatrix<T> C)
182 C.vcl_matrix() = viennacl::linalg::element_prod(A.vcl_matrix(), B.vcl_matrix());
186 #endif // HAVE_VIENNACL
193 #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)