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 }
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
#define CS_CSC(A)
Definition: cs.h:140
int * p
Definition: cs.h:21
Definition: cs.h:16
int * i
Definition: cs.h:22
double * x
Definition: cs.h:23


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Mon Jun 10 2019 12:34:31