MCPcopy Create free account
hub / github.com/arrayfire/arrayfire / mm_read_mtx_crd_data

Function mm_read_mtx_crd_data

test/mmio/mmio.c:229–251  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227/******************************************************************/
228
229int mm_read_mtx_crd_data(FILE *f, int M, int N, int nz, int I[], int J[],
230 double val[], MM_typecode matcode) {
231 int i;
232 if (mm_is_complex(matcode)) {
233 for (i = 0; i < nz; i++)
234 if (fscanf(f, "%d %d %lg %lg", &I[i], &J[i], &val[2 * i],
235 &val[2 * i + 1]) != 4)
236 return MM_PREMATURE_EOF;
237 } else if (mm_is_real(matcode)) {
238 for (i = 0; i < nz; i++) {
239 if (fscanf(f, "%d %d %lg\n", &I[i], &J[i], &val[i]) != 3)
240 return MM_PREMATURE_EOF;
241 }
242 }
243
244 else if (mm_is_pattern(matcode)) {
245 for (i = 0; i < nz; i++)
246 if (fscanf(f, "%d %d", &I[i], &J[i]) != 2) return MM_PREMATURE_EOF;
247 } else
248 return MM_UNSUPPORTED_TYPE;
249
250 return 0;
251}
252
253int mm_read_mtx_crd_entry(FILE *f, int *I, int *J, double *real, double *imag,
254 MM_typecode matcode) {

Callers 1

mm_read_mtx_crdFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected