10#ifndef EIGEN_SPARSESPARSEPRODUCTWITHPRUNING_H
11#define EIGEN_SPARSESPARSEPRODUCTWITHPRUNING_H
19template<
typename Lhs,
typename Rhs,
typename ResultType>
20static void sparse_sparse_product_with_pruning_impl(
const Lhs& lhs,
const Rhs& rhs, ResultType&
res,
const typename ResultType::RealScalar& tolerance)
24 typedef typename remove_all<Rhs>::type::Scalar RhsScalar;
25 typedef typename remove_all<ResultType>::type::Scalar ResScalar;
26 typedef typename remove_all<Lhs>::type::StorageIndex StorageIndex;
35 AmbiVector<ResScalar,StorageIndex> tempVector(
rows);
38 if(ResultType::IsRowMajor)
43 evaluator<Lhs> lhsEval(lhs);
44 evaluator<Rhs> rhsEval(rhs);
52 Index estimated_nnz_prod = lhsEval.nonZerosEstimate() + rhsEval.nonZerosEstimate();
54 res.reserve(estimated_nnz_prod);
55 double ratioColRes = double(estimated_nnz_prod)/(double(lhs.rows())*double(rhs.cols()));
61 tempVector.init(ratioColRes);
63 for (
typename evaluator<Rhs>::InnerIterator rhsIt(rhsEval,
j); rhsIt; ++rhsIt)
67 RhsScalar
x = rhsIt.value();
68 for (
typename evaluator<Lhs>::InnerIterator lhsIt(lhsEval, rhsIt.index()); lhsIt; ++lhsIt)
70 tempVector.coeffRef(lhsIt.index()) += lhsIt.value() *
x;
74 for (
typename AmbiVector<ResScalar,StorageIndex>::Iterator it(tempVector,tolerance); it; ++it)
75 res.insertBackByOuterInner(
j,it.index()) = it.value();
80template<
typename Lhs,
typename Rhs,
typename ResultType,
81 int LhsStorageOrder = traits<Lhs>::Flags&
RowMajorBit,
82 int RhsStorageOrder = traits<Rhs>::Flags&
RowMajorBit,
83 int ResStorageOrder = traits<ResultType>::Flags&
RowMajorBit>
86template<
typename Lhs,
typename Rhs,
typename ResultType>
99template<
typename Lhs,
typename Rhs,
typename ResultType>
113template<
typename Lhs,
typename Rhs,
typename ResultType>
126template<
typename Lhs,
typename Rhs,
typename ResultType>
146template<
typename Lhs,
typename Rhs,
typename ResultType>
158template<
typename Lhs,
typename Rhs,
typename ResultType>
170template<
typename Lhs,
typename Rhs,
typename ResultType>
182template<
typename Lhs,
typename Rhs,
typename ResultType>
#define eigen_assert(x)
Definition Macros.h:1037
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
Definition PartialRedux_count.cpp:3
int rows
Definition Tutorial_commainit_02.cpp:1
int cols
Definition Tutorial_commainit_02.cpp:1
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition gnuplot_common_settings.hh:12
@ ColMajor
Definition Constants.h:319
@ RowMajor
Definition Constants.h:321
const unsigned int RowMajorBit
Definition Constants.h:66
@ Lhs
Definition TensorContractionMapper.h:19
@ Rhs
Definition TensorContractionMapper.h:18
Namespace containing all symbols from the Eigen library.
Definition bench_norm.cpp:85
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition Meta.h:74
Definition BandTriangularSolver.h:13
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res, const RealScalar &tolerance)
Definition SparseSparseProductWithPruning.h:103
ResultType::RealScalar RealScalar
Definition SparseSparseProductWithPruning.h:102
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res, const RealScalar &tolerance)
Definition SparseSparseProductWithPruning.h:117
ResultType::RealScalar RealScalar
Definition SparseSparseProductWithPruning.h:116
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res, const RealScalar &tolerance)
Definition SparseSparseProductWithPruning.h:130
ResultType::RealScalar RealScalar
Definition SparseSparseProductWithPruning.h:129
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res, const RealScalar &tolerance)
Definition SparseSparseProductWithPruning.h:174
ResultType::RealScalar RealScalar
Definition SparseSparseProductWithPruning.h:173
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res, const RealScalar &tolerance)
Definition SparseSparseProductWithPruning.h:150
ResultType::RealScalar RealScalar
Definition SparseSparseProductWithPruning.h:149
ResultType::RealScalar RealScalar
Definition SparseSparseProductWithPruning.h:89
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res, const RealScalar &tolerance)
Definition SparseSparseProductWithPruning.h:91
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res, const RealScalar &tolerance)
Definition SparseSparseProductWithPruning.h:186
ResultType::RealScalar RealScalar
Definition SparseSparseProductWithPruning.h:185
ResultType::RealScalar RealScalar
Definition SparseSparseProductWithPruning.h:161
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res, const RealScalar &tolerance)
Definition SparseSparseProductWithPruning.h:162
Definition SparseSparseProductWithPruning.h:84
Definition ForwardDeclarations.h:17
std::ptrdiff_t j
Definition tut_arithmetic_redux_minmax.cpp:2