M4RI  20140914
Functions
io.h File Reference

Input/output routines for matrices. More...

#include <m4ri/m4ri_config.h>
#include <m4ri/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_print_row (mzd_t const *M, const rci_t i)
 Print row i of M 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_jcf (const char *fn, int verbose)
 Read matrix from ASCII file in JCF format. More...
 
mzd_tmzd_from_str (rci_t m, rci_t n, const char *str)
 Create matrix from dense ASCII string. 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_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_index increase by one and a non-zero entry at index -column_index.

Note
the JCF format is one-based in contrast to everything else in this library which is zero-based.

For example, a valid input is:

3 2 2
3

-2
-1
-2

which produces the matrix

[0 1]
[1 0]
[0 1]
Parameters
fnFilename
verbosePrint error message to stdout if != 0
mzd_t* mzd_from_str ( rci_t  m,
rci_t  n,
const char *  str 
)

Create matrix from dense ASCII string.

The provided string is parsed in row major ordering, i.e. the first entry is writen to A[0,0], the second entry to A[0,1] etc.

For example, calling

mzd_t *A = mzd_from_str(4, 4, "1000010000100001");

would create a 4 x 4 identity matrix.

Parameters
mNumber of rows
nNimber of columns
strString containing ASCII zeros and ones of length m*n
Examples:
testsuite/test_ple.c.
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)
void mzd_print ( mzd_t const *  M)

Print a matrix to stdout.

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

Parameters
MMatrix
void mzd_print_row ( mzd_t const *  M,
const rci_t  i 
)

Print row i of M to stdout.

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

Parameters
MMatrix
iRow to print