linbox
MapleReader< Field > Class Template Reference

#include <maple.h>

+ Inheritance diagram for MapleReader< Field >:

Public Types

typedef MatrixStreamReader< Field >::Element Element
 

Public Member Functions

 MapleReader ()
 
 ~MapleReader ()
 
bool isSparse () const
 Determine if this format is sparse or dense.
 
const char * getName () const
 Get a unique string describing this format.
 
const char * shortName () const
 Get a (possibly) shortened version of the format name.
 
MatrixStreamError init (const char *, std::istream *, MatrixStream< Field > *)
 Initialize this MatrixStreamReader.
 
MatrixStreamError nextTriple (size_t &, size_t &, Element &)
 Get the next triple of row index, column index, value and store it into the three referenced variables.
 
template<class Vect>
MatrixStreamError getArray (Vect &array)
 Get the whole matrix as a dense (row-major) array of elements.
 
MatrixStreamError saveNext ()
 Reads the next triple from the subclass nextTripleImpl method and saves it to the savedTriples std::queue rather than returning it.
 
MatrixStreamError getRows (size_t &)
 Get the number of rows in this matrix, store it in the given int.
 
MatrixStreamError getColumns (size_t &)
 Get the number of columns in this matrix, store it in the given int.
 

Protected Member Functions

MatrixStreamError nextTripleImpl (size_t &m, size_t &n, Element &v)
 Read the next triple of row index, column index, value and store it in the given references.
 
MatrixStreamError initImpl (const char *firstLine)
 Read the first line of the matrix from the stream and attempt to determine if it is of this reader's type.
 
void saveTriple (size_t m, size_t n, const Element &v)
 Save the triple (m,n,v) onto the savedTriples std::queue.
 

Protected Attributes

std::istream * sin
 The stream that provides the data to the reader.
 
MatrixStream< Field > * ms
 A pointer to the MatrixStream that is using this reader.
 
size_t _m
 The number of rows in the matrix.
 
bool knowM
 Indicates whether the row dimension is accurate.
 
size_t _n
 Number of columns in the matrix.
 
bool knowN
 Indicates whether the column dimension is accurate.
 
bool atEnd
 Indicates that the end of the matrix has been reached; no more calls to nextTripleImpl will be made once this value is true.
 

Member Typedef Documentation

◆ Element

template<class Field>
typedef MatrixStreamReader<Field>::Element Element

Constructor & Destructor Documentation

◆ MapleReader()

template<class Field>
MapleReader ( )
inline

◆ ~MapleReader()

template<class Field>
~MapleReader ( )
inline

Member Function Documentation

◆ nextTripleImpl()

template<class Field>
MatrixStreamError nextTripleImpl ( size_t & ,
size_t & ,
Element &  )
inlineprotectedvirtual

Read the next triple of row index, column index, value and store it in the given references.

Returns
A MatrixStreamError indicating the success or failure of the operation

Implements MatrixStreamReader< Field >.

◆ initImpl()

template<class Field>
MatrixStreamError initImpl ( const char * firstLine)
inlineprotectedvirtual

Read the first line of the matrix from the stream and attempt to determine if it is of this reader's type.

Returns
A MatrixStreamError indicating the success or failure of the operation

Implements MatrixStreamReader< Field >.

◆ isSparse()

template<class Field>
bool isSparse ( ) const
inlinevirtual

Determine if this format is sparse or dense.

Returns
true if it is a sparse format, false if it is a dense one

Implements MatrixStreamReader< Field >.

◆ getName()

template<class Field>
const char * getName ( ) const
inlinevirtual

Get a unique string describing this format.

Implements MatrixStreamReader< Field >.

◆ shortName()

template<class Field>
const char * shortName ( ) const
inlinevirtual

Get a (possibly) shortened version of the format name.

Reimplemented from MatrixStreamReader< Field >.

◆ saveTriple()

template<class Field>
void saveTriple ( size_t m,
size_t n,
const Element & v )
protectedinherited

Save the triple (m,n,v) onto the savedTriples std::queue.

◆ init()

template<class Field>
MatrixStreamError init ( const char * firstLine,
std::istream * i,
MatrixStream< Field > * m )
inherited

Initialize this MatrixStreamReader.

Calls the initImpl method of the subclass.

◆ nextTriple()

template<class Field>
MatrixStreamError nextTriple ( size_t & m,
size_t & n,
Element & v )
inherited

Get the next triple of row index, column index, value and store it into the three referenced variables.

Uses the nextTripleImpl method of the subclass.

◆ getArray()

template<class Field>
template<class Vect>
MatrixStreamError getArray ( Vect & array)
inherited

Get the whole matrix as a dense (row-major) array of elements.

By default, this implementation just repeatedly calls nextTriple to read in the whole matrix. Subclasses of dense formats should override this behavior.

Parameters
arrayThe array to fill with entries. May be resized as needed. Vect type must ensure that the vector is resizable

◆ saveNext()

template<class Field>
MatrixStreamError saveNext ( )
inherited

Reads the next triple from the subclass nextTripleImpl method and saves it to the savedTriples std::queue rather than returning it.

The error returned is that given from the subclass method.

◆ getRows()

template<class Field>
MatrixStreamError getRows ( size_t & m)
inherited

Get the number of rows in this matrix, store it in the given int.

◆ getColumns()

template<class Field>
MatrixStreamError getColumns ( size_t & n)
inherited

Get the number of columns in this matrix, store it in the given int.

Field Documentation

◆ sin

template<class Field>
std::istream* sin
protectedinherited

The stream that provides the data to the reader.

◆ ms

template<class Field>
MatrixStream<Field>* ms
protectedinherited

A pointer to the MatrixStream that is using this reader.

Useful to get an instance of the field via ms->getField().

◆ _m

template<class Field>
size_t _m
protectedinherited

The number of rows in the matrix.

This will be set by default to 0.

◆ knowM

template<class Field>
bool knowM
protectedinherited

Indicates whether the row dimension is accurate.

◆ _n

template<class Field>
size_t _n
protectedinherited

Number of columns in the matrix.

Similar requirements as _m above.

◆ knowN

template<class Field>
bool knowN
protectedinherited

Indicates whether the column dimension is accurate.

◆ atEnd

template<class Field>
bool atEnd
protectedinherited

Indicates that the end of the matrix has been reached; no more calls to nextTripleImpl will be made once this value is true.

This will automatically be set to true if nextTripleImpl returns END_OF_MATRIX.


The documentation for this class was generated from the following file: