diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2019-03-03 21:09:10 +0100 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2019-03-03 21:10:13 +0100 |
commit | f0238cfb6997c4acfc2bd200de7295f3fa36968f (patch) | |
tree | b215183760e4f615b9c1dabc1f116383b72a1b55 /eigen/Eigen/src/SparseCore/SparseRedux.h | |
parent | 543edd372a5193d04b3de9f23c176ab439e51b31 (diff) |
don't index Eigen
Diffstat (limited to 'eigen/Eigen/src/SparseCore/SparseRedux.h')
-rw-r--r-- | eigen/Eigen/src/SparseCore/SparseRedux.h | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/eigen/Eigen/src/SparseCore/SparseRedux.h b/eigen/Eigen/src/SparseCore/SparseRedux.h deleted file mode 100644 index 4587749..0000000 --- a/eigen/Eigen/src/SparseCore/SparseRedux.h +++ /dev/null @@ -1,49 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2008-2014 Gael Guennebaud <gael.guennebaud@inria.fr> -// -// This Source Code Form is subject to the terms of the Mozilla -// Public License v. 2.0. If a copy of the MPL was not distributed -// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. - -#ifndef EIGEN_SPARSEREDUX_H -#define EIGEN_SPARSEREDUX_H - -namespace Eigen { - -template<typename Derived> -typename internal::traits<Derived>::Scalar -SparseMatrixBase<Derived>::sum() const -{ - eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); - Scalar res(0); - internal::evaluator<Derived> thisEval(derived()); - for (Index j=0; j<outerSize(); ++j) - for (typename internal::evaluator<Derived>::InnerIterator iter(thisEval,j); iter; ++iter) - res += iter.value(); - return res; -} - -template<typename _Scalar, int _Options, typename _Index> -typename internal::traits<SparseMatrix<_Scalar,_Options,_Index> >::Scalar -SparseMatrix<_Scalar,_Options,_Index>::sum() const -{ - eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); - if(this->isCompressed()) - return Matrix<Scalar,1,Dynamic>::Map(m_data.valuePtr(), m_data.size()).sum(); - else - return Base::sum(); -} - -template<typename _Scalar, int _Options, typename _Index> -typename internal::traits<SparseVector<_Scalar,_Options, _Index> >::Scalar -SparseVector<_Scalar,_Options,_Index>::sum() const -{ - eigen_assert(rows()>0 && cols()>0 && "you are using a non initialized matrix"); - return Matrix<Scalar,1,Dynamic>::Map(m_data.valuePtr(), m_data.size()).sum(); -} - -} // end namespace Eigen - -#endif // EIGEN_SPARSEREDUX_H |