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
+
Variables
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
q
r
s
t
u
v
x
y
+
Typedefs
a
d
i
p
q
r
s
t
Enumerations
+
Enumerator
a
b
c
d
e
f
g
h
i
l
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
+
Enumerator
_
a
b
c
d
e
f
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
x
y
+
Related Functions
a
c
d
e
f
g
h
i
l
m
o
p
q
r
s
t
x
+
Files
File List
+
File 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
w
x
z
+
Variables
a
b
c
d
e
f
g
h
i
j
k
l
m
n
p
q
r
s
t
u
v
x
z
+
Typedefs
a
b
c
d
e
f
g
i
l
m
n
r
s
t
u
+
Enumerations
a
b
c
d
e
g
h
i
l
m
n
o
p
q
r
s
t
u
v
+
Enumerator
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
+
Macros
_
a
b
c
d
e
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
y
external_packages
csparse
cs_cumsum.c
Go to the documentation of this file.
1
#include "
cs.h
"
2
/* p [0..n] = cumulative sum of c [0..n-1], and then copy p [0..n-1] into c */
3
double
cs_cumsum
(
int
*p,
int
*c,
int
n)
4
{
5
int
i, nz = 0 ;
6
double
nz2 = 0 ;
7
if
(!p || !c)
return
(-1) ;
/* check inputs */
8
for
(i = 0 ; i < n ; i++)
9
{
10
p [i] = nz ;
11
nz += c [i] ;
12
nz2 += c [i] ;
/* also in double to avoid int overflow */
13
c [i] = p [i] ;
/* also copy p[0..n-1] back into c[0..n-1]*/
14
}
15
p [n] = nz ;
16
return
(nz2) ;
/* return sum (c [0..n-1]) */
17
}
cs_cumsum
double cs_cumsum(int *p, int *c, int n)
Definition:
cs_cumsum.c:3
cs.h
acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Feb 28 2022 21:31:52