NAME
fp_write_matrix_with_header - Writes data row-wise to a FILE prefaced by a matrix header
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 fp_write_matrix_with_header
(
const Matrix *mp,
FILE *fp
);
DESCRIPTION
This routine writes data in a matrix to a file. Data is prefaced by a matrix
size header indicating the number of rows and columns in the matrix being
output. Since matrix files with headers are usually components of more
complex data structures, we write the data at full precision.
"fp" points to a FILE as returned by "kjb_fopen".
"mp" is a pointer to the matrix whose contents are to be written. If the
matrix is NULL, then this routine is a NOP.
The matrix size header has the form:
#! rows=<num-matrix-rows> cols=<num-matrix-cols>
where <num-matrix-rows>,<num-matrix-cols> are positive integers.
(The "#" is actually the comment char (user settable) and the "!" is actually
the header char, also user settable).
Data is then written in row order to the file. The current file position
is NOT reset to the starting after the function returns, so this function
can be used to write multiple matrices from the same file.
RETURNS
NO_ERROR on success,
ERROR on failure, with "kjb_error" set to a descriptive message.
RELATED
fp_read_matrix_with_header
fp_write_matrix_size_header
count_data_lines_until_next_header, kjb_print_error.
DISCLAIMER
This software is not adequatedly tested. It is recomended that
results are checked independantly where appropriate.
AUTHOR
Kobus Barnard
DOCUMENTER
Kobus Barnard
SEE ALSO
read_matrix_from_config_file
,
read_matrix
,
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
,
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