cs_scatter.c
Go to the documentation of this file.
00001 #include "cs.h"
00002 /* x = x + beta * A(:,j), where x is a dense vector and A(:,j) is sparse */
00003 int cs_scatter (const cs *A, int j, double beta, int *w, double *x, int mark,
00004     cs *C, int nz)
00005 {
00006     int i, p, *Ap, *Ai, *Ci ;
00007     double *Ax ;
00008     if (!CS_CSC (A) || !w || !CS_CSC (C)) return (-1) ;     /* check inputs */
00009     Ap = A->p ; Ai = A->i ; Ax = A->x ; Ci = C->i ;
00010     for (p = Ap [j] ; p < Ap [j+1] ; p++)
00011     {
00012         i = Ai [p] ;                            /* A(i,j) is nonzero */
00013         if (w [i] < mark)
00014         {
00015             w [i] = mark ;                      /* i is new entry in column j */
00016             Ci [nz++] = i ;                     /* add i to pattern of C(:,j) */
00017             if (x) x [i] = beta * Ax [p] ;      /* x(i) = beta*A(i,j) */
00018         }
00019         else if (x) x [i] += beta * Ax [p] ;    /* i exists in C(:,j) already */
00020     }
00021     return (nz) ;
00022 }


acado
Author(s): Milan Vukov, Rien Quirynen
autogenerated on Thu Aug 27 2015 11:58:04