66 double **val_,
int **I_,
int **J_)
75 if ((f = fopen(fname,
"r")) == NULL)
81 printf(
"mm_read_unsymetric: Could not process Matrix Market banner ");
82 printf(
" in file [%s]\n", fname);
93 fprintf(stderr,
"Sorry, this application does not support ");
94 fprintf(stderr,
"Market Market type: [%s]\n",buffer);
102 fprintf(stderr,
"read_unsymmetric_sparse(): could not parse matrix size.\n");
118 val =
new double[nz];
130 fscanf(f,
"%d %d %lg\n", &I[i], &J[i], &val[i]);
165 if (sscanf(line,
"%s %s %s %s %s", banner, mtx, crd, data_type,
166 storage_scheme) != 5)
169 for (p=mtx; *p!=
'\0'; *p=tolower(*p),p++);
170 for (p=crd; *p!=
'\0'; *p=tolower(*p),p++);
171 for (p=data_type; *p!=
'\0'; *p=tolower(*p),p++);
172 for (p=storage_scheme; *p!=
'\0'; *p=tolower(*p),p++);
236 fprintf(f,
"%d %d %d\n", M, N, nz);
253 }
while (line[0] ==
'%');
256 if (sscanf(line,
"%d %d %d", M, N, nz) == 3)
262 num_items_read = fscanf(f,
"%d %d %d", M, N, nz);
265 while (num_items_read != 3);
283 }
while (line[0] ==
'%');
286 if (sscanf(line,
"%d %d", M, N) == 2)
292 num_items_read = fscanf(f,
"%d %d", M, N);
295 while (num_items_read != 2);
302 fprintf(f,
"%d %d\n", M, N);
321 if (fscanf(f,
"%d %d %lg %lg", &I[i], &J[i], &val[2*i], &val[2*i+1])
328 if (fscanf(f,
"%d %d %lg\n", &I[i], &J[i], &val[i])
337 if (fscanf(f,
"%d %d", &I[i], &J[i])
352 if (fscanf(f,
"%d %d %lg %lg", I, J, real, imag)
357 if (fscanf(f,
"%d %d %lg\n", I, J, real)
388 if (strcmp(fname,
"stdin") == 0) f=stdin;
390 if ((f = fopen(fname,
"r")) == NULL)
416 *val =
new double[2*(*nz)];
419 if (ret_code != 0)
return ret_code;
424 *val =
new double[*nz];
427 if (ret_code != 0)
return ret_code;
434 if (ret_code != 0)
return ret_code;
437 if (f != stdin) fclose(f);
460 if (strcmp(fname,
"stdout") == 0)
463 if ((f = fopen(fname,
"w")) == NULL)
470 fprintf(f,
"%s\n", buffer);
473 fprintf(f,
"%d %d %d\n", M, N, nz);
478 fprintf(f,
"%d %d\n", I[i], J[i]);
482 fprintf(f,
"%d %d %20.16g\n", I[i], J[i], val[i]);
486 fprintf(f,
"%d %d %20.16g %20.16g\n", I[i], J[i], val[2*i],
490 if (f != stdout) fclose(f);
494 if (f !=stdout) fclose(f);
551 sprintf(buffer,
"%s %s %s %s", types[0], types[1], types[2], types[3]);
#define mm_is_complex(typecode)
int mm_read_mtx_crd_size(FILE *f, int *M, int *N, int *nz)
int mm_read_mtx_array_size(FILE *f, int *M, int *N)
#define mm_set_real(typecode)
int mm_is_valid(MM_typecode matcode)
#define MatrixMarketBanner
#define mm_set_hermitian(typecode)
#define MM_COULD_NOT_WRITE_FILE
#define mm_set_dense(typecode)
#define mm_set_matrix(typecode)
#define mm_is_sparse(typecode)
int mm_write_banner(FILE *f, MM_typecode matcode)
#define mm_set_integer(typecode)
#define MM_MAX_LINE_LENGTH
#define mm_is_pattern(typecode)
#define mm_is_dense(typecode)
#define mm_set_general(typecode)
EpetraExt::BlockCrsMatrix: A class for constructing a distributed block matrix.
#define mm_is_skew(typecode)
#define mm_is_symmetric(typecode)
void mm_typecode_to_str(MM_typecode matcode, char *buffer)
int mm_read_banner(FILE *f, MM_typecode *matcode)
#define MM_UNSUPPORTED_TYPE
int mm_write_mtx_crd(char fname[], int M, int N, int nz, int I[], int J[], double val[], MM_typecode matcode)
#define mm_is_hermitian(typecode)
#define mm_is_real(typecode)
#define mm_set_skew(typecode)
int mm_read_mtx_crd(char *fname, int *M, int *N, int *nz, int **I, int **J, double **val, MM_typecode *matcode)
int mm_read_mtx_crd_data(FILE *f, int M, int N, int nz, int I[], int J[], double val[], MM_typecode matcode)
#define mm_set_complex(typecode)
int mm_read_mtx_crd_entry(FILE *f, int *I, int *J, double *real, double *imag, MM_typecode matcode)
#define mm_is_matrix(typecode)
#define mm_is_general(typecode)
#define mm_set_symmetric(typecode)
int mm_write_mtx_array_size(FILE *f, int M, int N)
int mm_write_mtx_crd_size(FILE *f, int M, int N, int nz)
#define mm_is_integer(typecode)
int mm_read_unsymmetric_sparse(const char *fname, int *M_, int *N_, int *nz_, double **val_, int **I_, int **J_)
#define mm_set_pattern(typecode)
#define mm_clear_typecode(typecode)
#define MM_COULD_NOT_READ_FILE
#define mm_set_sparse(typecode)
#define MM_MAX_TOKEN_LENGTH