Main Page | Modules | Namespace List | Class Hierarchy | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages

MatrixStream Class Template Reference

#include <matrix-stream.h>

template<class Field>
class LinBox::MatrixStream< Field >


Public Types

typedef Field::Element Element

Public Member Functions

 MatrixStream (const Field &fld, std::istream &i, char delim= '\n')
 ~MatrixStream ()
bool nextTriple (size_t &, size_t &, Element &)
bool getRows (size_t &)
bool getColumns (size_t &)
bool getDimensions (size_t &, size_t &)
MatrixStreamError getError () const
MatrixStreamError reportError (const char *, int) const
int getLineNumber () const
const FieldgetField () const
bool addChars (std::istream **eofReached=NULL)
const char * getFormat () const
bool isSparse () const
bool isDense () const

Member Typedef Documentation

typedef Field::Element Element
 


Constructor & Destructor Documentation

MatrixStream const Field fld,
std::istream &  i,
char  delim = '\n'
 

Constructor from an input stream.

Parameters:
fld The Field used to read Elements from the matrix.
in The input stream from which to read
delim The chunk delimited used by addChars. This should be the last character in the matrix data. If only one matrix is stored in a given file, this can be anything. Otherwise, if delim is not the last character in the matrix, there could be extra data read from in and not put back. Default is newline.

~MatrixStream  ) 
 

Destructor


Member Function Documentation

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.

Returns:
true iff the read succeeded.

bool getRows size_t &   ) 
 

Get the number of rows in the matrix and store it in the given size_t.

Returns:
true iff the operation succeeded.

bool getColumns size_t &   ) 
 

Get the number of columns in the matrix and store it in the given size_t.

Returns:
true iff the operation succeeded.

bool getDimensions size_t &  ,
size_t & 
 

Get the number of rows and columns in the matrix and store them in the given ints.

Returns:
true iff the operation succeeded.

MatrixStreamError getError  )  const [inline]
 

Get the current state of the stream. Especially useful if called after one of the four above operations on failure to get some information on what caused the failure.

MatrixStreamError reportError const char *  ,
int 
const
 

Report the error to the error stream and return it. Designed for throw operations.

int getLineNumber  )  const
 

If there is a reader 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.

bool addChars std::istream **  eofReached = NULL  ) 
 

Get characters from in and give them to the MatrixStreamReaders. Called by the moreData() function of MatrixStreamReader.

Parameters:
eofReached A pointer to a pointer of the std::istream that reached an EOF and initiated this function call.
Returns:
true iff more characters were actually added to the stream

const char* getFormat  )  const
 

Get a brief description of the format of the matrix being read.

bool isSparse  )  const
 

Tell if the matrix being read is sparse.

Returns:
true iff the matrix is sparse. NOTE: a return of false does NOT mean the matrix is dense. Use isDense()

bool isDense  )  const
 

Tell if the matrix being read is dense.

Returns:
true iff the matrix is dense. NOTE: a return of false does NOT mean the matrix is sparse. Use isSparse()


Generated on Fri Jul 8 10:29:57 2005 for linbox by doxygen 1.3.7