sw/benchmarks/src/cg.c
//  set the ith element of the sparse vector (v, iv)
set the ith element of the sparse vector (v, iv)
set the ith element of the sparse vector ( v iv )
int vecset(double *v, int *iv, int nzv, int i, double val)
{
    int k;
    for (k=1; k<=nzv; k++) {
        if (iv[k] == i) {
            v[k] = val;
            return nzv;
        }
    }
    nzv++;
    v[nzv] = val;
    iv[nzv] = i;
    return nzv;
}
int vecset ( double * v , int * iv , int nzv , int i , double val ) { int k ; for ( k = 1 ; k <= nzv ; k ++ ) { if ( iv [ k ] == i ) { v [ k ] = val ; return nzv ; } } nzv ++ ; v [ nzv ] = val ; iv [ nzv ] = i ; return nzv ; }
set the ith element of the sparse vector (v, iv)
set the ith element of the sparse vector ( v iv )