NAME

read_matrix - Reads a matrix from file

SYNOPSIS

#include "m/m_mat_io.h"

Example compile flags (system dependent):
  -DLINUX_X86_64 -DLINUX_X86_64_OPTERON  -DGNU_COMPILER 
   -I/home/kobus/include
   -L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
  -lKJB                               -lfftw3  -lgsl -lgslcblas -ljpeg  -lSVM -lstdc++                    -lpthread -lSLATEC -lg2c    -lacml -lacml_mv -lblas -lg2c      -lncursesw 


int read_matrix
(
	Matrix **result_mpp,
	const char *file_name
);

DESCRIPTION

This routine reads a matrix from a file. If the file_name is NULL or a null string, then stdin is assumed. If this is the case, and if the source is not a file (i.e. a pipe), then this routine will fail. Several read strategies are tried until one succeeds. The first strategy is to assume that the matrix is in raw (binary) format (see fp_read_matrix(3)). If that fails, the rouint assume that the file has a header file (see fp_read_matrix_with_header(3)). The final strategy is to assume that the file is a formatted ascii file, and the matrix dimensions are deduced from the number of rows and columns (see fp_read_formatted_matrix(3)). The number of columns in each row must be the same. For example, if the input file contains 5 rows of data, each with 3 columns, then the output matrix will be 5 X 3. The matrix *result_mpp is created or resized as necessary.

RETURNS

Either NO_ERROR, or ERROR, with an appropriate error message being set.

DISCLAIMER

This software is not adequatedly tested. It is recomended that results are checked independantly where appropriate.

AUTHOR

Kobus Barnard

DOCUMENTER

Lindsay Martin and Kobus Barnard

SEE ALSO

read_matrix_from_config_file , fp_read_matrix , fp_read_raw_matrix , fp_read_matrix_with_header , fp_read_formatted_matrix , read_matrix_by_rows , fp_read_matrix_by_rows , read_matrix_by_cols , fp_read_matrix_by_cols , fp_ow_read_formatted_matrix , fp_ow_read_matrix_by_rows , fp_ow_read_matrix_by_cols , write_matrix , write_matrix_2 , fp_write_matrix , fp_write_matrix_2 , write_matrix_with_header , fp_write_matrix_with_header , write_matrix_full_precision , fp_write_matrix_full_precision , write_matrix_rows , fp_write_matrix_rows , write_matrix_cols , fp_write_matrix_cols , write_matrix_vector , fp_write_matrix_vector , write_matrix_vector_full_precision , fp_write_matrix_vector_full_precision , fp_write_matrix_with_title , fp_write_matrix_full_precision_with_title , write_raw_matrix , fp_write_raw_matrix , read_matrix_vector , fp_read_matrix_vector , fp_read_raw_matrix_vector , fp_read_matrix_vector_with_headers , write_raw_matrix_vector , fp_write_raw_matrix_vector , fp_write_raw_matrix_vector_header