45 #include <viennacl/linalg/matrix_operations.hpp>
46 #include <viennacl/linalg/vector_operations.hpp>
47 #endif // HAVE_VIENNACL
49 #include <type_traits>
57 namespace implementation
63 template <enum Backend,
class Matrix,
class Vector>
72 template <
class Matrix,
class Vector>
73 struct apply<Backend::EIGEN3, Matrix, Vector>
75 static_assert(std::is_same<typename Matrix::Scalar,typename Vector::Scalar>::value,
76 "Different numeric scalar types for matrix and vector not allowed!\n");
79 typedef typename Matrix::Scalar T;
97 compute(A, b, x, transpose);
115 x_eig=A_eig.transpose()*b_eig;
120 #endif // HAVE_EIGEN3
126 template <
class Matrix,
class Vector>
127 struct apply<Backend::VIENNACL, Matrix, Vector>
129 static_assert(std::is_same<typename Matrix::Scalar,typename Vector::Scalar>::value,
130 "Different numeric scalar types for matrix and vector not allowed!\n");
133 typedef typename Matrix::Scalar T;
142 static CGPUVector<T> compute(CGPUMatrix<T> A, CGPUVector<T> b,
bool transpose)
144 CGPUVector<T> x(A.num_rows);
145 compute(A, b, x, transpose);
156 static void compute(CGPUMatrix<T> A, CGPUVector<T> b, CGPUVector<T> x,
bool transpose)
159 x.vcl_vector()=viennacl::linalg::prod(viennacl::trans(A.vcl_matrix()), b.vcl_vector());
161 x.vcl_vector()=viennacl::linalg::prod(A.vcl_matrix(), b.vcl_vector());
164 #endif // HAVE_VIENNACL
171 #endif // APPLY_IMPL_H_
Generic class which is specialized for different backends to perform apply.
all of classes and functions are contained in the shogun namespace