|
CSS product code
0.1
C++ library to estimate distance of CSS codes. Some particular construction of CSS codes are implemented.
|
Go to the documentation of this file.
110 if (sscanf(line,
"%s %s %s %s %s", banner, mtx, crd, data_type,
111 storage_scheme) != 5)
114 for (p=mtx; *p!=
'\0'; *p=tolower(*p),p++);
115 for (p=crd; *p!=
'\0'; *p=tolower(*p),p++);
116 for (p=data_type; *p!=
'\0'; *p=tolower(*p),p++);
117 for (p=storage_scheme; *p!=
'\0'; *p=tolower(*p),p++);
181 if (fprintf(f,
"%d %d %d\n", M, N, nz) != 3)
200 }
while (line[0] ==
'%');
203 if (sscanf(line,
"%d %d %d", M, N, nz) == 3)
209 num_items_read = fscanf(f,
"%d %d %d", M, N, nz);
212 while (num_items_read != 3);
230 }
while (line[0] ==
'%');
233 if (sscanf(line,
"%d %d", M, N) == 2)
239 num_items_read = fscanf(f,
"%d %d", M, N);
242 while (num_items_read != 2);
249 if (fprintf(f,
"%d %d\n", M, N) != 2)
270 if (fscanf(f,
"%d %d %lg %lg", &I[i], &J[i], &val[2*i], &val[2*i+1])
277 if (fscanf(f,
"%d %d %lg\n", &I[i], &J[i], &val[i])
286 if (fscanf(f,
"%d %d", &I[i], &J[i])
301 if (fscanf(f,
"%d %d %lg %lg", I, J, real, imag)
306 if (fscanf(f,
"%d %d %lg\n", I, J, real)
337 if (strcmp(fname,
"stdin") == 0) f=stdin;
339 if ((f = fopen(fname,
"r")) == NULL)
354 *I = (
int *) malloc(*nz *
sizeof(
int));
355 *J = (
int *) malloc(*nz *
sizeof(
int));
360 *val = (
double *) malloc(*nz * 2 *
sizeof(
double));
363 if (ret_code != 0)
return ret_code;
367 *val = (
double *) malloc(*nz *
sizeof(
double));
370 if (ret_code != 0)
return ret_code;
377 if (ret_code != 0)
return ret_code;
380 if (f != stdin) fclose(f);
403 if (strcmp(fname,
"stdout") == 0)
406 if ((f = fopen(fname,
"w")) == NULL)
414 fprintf(f,
"%d %d %d\n", M, N, nz);
419 fprintf(f,
"%d %d\n", I[i], J[i]);
423 fprintf(f,
"%d %d %20.16g\n", I[i], J[i], val[i]);
427 fprintf(f,
"%d %d %20.16g %20.16g\n", I[i], J[i], val[2*i],
431 if (f != stdout) fclose(f);
435 if (f !=stdout) fclose(f);
449 char *s2 = (
char *) malloc((len+1)*
sizeof(char));
450 return strcpy(s2, s);
508 sprintf(buffer,
"%s %s %s %s", types[0], types[1], types[2], types[3]);
char * mm_typecode_to_str(MM_typecode matcode)
int mm_write_mtx_array_size(FILE *f, int M, int N)
#define mm_is_dense(typecode)
#define mm_set_sparse(typecode)
#define MM_COULD_NOT_WRITE_FILE
int mm_read_mtx_crd(char *fname, int *M, int *N, int *nz, int **I, int **J, double **val, MM_typecode *matcode)
#define mm_set_real(typecode)
#define mm_is_hermitian(typecode)
int mm_read_mtx_crd_size(FILE *f, int *M, int *N, int *nz)
#define MM_MAX_TOKEN_LENGTH
#define mm_is_general(typecode)
#define mm_is_pattern(typecode)
#define MM_UNSUPPORTED_TYPE
#define mm_set_skew(typecode)
#define mm_set_general(typecode)
#define mm_clear_typecode(typecode)
#define mm_is_symmetric(typecode)
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_is_integer(typecode)
int mm_write_mtx_crd_size(FILE *f, int M, int N, int nz)
int mm_write_mtx_crd(char fname[], int M, int N, int nz, int I[], int J[], double val[], MM_typecode matcode)
int mm_read_mtx_array_size(FILE *f, int *M, int *N)
#define MM_MAX_LINE_LENGTH
#define mm_set_complex(typecode)
#define mm_set_pattern(typecode)
#define mm_set_matrix(typecode)
#define mm_set_dense(typecode)
int mm_is_valid(MM_typecode matcode)
#define mm_is_matrix(typecode)
#define mm_is_skew(typecode)
int mm_write_banner(FILE *f, MM_typecode matcode)
#define mm_set_integer(typecode)
#define mm_set_symmetric(typecode)
#define mm_is_complex(typecode)
#define MatrixMarketBanner
#define mm_set_hermitian(typecode)
char * mm_strdup(const char *s)
#define mm_is_real(typecode)
#define MM_COULD_NOT_READ_FILE
int mm_read_banner(FILE *f, MM_typecode *matcode)
int mm_read_mtx_crd_entry(FILE *f, int *I, int *J, double *real, double *imag, MM_typecode matcode)
#define mm_is_sparse(typecode)