libuproc
1.2.0
|
2D matrix More...
Data Structures | |
struct | uproc_matrix |
2D matrix More... | |
Functions | |
uproc_matrix * | uproc_matrix_create (unsigned long rows, unsigned long cols, const double *values) |
Create matrix object. More... | |
void | uproc_matrix_destroy (uproc_matrix *matrix) |
Destroy matrix object. More... | |
void | uproc_matrix_set (uproc_matrix *matrix, unsigned long row, unsigned long col, double value) |
Set the value of matrix[row, col]. More... | |
double | uproc_matrix_get (const uproc_matrix *matrix, unsigned long row, unsigned long col) |
Get the value of matrix[row, col]. More... | |
void | uproc_matrix_dimensions (const uproc_matrix *matrix, unsigned long *rows, unsigned long *cols) |
Obtain matrix dimensions. More... | |
uproc_matrix * | uproc_matrix_loads (uproc_io_stream *stream) |
Load matrix from stream. More... | |
uproc_matrix * | uproc_matrix_load (enum uproc_io_type iotype, const char *pathfmt,...) |
Load matrix from file. More... | |
uproc_matrix * | uproc_matrix_loadv (enum uproc_io_type iotype, const char *pathfmt, va_list ap) |
Load matrix from file. More... | |
int | uproc_matrix_stores (const uproc_matrix *matrix, uproc_io_stream *stream) |
Store matrix to stream. More... | |
int | uproc_matrix_store (const uproc_matrix *matrix, enum uproc_io_type iotype, const char *pathfmt,...) |
Store matrix to file. More... | |
int | uproc_matrix_storev (const uproc_matrix *matrix, enum uproc_io_type iotype, const char *pathfmt, va_list ap) |
Store matrix to file. More... | |
2D matrix
A very basic matrix implementation that is only useful to look up values depending on the two dimensions and storing to or loading from a plain text file. Neither bounds checking nor any algrebraic or arithmetic operations are supported. Trying to retrieve or modify an element that is beyond the bounds results in undefined behaviour.
uproc_matrix* uproc_matrix_create | ( | unsigned long | rows, |
unsigned long | cols, | ||
const double * | values | ||
) |
Create matrix object.
If values
is not NULL, it should point into an array of size rows * cols
containing a "flat" representation of the matrix, one row followed by the other, which will be copied into the new matrix object. If values
is NULL, the contents will be initialized to 0.0.
rows | number of rows |
cols | number of columns |
values | initial values or NULL |
void uproc_matrix_destroy | ( | uproc_matrix * | matrix | ) |
Destroy matrix object.
void uproc_matrix_set | ( | uproc_matrix * | matrix, |
unsigned long | row, | ||
unsigned long | col, | ||
double | value | ||
) |
Set the value of matrix[row, col].
double uproc_matrix_get | ( | const uproc_matrix * | matrix, |
unsigned long | row, | ||
unsigned long | col | ||
) |
Get the value of matrix[row, col].
void uproc_matrix_dimensions | ( | const uproc_matrix * | matrix, |
unsigned long * | rows, | ||
unsigned long * | cols | ||
) |
Obtain matrix dimensions.
matrix | matrix object |
rows | OUT: number of rows |
cols | OUT: number of columns |
uproc_matrix* uproc_matrix_loads | ( | uproc_io_stream * | stream | ) |
Load matrix from stream.
uproc_matrix* uproc_matrix_load | ( | enum uproc_io_type | iotype, |
const char * | pathfmt, | ||
... | |||
) |
Load matrix from file.
iotype | IO type, see uproc_io_type |
pathfmt | printf format string for file path |
... | format string arguments |
uproc_matrix* uproc_matrix_loadv | ( | enum uproc_io_type | iotype, |
const char * | pathfmt, | ||
va_list | ap | ||
) |
Load matrix from file.
Like uproc_matrix_load, but with a va_list
instead of a variable number of arguments.
int uproc_matrix_stores | ( | const uproc_matrix * | matrix, |
uproc_io_stream * | stream | ||
) |
Store matrix to stream.
int uproc_matrix_store | ( | const uproc_matrix * | matrix, |
enum uproc_io_type | iotype, | ||
const char * | pathfmt, | ||
... | |||
) |
Store matrix to file.
int uproc_matrix_storev | ( | const uproc_matrix * | matrix, |
enum uproc_io_type | iotype, | ||
const char * | pathfmt, | ||
va_list | ap | ||
) |
Store matrix to file.
Like uproc_matrix_store, but with a va_list
instead of a variable number of arguments.