45 #include <viennacl/linalg/matrix_operations.hpp>
46 #include <viennacl/linalg/vector_operations.hpp>
47 #endif // HAVE_VIENNACL
55 namespace implementation
59 template <enum Backend,
class Matrix>
63 typedef typename Matrix::Scalar
T;
66 static void compute(Matrix A, Matrix B, Matrix C, T alpha, T beta);
70 template<
class Matrix>
71 struct scale<Backend::NATIVE, Matrix>
73 typedef typename Matrix::Scalar
T;
79 "Dimensions of A(%dx%d) and B(%dx%d) don't match.",
89 "equal to number of elements in (%d)!", A.
vlen, B.
vlen);
97 REQUIRE(A!=NULL&&B!=NULL,
"Invalid pointers to matrices.");
107 template <
class Matrix>
108 struct scale<Backend::EIGEN3, Matrix>
111 typedef typename Matrix::Scalar
T;
125 B_eig = alpha * A_eig;
134 B_eig = alpha * A_eig;
137 #endif // HAVE_EIGEN3
142 template <
class Matrix>
143 struct scale<Backend::VIENNACL, Matrix>
146 typedef typename Matrix::Scalar
T;
149 static void compute(CGPUMatrix<T> A, CGPUMatrix<T> B, T alpha)
151 B.vcl_matrix() = alpha*A.vcl_matrix();
155 static void compute(CGPUVector<T> A, CGPUVector<T> B, T alpha)
157 B.vcl_vector() = alpha*A.vcl_vector();
161 #endif // HAVE_VIENNACL
168 #endif // SCALE_IMPL_H_
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > MatrixXt
static void compute(SGMatrix< T > A, SGMatrix< T > B, T alpha)
static void compute(T *A, T *B, index_t len, T alpha)
static void compute(SGVector< T > A, SGVector< T > B, T alpha)
all of classes and functions are contained in the shogun namespace
void scale(Matrix A, Matrix B, typename Matrix::Scalar alpha)
static void compute(Matrix A, Matrix B, Matrix C, T alpha, T beta)
Eigen::Matrix< T, Eigen::Dynamic, 1 > VectorXt
static void compute(SGMatrix< T > A, SGMatrix< T > B, T alpha)
static void compute(SGVector< T > A, SGVector< T > B, T alpha)