linbox
|
#include <matrix-stream.h>
Public Member Functions | |
MatrixStream (const Field &fld, std::istream &in) | |
Constructor from an input stream. | |
~MatrixStream () | |
Destructor. | |
void | newmatrix () |
Re initiliaze after one matrix has been read. | |
bool | readWhiteSpace () |
Read some white space (if there is any). | |
bool | nextTriple (size_t &, size_t &, Element &) |
Read the next triple of row index, column index, value and store it in the three referenced elements. | |
bool | getArray (std::vector< Element > &array) |
Get the whole matrix as a dense (row-major) array of elements. | |
bool | getRows (size_t &) |
Get the number of rows in the matrix and store it in the given size_t. | |
bool | getColumns (size_t &) |
Get the number of columns in the matrix and store it in the given size_t. | |
bool | getDimensions (size_t &, size_t &) |
Get the number of rows and columns in the matrix and store them in the given ints. | |
MatrixStreamError | getError () const |
Get the current state of the stream. | |
MatrixStreamError | reportError (const char *, int) const |
Report the error to the error stream and return it. | |
int | getLineNumber () const |
If the reader is in the GOOD state, get the line number it is on. | |
const Field & | getField () const |
Get the Field that was passed to the constructor. | |
const char * | getFormat () const |
Get a brief description of the format of the matrix being read. | |
const char * | getShortFormat () const |
Get a very brief description of the matrix format. | |
bool | isSparse () const |
Tell if the matrix being read is sparse. |
MatrixStream | ( | const Field & | fld, |
std::istream & | in | ||
) |
Constructor from an input stream.
fld | The Field used to read Elements from the matrix. |
in | The input stream from which to read |
MatrixStreamError | if an error occurs in reading the first line (i.e. on initialization). |
void newmatrix | ( | ) |
Re initiliaze after one matrix has been read.
bool readWhiteSpace | ( | ) |
Read some white space (if there is any).
Using this method is preferable to letting the input stream handle whitespace skipping because this method will update the line number when breaks are encountered.
bool nextTriple | ( | size_t & | m, |
size_t & | n, | ||
Element & | v | ||
) |
Read the next triple of row index, column index, value and store it in the three referenced elements.
bool getArray | ( | std::vector< Element > & | array | ) |
Get the whole matrix as a dense (row-major) array of elements.
array | The array to fill with entries. May be resized as needed. |
bool getRows | ( | size_t & | m | ) |
Get the number of rows in the matrix and store it in the given size_t.
bool getColumns | ( | size_t & | n | ) |
Get the number of columns in the matrix and store it in the given size_t.
bool getDimensions | ( | size_t & | m, |
size_t & | n | ||
) |
Get the number of rows and columns in the matrix and store them in the given ints.
MatrixStreamError getError | ( | ) | const [inline] |
Get the current state of the stream.
Especially useful if called after nextTriple or one of the get operations on failure to get some information on what caused the failure.
MatrixStreamError reportError | ( | const char * | func, |
int | line | ||
) | const |
Report the error to the error stream and return it.
Designed for throw operations.
int getLineNumber | ( | ) | const |
If the reader is in the GOOD state, get the line number it is on.
Otherwise, get the line number on which the last error occurred.
const Field& getField | ( | ) | const [inline] |
Get the Field that was passed to the constructor.
const char* getFormat | ( | ) | const [inline] |
Get a brief description of the format of the matrix being read.
const char* getShortFormat | ( | ) | const [inline] |
Get a very brief description of the matrix format.
bool isSparse | ( | ) | const [inline] |
Tell if the matrix being read is sparse.