M4RI  1.0.1
Functions
io.h File Reference

Input/output routines for matrices. More...

#include "m4ri_config.h"
#include "mzd.h"

Go to the source code of this file.

Functions

void mzd_print (mzd_t const *M)
 Print a matrix to stdout. More...
 
void mzd_info (const mzd_t *A, int do_rank)
 Print compact information about the matrix to stdout. More...
 
mzd_tmzd_from_png (const char *fn, int verbose)
 Read matrix from 1-bit PNG image. More...
 
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. More...
 
mzd_tmzd_from_jcf (const char *fn, int verbose)
 Read matrix from ASCII file in JCF format. More...
 

Detailed Description

Input/output routines for matrices.

Author
Martin Albrecht marti.nosp@m.nral.nosp@m.brech.nosp@m.t@go.nosp@m.oglem.nosp@m.ail..nosp@m.com

Function Documentation

◆ mzd_from_jcf()

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.

Parameters
fnFilename
verbosePrint error message to stdout if != 0

◆ mzd_from_png()

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.

Parameters
fnFilename
verbosePrint error message to stdout if != 0

◆ mzd_info()

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).

Parameters
AMatrix
do_rankAlso display the rank (expensive)

◆ mzd_print()

void mzd_print ( mzd_t const *  M)

Print a matrix to stdout.

The output will contain colons between every 4-th column.

Parameters
MMatrix

◆ mzd_to_png()

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.

Parameters
AMatrix
fnFilename (must have write permission)
compression_levelZlib compression level (see above)
commentOptional comment (may be NULL)
verbosePrint error message to stdout if != 0