10#ifndef EIGEN_CONSERVATIVESPARSESPARSEPRODUCT_H
11#define EIGEN_CONSERVATIVESPARSESPARSEPRODUCT_H
17template<
typename Lhs,
typename Rhs,
typename ResultType>
18static void conservative_sparse_sparse_product_impl(
const Lhs& lhs,
const Rhs& rhs, ResultType&
res,
bool sortedInsertion =
false)
20 typedef typename remove_all<Lhs>::type::Scalar LhsScalar;
21 typedef typename remove_all<Rhs>::type::Scalar RhsScalar;
22 typedef typename remove_all<ResultType>::type::Scalar ResScalar;
33 std::memset(mask,0,
sizeof(
bool)*
rows);
35 evaluator<Lhs> lhsEval(lhs);
36 evaluator<Rhs> rhsEval(rhs);
44 Index estimated_nnz_prod = lhsEval.nonZerosEstimate() + rhsEval.nonZerosEstimate();
47 res.reserve(
Index(estimated_nnz_prod));
54 for (
typename evaluator<Rhs>::InnerIterator rhsIt(rhsEval,
j); rhsIt; ++rhsIt)
56 RhsScalar
y = rhsIt.value();
57 Index k = rhsIt.index();
58 for (
typename evaluator<Lhs>::InnerIterator lhsIt(lhsEval, k); lhsIt; ++lhsIt)
61 LhsScalar
x = lhsIt.value();
76 for(
Index k=0; k<nnz; ++k)
79 res.insertBackByOuterInnerUnordered(
j,
i) = values[
i];
95 if((nnz<200 && nnz<t200) || nnz *
numext::log2(
int(nnz)) < t)
97 if(nnz>1) std::sort(indices,indices+nnz);
98 for(
Index k=0; k<nnz; ++k)
101 res.insertBackByOuterInner(
j,
i) = values[
i];
113 res.insertBackByOuterInner(
j,
i) = values[
i];
127template<
typename Lhs,
typename Rhs,
typename ResultType,
133template<
typename Lhs,
typename Rhs,
typename ResultType>
137 typedef typename LhsCleaned::Scalar
Scalar;
148 if(lhs.rows()>rhs.cols())
166template<
typename Lhs,
typename Rhs,
typename ResultType>
180template<
typename Lhs,
typename Rhs,
typename ResultType>
194template<
typename Lhs,
typename Rhs,
typename ResultType>
207template<
typename Lhs,
typename Rhs,
typename ResultType>
221template<
typename Lhs,
typename Rhs,
typename ResultType>
235template<
typename Lhs,
typename Rhs,
typename ResultType>
249template<
typename Lhs,
typename Rhs,
typename ResultType>
269template<
typename Lhs,
typename Rhs,
typename ResultType>
270static void sparse_sparse_to_dense_product_impl(
const Lhs& lhs,
const Rhs& rhs, ResultType&
res)
272 typedef typename remove_all<Lhs>::type::Scalar LhsScalar;
273 typedef typename remove_all<Rhs>::type::Scalar RhsScalar;
277 evaluator<Lhs> lhsEval(lhs);
278 evaluator<Rhs> rhsEval(rhs);
282 for (
typename evaluator<Rhs>::InnerIterator rhsIt(rhsEval,
j); rhsIt; ++rhsIt)
284 RhsScalar
y = rhsIt.value();
285 Index k = rhsIt.index();
286 for (
typename evaluator<Lhs>::InnerIterator lhsIt(lhsEval, k); lhsIt; ++lhsIt)
289 LhsScalar
x = lhsIt.value();
301template<
typename Lhs,
typename Rhs,
typename ResultType,
306template<
typename Lhs,
typename Rhs,
typename ResultType>
315template<
typename Lhs,
typename Rhs,
typename ResultType>
326template<
typename Lhs,
typename Rhs,
typename ResultType>
337template<
typename Lhs,
typename Rhs,
typename ResultType>
int i
Definition BiCGSTAB_step_by_step.cpp:9
#define eigen_assert(x)
Definition Macros.h:1037
#define ei_declare_aligned_stack_constructed_variable(TYPE, NAME, SIZE, BUFFER)
Definition Memory.h:768
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
SCALAR Scalar
Definition bench_gemm.cpp:46
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
const Scalar & y
Definition MathFunctions.h:821
@ Lhs
Definition TensorContractionMapper.h:19
@ Rhs
Definition TensorContractionMapper.h:18
int log2(int x)
Definition MathFunctions.h:1441
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)
Definition ConservativeSparseSparseProduct.h:224
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res)
Definition ConservativeSparseSparseProduct.h:238
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res)
Definition ConservativeSparseSparseProduct.h:252
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res)
Definition ConservativeSparseSparseProduct.h:169
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res)
Definition ConservativeSparseSparseProduct.h:197
traits< typenameremove_all< Lhs >::type >::Scalar Scalar
Definition ConservativeSparseSparseProduct.h:210
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res)
Definition ConservativeSparseSparseProduct.h:212
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res)
Definition ConservativeSparseSparseProduct.h:139
LhsCleaned::Scalar Scalar
Definition ConservativeSparseSparseProduct.h:137
remove_all< Lhs >::type LhsCleaned
Definition ConservativeSparseSparseProduct.h:136
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res)
Definition ConservativeSparseSparseProduct.h:183
Definition ConservativeSparseSparseProduct.h:131
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res)
Definition ConservativeSparseSparseProduct.h:329
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res)
Definition ConservativeSparseSparseProduct.h:309
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res)
Definition ConservativeSparseSparseProduct.h:318
static void run(const Lhs &lhs, const Rhs &rhs, ResultType &res)
Definition ConservativeSparseSparseProduct.h:340
Definition ConservativeSparseSparseProduct.h:304
Definition ForwardDeclarations.h:17
std::ptrdiff_t j
Definition tut_arithmetic_redux_minmax.cpp:2