SparseRedux.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008 Gael Guennebaud <gael.guennebaud@inria.fr>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef EIGEN_SPARSEREDUX_H
11 #define EIGEN_SPARSEREDUX_H
12 
13 namespace Eigen {
14 
15 template<typename Derived>
16 typename internal::traits<Derived>::Scalar
18 {
19  eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
20  Scalar res(0);
21  for (Index j=0; j<outerSize(); ++j)
22  for (typename Derived::InnerIterator iter(derived(),j); iter; ++iter)
23  res += iter.value();
24  return res;
25 }
26 
27 template<typename _Scalar, int _Options, typename _Index>
30 {
31  eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
32  return Matrix<Scalar,1,Dynamic>::Map(&m_data.value(0), m_data.size()).sum();
33 }
34 
35 template<typename _Scalar, int _Options, typename _Index>
38 {
39  eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix");
40  return Matrix<Scalar,1,Dynamic>::Map(&m_data.value(0), m_data.size()).sum();
41 }
42 
43 } // end namespace Eigen
44 
45 #endif // EIGEN_SPARSEREDUX_H
Definition: LDLT.h:16
Scalar sum() const
Definition: SparseRedux.h:37
internal::traits< Derived >::Scalar Scalar
Scalar sum() const
Definition: SparseRedux.h:17
internal::traits< Derived >::Index Index
Definition: EigenBase.h:31
#define eigen_assert(x)
Scalar sum() const
Definition: SparseRedux.h:29


tuw_aruco
Author(s): Lukas Pfeifhofer
autogenerated on Mon Jun 10 2019 15:40:59