1 #ifndef VIENNACL_LINALG_PROD_HPP_
2 #define VIENNACL_LINALG_PROD_HPP_
43 #ifdef VIENNACL_WITH_MTL4
47 template<
typename MatrixT,
typename VectorT >
50 prod(MatrixT
const& matrix, VectorT
const& vector)
52 return VectorT(matrix * vector);
56 #ifdef VIENNACL_WITH_EIGEN
60 template<
typename MatrixT,
typename VectorT >
63 prod(MatrixT
const& matrix, VectorT
const& vector)
65 return matrix * vector;
69 #ifdef VIENNACL_WITH_UBLAS
73 template<
typename MatrixT,
typename VectorT >
76 prod(MatrixT
const& matrix, VectorT
const& vector)
89 template<
typename T,
typename A1,
typename A2,
typename VectorT >
93 VectorT result(
matrix.size());
94 for (
typename std::vector<T, A1>::size_type i=0; i<
matrix.size(); ++i)
97 for (
typename std::vector<T, A1>::size_type j=0; j<
matrix[i].size(); ++j)
98 result[i] +=
matrix[i][j] * vector[j];
104 template<
typename KEY,
typename DATA,
typename COMPARE,
typename AMAP,
typename AVEC,
typename VectorT >
106 prod(std::vector< std::map<KEY, DATA, COMPARE, AMAP>, AVEC >
const&
matrix, VectorT
const&
vector)
108 typedef std::vector< std::map<KEY, DATA, COMPARE, AMAP>, AVEC > MatrixType;
110 VectorT result(
matrix.size());
111 for (
typename MatrixType::size_type i=0; i<
matrix.size(); ++i)
114 for (
typename std::map<KEY, DATA, COMPARE, AMAP>::const_iterator row_entries =
matrix[i].begin();
115 row_entries !=
matrix[i].end();
117 result[i] += row_entries->second * vector[row_entries->first];
138 template<
typename NumericT>
152 template<
typename NumericT>
172 template<
typename NumericT>
187 const viennacl::matrix_base<NumericT>,
193 template<
typename NumericT>
213 const viennacl::matrix_base<NumericT>,
221 template<
typename NumericT>
235 template<
typename NumericT>
255 template<
typename SparseMatrixType,
class SCALARTYPE>
261 prod(
const SparseMatrixType & mat,
269 template<
typename SparseMatrixType,
typename SCALARTYPE>
275 prod(
const SparseMatrixType & sp_mat,
284 template<
typename SparseMatrixType,
typename SCALARTYPE>
292 prod(
const SparseMatrixType & A,
304 template<
typename StructuredMatrixType,
class SCALARTYPE>
310 prod(
const StructuredMatrixType & mat,
Simple enable-if variant that uses the SFINAE pattern.
Dispatch facility for distinguishing between ublas, STL and ViennaCL types.
viennacl::enable_if< viennacl::is_any_dense_structured_matrix< StructuredMatrixType >::value, vector_expression< const StructuredMatrixType, const vector_base< SCALARTYPE >, op_prod > >::type prod(const StructuredMatrixType &mat, const vector_base< SCALARTYPE > &vec)
Expression template class for representing a tree of expressions which ultimately result in a matrix...
This file provides the forward declarations for the main types used within ViennaCL.
An expression template class that represents a binary operation that yields a vector.
VectorT prod(std::vector< std::vector< T, A1 >, A2 > const &matrix, VectorT const &vector)
A tag class representing matrix-matrix products.
A tag class representing matrix-vector products and element-wise multiplications. ...
A tag class representing transposed matrices.
Simple enable-if variant that uses the SFINAE pattern.