Move implementation of vector_zero() to central location.

There is no need for each file to contain a separate, though
trivial, implementation of this feature.
This commit is contained in:
Bård Skaflestad 2010-10-14 13:58:47 +02:00
parent ef4d884d12
commit edd470dd7d
2 changed files with 19 additions and 0 deletions

View File

@ -192,3 +192,16 @@ csrmatrix_zero(struct CSRMatrix *A)
for (i = 0; i < A->nnz; i++) { A->sa[i] = 0.0; }
}
/* ---------------------------------------------------------------------- */
/* v = zeros([n, 1]) */
/* ---------------------------------------------------------------------- */
void
vector_zero(size_t n, double *v)
/* ---------------------------------------------------------------------- */
{
size_t i;
for (i = 0; i < n; i++) { v[i] = 0.0; }
}

View File

@ -72,6 +72,12 @@ csrmatrix_delete(struct CSRMatrix *A);
void
csrmatrix_zero(struct CSRMatrix *A);
/* ---------------------------------------------------------------------- */
/* v = zeros([n, 1]) */
/* ---------------------------------------------------------------------- */
void
vector_zero(size_t n, double *v);
#ifdef __cplusplus
}
#endif