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_dupl.c
Go to the documentation of this file.
1
#include "
cs.h
"
2
/* remove duplicate entries from A */
3
int
cs_dupl
(
cs
*
A
)
4
{
5
int
i, j, p, q, nz = 0, n, m, *Ap, *Ai, *w ;
6
double
*Ax ;
7
if
(!
CS_CSC
(A))
return
(0) ;
/* check inputs */
8
m = A->
m
; n = A->
n
; Ap = A->
p
; Ai = A->
i
; Ax = A->
x
;
9
w = (
int
*)
cs_malloc
(m,
sizeof
(
int
)) ;
/* get workspace */
10
if
(!w)
return
(0) ;
/* out of memory */
11
for
(i = 0 ; i < m ; i++) w [i] = -1 ;
/* row i not yet seen */
12
for
(j = 0 ; j < n ; j++)
13
{
14
q = nz ;
/* column j will start at q */
15
for
(p = Ap [j] ; p < Ap [j+1] ; p++)
16
{
17
i = Ai [p] ;
/* A(i,j) is nonzero */
18
if
(w [i] >= q)
19
{
20
Ax [w [i]] += Ax [p] ;
/* A(i,j) is a duplicate */
21
}
22
else
23
{
24
w [i] = nz ;
/* record where row i occurs */
25
Ai [nz] = i ;
/* keep A(i,j) */
26
Ax [nz++] = Ax [p] ;
27
}
28
}
29
Ap [j] = q ;
/* record start of column j */
30
}
31
Ap [n] = nz ;
/* finalize A */
32
cs_free
(w) ;
/* free workspace */
33
return
(
cs_sprealloc
(A, 0)) ;
/* remove extra space from A */
34
}
example1.A
A
Definition:
example1.py:34
cs_sparse::n
int n
Definition:
cs.h:20
cs_dupl
int cs_dupl(cs *A)
Definition:
cs_dupl.c:3
cs_free
void * cs_free(void *p)
Definition:
cs_malloc.c:22
cs_sprealloc
int cs_sprealloc(cs *A, int nzmax)
Definition:
cs_util.c:18
cs.h
CS_CSC
#define CS_CSC(A)
Definition:
cs.h:140
cs_sparse::p
int * p
Definition:
cs.h:21
cs_sparse
Definition:
cs.h:16
cs_sparse::i
int * i
Definition:
cs.h:22
cs_malloc
void * cs_malloc(int n, size_t size)
Definition:
cs_malloc.c:10
cs_sparse::x
double * x
Definition:
cs.h:23
cs_sparse::m
int m
Definition:
cs.h:19
acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Feb 28 2022 21:31:52