10 #ifndef EIGEN_SPARSEREDUX_H 11 #define EIGEN_SPARSEREDUX_H 14 #include "./InternalHeaderCheck.h" 18 template <
typename Derived>
19 typename 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();
28 template <
typename Scalar_,
int Options_,
typename Index_>
29 typename 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())
38 template <
typename Scalar_,
int Options_,
typename Index_>
39 typename internal::traits<SparseVector<Scalar_, Options_, Index_> >::Scalar
41 eigen_assert(rows() > 0 && cols() > 0 &&
"you are using a non initialized matrix");
47 #endif // EIGEN_SPARSEREDUX_H Namespace containing all symbols from the Eigen library.
Definition: B01_Experimental.dox:1
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:82
Scalar sum() const
Definition: SparseRedux.h:30
Scalar sum() const
Definition: SparseRedux.h:40
The matrix class, also used for vectors and row-vectors.
Definition: Matrix.h:186