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 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


hogman_minimal
Author(s): Maintained by Juergen Sturm
autogenerated on Wed Dec 26 2012 15:36:47