EVSL
1.1.0
EigenValues Slicing Library
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
EXTERNAL
CXSparse
Source
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
CS_INT
cs_scatter
(
const
cs
*A,
CS_INT
j,
CS_ENTRY
beta,
CS_INT
*w,
CS_ENTRY
*x,
CS_INT
mark,
4
cs
*C,
CS_INT
nz)
5
{
6
CS_INT
i, p, *Ap, *Ai, *Ci ;
7
CS_ENTRY
*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
}
cs
#define cs
Definition:
cs.h:637
CS_ENTRY
#define CS_ENTRY
Definition:
cs.h:635
cs.h
CS_CSC
#define CS_CSC(A)
Definition:
cs.h:659
CS_INT
#define CS_INT
Definition:
cs.h:627
cs_scatter
CS_INT cs_scatter(const cs *A, CS_INT j, CS_ENTRY beta, CS_INT *w, CS_ENTRY *x, CS_INT mark, cs *C, CS_INT nz)
Definition:
cs_scatter.c:3
Generated by
1.8.6