Main Page
Related Pages
Modules
Namespaces
Namespace List
Namespace Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
z
Variables
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
x
y
Typedefs
a
b
c
d
f
h
i
n
o
p
q
r
s
t
u
Enumerations
a
c
d
e
f
i
m
n
p
q
r
s
t
u
Enumerator
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
v
w
x
z
Classes
Class List
Class Hierarchy
Class Members
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
~
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
Enumerations
a
b
c
d
e
f
g
i
l
m
n
p
r
s
t
u
w
Enumerator
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
Related Functions
c
e
h
i
m
o
p
q
s
t
v
Files
File List
File Members
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
x
z
Variables
a
b
c
e
g
i
l
m
n
p
r
s
t
v
x
y
Typedefs
a
b
c
d
e
f
h
i
l
m
n
p
q
r
s
t
u
Enumerator
Macros
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
Examples
src
extern
eigen3
Eigen
src
SparseCore
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-2014 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
17
SparseMatrixBase<Derived>::sum
()
const
18
{
19
eigen_assert
(rows()>0 && cols()>0 &&
"you are using a non initialized matrix"
);
20
Scalar
res(0);
21
internal::evaluator<Derived>
thisEval(derived());
22
for
(
Index
j=0; j<outerSize(); ++j)
23
for
(
typename
internal::evaluator<Derived>::InnerIterator
iter(thisEval,j); iter; ++iter)
24
res += iter.value();
25
return
res;
26
}
27
28
template
<
typename
_Scalar,
int
_Options,
typename
_Index>
29
typename
internal::traits<SparseMatrix<_Scalar,_Options,_Index>
>
::Scalar
30
SparseMatrix<_Scalar,_Options,_Index>::sum
()
const
31
{
32
eigen_assert
(rows()>0 && cols()>0 &&
"you are using a non initialized matrix"
);
33
if
(this->isCompressed())
34
return
Matrix<Scalar,1,Dynamic>::Map
(m_data.valuePtr(), m_data.size()).sum();
35
else
36
return
Base::sum();
37
}
38
39
template
<
typename
_Scalar,
int
_Options,
typename
_Index>
40
typename
internal::traits<SparseVector<_Scalar,_Options, _Index>
>
::Scalar
41
SparseVector<_Scalar,_Options,_Index>::sum
()
const
42
{
43
eigen_assert
(rows()>0 && cols()>0 &&
"you are using a non initialized matrix"
);
44
return
Matrix<Scalar,1,Dynamic>::Map
(m_data.valuePtr(), m_data.size()).sum();
45
}
46
47
}
// end namespace Eigen
48
49
#endif // EIGEN_SPARSEREDUX_H
Eigen
Definition:
common.h:73
Eigen::SparseVector::sum
Scalar sum() const
Definition:
SparseRedux.h:41
Eigen::SparseMatrix::sum
Scalar sum() const
Definition:
SparseRedux.h:30
eigen_assert
#define eigen_assert(x)
Definition:
Macros.h:579
Scalar
SCALAR Scalar
Definition:
common.h:84
Eigen::SparseMatrixBase< CwiseBinaryOp< BinaryOp, Lhs, Rhs > >::Scalar
internal::traits< Derived >::Scalar Scalar
Definition:
SparseMatrixBase.h:31
Eigen::internal::evaluator
Definition:
CoreEvaluators.h:90
Eigen::PlainObjectBase< Matrix< _Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols > >::Map
static ConstMapType Map(const Scalar *data)
Definition:
PlainObjectBase.h:587
Eigen::SparseMatrixBase::sum
Scalar sum() const
Definition:
SparseRedux.h:17
Eigen::internal::traits
Definition:
ForwardDeclarations.h:17
Eigen::Index
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition:
Meta.h:33
control_box_rst
Author(s): Christoph Rösmann
autogenerated on Wed Mar 2 2022 00:06:22