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_ARMADILLO
60 template<
typename NumericT,
typename VectorT>
61 VectorT
prod(arma::SpMat<NumericT>
const& A, VectorT
const& vector)
67 #ifdef VIENNACL_WITH_EIGEN
71 template<
typename MatrixT,
typename VectorT >
74 prod(MatrixT
const& matrix, VectorT
const& vector)
76 return matrix * vector;
80 #ifdef VIENNACL_WITH_UBLAS
84 template<
typename MatrixT,
typename VectorT >
87 prod(MatrixT
const& matrix, VectorT
const& vector)
100 template<
typename T,
typename A1,
typename A2,
typename VectorT >
104 VectorT result(
matrix.size());
105 for (
typename std::vector<T, A1>::size_type i=0; i<
matrix.size(); ++i)
108 for (
typename std::vector<T, A1>::size_type j=0; j<
matrix[i].size(); ++j)
109 result[i] +=
matrix[i][j] * vector[j];
115 template<
typename KEY,
typename DATA,
typename COMPARE,
typename AMAP,
typename AVEC,
typename VectorT >
117 prod(std::vector< std::map<KEY, DATA, COMPARE, AMAP>, AVEC >
const&
matrix, VectorT
const&
vector)
119 typedef std::vector< std::map<KEY, DATA, COMPARE, AMAP>, AVEC > MatrixType;
121 VectorT result(
matrix.size());
122 for (
typename MatrixType::size_type i=0; i<
matrix.size(); ++i)
125 for (
typename std::map<KEY, DATA, COMPARE, AMAP>::const_iterator row_entries =
matrix[i].begin();
126 row_entries !=
matrix[i].end();
128 result[i] += row_entries->second * vector[row_entries->first];
149 template<
typename NumericT>
162 template<
typename NumericT,
typename LhsT,
typename RhsT,
typename OpT>
175 template<
typename LhsT,
typename RhsT,
typename OpT,
typename NumericT>
189 template<
typename LhsT1,
typename RhsT1,
typename OpT1,
190 typename LhsT2,
typename RhsT2,
typename OpT2>
205 template<
typename NumericT>
218 template<
typename NumericT,
typename F>
231 template<
typename MatrixT,
typename NumericT>
244 template<
typename MatrixT,
typename NumericT>
257 template<
typename NumericT,
typename LhsT,
typename RhsT,
typename OpT>
271 template<
typename NumericT,
typename LhsT,
typename RhsT,
typename OpT>
285 template<
typename LhsT1,
typename RhsT1,
typename OpT1,
286 typename LhsT2,
typename RhsT2,
typename OpT2>
301 template<
typename SparseMatrixType,
typename SCALARTYPE>
307 prod(
const SparseMatrixType & sp_mat,
316 template<
typename SparseMatrixType,
typename SCALARTYPE>
324 prod(
const SparseMatrixType & A,
338 template<
typename NumericT>
351 template<
typename SparseMatrixType,
typename NumericT>
355 prod(
const SparseMatrixType & A,
Simple enable-if variant that uses the SFINAE pattern.
Dispatch facility for distinguishing between ublas, STL and ViennaCL types.
Class for representing strided submatrices of a bigger matrix A.
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. ...
void prod(std::vector< std::map< IndexT, NumericT > > const &stl_A, std::vector< std::map< IndexT, NumericT > > const &stl_B, std::vector< std::map< IndexT, NumericT > > &stl_C)
A tag class representing transposed matrices.
Class for representing non-strided submatrices of a bigger matrix A.
Simple enable-if variant that uses the SFINAE pattern.