10#ifndef EIGEN_SPARSEREDUX_H
11#define EIGEN_SPARSEREDUX_H
14#include "./InternalHeaderCheck.h"
18template <
typename Derived>
19typename internal::traits<Derived>::Scalar SparseMatrixBase<Derived>::sum()
const {
20 eigen_assert(rows() > 0 && cols() > 0 &&
"you are using a non initialized matrix");
22 internal::evaluator<Derived> thisEval(derived());
23 for (Index j = 0; j < outerSize(); ++j)
24 for (
typename internal::evaluator<Derived>::InnerIterator iter(thisEval, j); iter; ++iter) res += iter.value();
28template <
typename Scalar_,
int Options_,
typename Index_>
29typename internal::traits<SparseMatrix<Scalar_, Options_, Index_> >::Scalar
31 eigen_assert(rows() > 0 && cols() > 0 &&
"you are using a non initialized matrix");
32 if (this->isCompressed())
38template <
typename Scalar_,
int Options_,
typename Index_>
39typename internal::traits<SparseVector<Scalar_, Options_, Index_> >::Scalar
41 eigen_assert(rows() > 0 && cols() > 0 &&
"you are using a non initialized matrix");
Scalar sum() const
Definition Redux.h:481
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:186
A versatible sparse matrix representation.
Definition SparseUtil.h:47
a sparse vector class
Definition SparseVector.h:62
Namespace containing all symbols from the Eigen library.
Definition Core:137