NAME
read_matrix_from_config_file - Reads a matrix from a config 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_from_config_file
(
Matrix **result_mpp,
const char *env_var,
const char *directory,
const char *file_name,
const char *message_name,
char *config_file_name,
size_t config_file_name_size
);
PARAMETERS
-
Matrix **result_mpp
-
Double pointer to Matrix result.
-
const char *env_var
-
Config file name from envirnonment.
-
const char *directory
-
Directory to scan for config file.
-
const char *file_name
-
Name of config file to search for.
-
const char *message_name
-
File name for error messages.
-
char *config_file_name
-
Name of actual config file found.
-
size_t config_file_name_size
-
Size of actual config file name.
DESCRIPTION
This routine reads a matrix from a configuration file, checking several
possible locations for the file. If the parameter "env_var" is not NULL, then
it first tries using this string as the configuration file name. Next it
looks for "file_name" in the current directory, then the user's home
directory, and, depending on how the library was built, then the "shared"
home directory and/or the programmer's home directory. If "directory" is not
NULL, then it is used as a sub-directory in all paths starting from a home
directory (i.e., all paths except the current directory).
The parameter message_name can be used to specify a name for the
configuration file to be used in error and verbose output messages. If
message_name is NULL, then "configuration" is used.
If the buffer config_file_name is not NULL, then the file name actually used
is copied into it. If it is used, then its size must be passed in via
config_file_name_size;
RETURNS
Either NO_ERROR, or ERROR, with an appropriate error message being set.
EXAMPLE
Suppose directory is "x" and file_name is "y". Also supposed that the
shared directory is "~kobus" (compiled in constant) and the programmer's
directory is "~kobus" (another compiled in constant). Then the following
files are tried in the order listed.
./y
~/x/y
~kobus/x/y
~kobus/x/y
The file name actually used is put into the buffer config_file_name whose
size must be passed in via max_len;
The matrix *result_mpp is created or resized as necessary.
If file_name is the special name "off" (or "none" or "0"), then the above
does not apply. In this case, *result_mpp is freed and set to NULL.
RELATED
get_config_file
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
,
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