M4RI
1.0.1
|
Input/output routines for matrices. More...
Go to the source code of this file.
Functions | |
void | mzd_print (mzd_t const *M) |
Print a matrix to stdout. | |
void | mzd_info (const mzd_t *A, int do_rank) |
Print compact information about the matrix to stdout. | |
mzd_t * | mzd_from_png (const char *fn, int verbose) |
Read matrix from 1-bit PNG image. | |
int | mzd_to_png (const mzd_t *A, const char *fn, int compression_level, const char *comment, int verbose) |
Write matrix to 1-bit PNG image. | |
mzd_t * | mzd_from_jcf (const char *fn, int verbose) |
Read matrix from ASCII file in JCF format. |
Input/output routines for matrices.
mzd_t* mzd_from_jcf | ( | const char * | fn, |
int | verbose | ||
) |
Read matrix from ASCII file in JCF format.
The format is as follows:
nrows ncols modulus nonzero_entries_upper_bound column_index
where a negative column_index indicates a row increase by one.
fn | Filename |
verbose | Print error message to stdout if != 0 |
mzd_t* mzd_from_png | ( | const char * | fn, |
int | verbose | ||
) |
Read matrix from 1-bit PNG image.
This function returns a matrix on success and NULL otherwise. 1-bit Grayscale and 1-bit Palette images are supported.
fn | Filename |
verbose | Print error message to stdout if != 0 |
void mzd_info | ( | const mzd_t * | A, |
int | do_rank | ||
) |
Print compact information about the matrix to stdout.
Prints number of rows, number of columns, density (and rank).
A | Matrix |
do_rank | Also display the rank (expensive) |
void mzd_print | ( | mzd_t const * | M | ) |
Print a matrix to stdout.
The output will contain colons between every 4-th column.
M | Matrix |
int mzd_to_png | ( | const mzd_t * | A, |
const char * | fn, | ||
int | compression_level, | ||
const char * | comment, | ||
int | verbose | ||
) |
Write matrix to 1-bit PNG image.
This function returns zero on success and some value != 0 otherwise. The parameter compression_level takes a zlib compression level, i.e., an integer betweeen -1 and 9 (inclusive) such that
#define Z_NO_COMPRESSION 0 #define Z_BEST_SPEED 1 #define Z_BEST_COMPRESSION 9 #define Z_DEFAULT_COMPRESSION (-1)
The optional comment string is written as a PNG comment.
A | Matrix |
fn | Filename (must have write permission) |
compression_level | Zlib compression level (see above) |
comment | Optional comment (may be NULL) |
verbose | Print error message to stdout if != 0 |