Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
external_packages
csparse
cs_scatter.c
Go to the documentation of this file.
1
#include "
cs.h
"
2
/* x = x + beta * A(:,j), where x is a dense vector and A(:,j) is sparse */
3
int
cs_scatter
(
const
cs
*
A
,
int
j,
double
beta,
int
*w,
double
*x,
int
mark,
4
cs
*C,
int
nz)
5
{
6
int
i, p, *Ap, *Ai, *Ci ;
7
double
*Ax ;
8
if
(!
CS_CSC
(A) || !w || !
CS_CSC
(C))
return
(-1) ;
/* check inputs */
9
Ap = A->
p
; Ai = A->
i
; Ax = A->
x
; Ci = C->
i
;
10
for
(p = Ap [j] ; p < Ap [j+1] ; p++)
11
{
12
i = Ai [p] ;
/* A(i,j) is nonzero */
13
if
(w [i] < mark)
14
{
15
w [i] = mark ;
/* i is new entry in column j */
16
Ci [nz++] = i ;
/* add i to pattern of C(:,j) */
17
if
(x) x [i] = beta * Ax [p] ;
/* x(i) = beta*A(i,j) */
18
}
19
else
if
(x) x [i] += beta * Ax [p] ;
/* i exists in C(:,j) already */
20
}
21
return
(nz) ;
22
}
example1.A
A
Definition:
example1.py:34
cs.h
cs_scatter
int cs_scatter(const cs *A, int j, double beta, int *w, double *x, int mark, cs *C, int nz)
Definition:
cs_scatter.c:3
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_sparse::x
double * x
Definition:
cs.h:23
acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:31