private static int scatter(SparseMatrix A, int j, double beta, int[] w, double[] x, int mark, SparseMatrix C, int nz) {
        int[] Ap = A.colIndex;
        int[] Ai = A.rowIndex;
        double[] Ax = A.x;

        int[] Ci = C.rowIndex;
        for (int p = Ap[j]; p < Ap[j + 1]; p++) {
            int i = Ai[p];                // A(i,j) is nonzero
            if (w[i] < mark) {
                w[i] = mark;              // i is new entry in column j
                Ci[nz++] = i;             // add i to pattern of C(:,j)
                x[i] = beta * Ax[p];      // x(i) = beta*A(i,j)
            } else {
                x[i] += beta * Ax[p];     // i exists in C(:,j) already
            }
        }

        return nz;
    }
private static int scatter ( SparseMatrix A , int j , double beta , int [ ] w , double [ ] x , int mark , SparseMatrix C , int nz ) { int [ ] Ap = A . colIndex ; int [ ] Ai = A . rowIndex ; double [ ] Ax = A . x ; int [ ] Ci = C . rowIndex ; for ( int p = Ap [ j ] ; p < Ap [ j + 1 ] ; p ++ ) { int i = Ai [ p ] ; if ( w [ i ] < mark ) { w [ i ] = mark ; Ci [ nz ++ ] = i ; x [ i ] = beta * Ax [ p ] ; } else { x [ i ] += beta * Ax [ p ] ; } } return nz ; }
x = x + beta * A(:,j), where x is a dense vector and A(:,j) is sparse.