M4RI
20140914
|
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_t * | mzd_from_jcf (const char *fn, int verbose) |
Read matrix from ASCII file in JCF format. More... | |
mzd_t * | mzd_from_str (rci_t m, rci_t n, const char *str) |
Create matrix from dense ASCII string. More... | |
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_index increase by one and a non-zero entry at index -column_index.
For example, a valid input is:
3 2 2 3 -2 -1 -2
which produces the matrix
[0 1] [1 0] [0 1]
fn | Filename |
verbose | Print error message to stdout if != 0 |
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.
m | Number of rows |
n | Nimber of columns |
str | String containing ASCII zeros and ones of length m*n |
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 |