Jive reference manual
|
Encapsulates a sparse matrix. More...
Public Types | |
typedef SparseMatrix | Self |
The type of this class. More... | |
typedef jem::numeric::SparseMatrix< double > | RawMatrix |
A type containing the sparse matrix data. More... | |
typedef RawMatrix::Structure | Structure |
A type representing the structure of a sparse matrix. More... | |
Public Types inherited from jive::algebra::AbstractMatrix | |
typedef AbstractMatrix | Self |
The type of this class. More... | |
typedef jem::Tuple< int, 2 > | Shape |
A type representing the shape of a matrix. More... | |
typedef util::Vector | Vector |
A vector type. More... | |
Public Member Functions | |
virtual Shape | shape () const |
Returns the shape of this sparse matrix. More... | |
void | setMatrix (const RawMatrix &mat)=0 |
Sets the sparse matrix encapsulated by this object. More... | |
const RawMatrix & | getMatrix () const =0 |
Returns the sparse matrix encapsulated by this object. More... | |
void | SparseMatrix::handleNewValues () |
Notifies this object that the contents of the sparse matrix have been modified. More... | |
const Vector & | getValues () const |
Returns a reference to the sparse matrix values. More... | |
Structure | getStructure () const |
Returns the structure of this sparse matrix. More... | |
virtual jem::Class * | getClass () const |
Returns the Class instance representing the runtime class of this object. More... | |
virtual void | readFrom (jem::io::ObjectInput &in) |
virtual void | writeTo (jem::io::ObjectOutput &out) const |
virtual jem::Ref< jem::Object > | clone () const |
virtual void | matmul (const Vector &lhs, const Vector &rhs) const |
Matrix-vector multiplication. More... | |
Public Member Functions inherited from jive::algebra::AbstractMatrix | |
bool | isSquare () const |
Tests whether this matrix is square. More... | |
Public Member Functions inherited from jem::Object | |
virtual String | toString () const |
Returns a short textual description of this object. More... | |
virtual long | hashValue () const |
Returns a hash value for this object. More... | |
virtual bool | equals (const Ref< Object > &obj) const |
Tests whether two objects are equal. More... | |
Ref< Object > | clone () const |
Returns a copy of this object. More... | |
Static Public Member Functions | |
static jem::Class * | getType () |
Static Public Member Functions inherited from jive::algebra::AbstractMatrix | |
static jem::Class * | getType () |
Static Public Member Functions inherited from jem::Object | |
static Class * | getType () |
Returns the Class instance representing the Object class. More... | |
Public Attributes | |
jem::util::Event< Self & > | newStructureEvent |
Signals that the structure of this sparse matrix has been modified. More... | |
Public Attributes inherited from jive::algebra::AbstractMatrix | |
jem::util::Event< Self & > | newShapeEvent |
Signals that the shape of this matrix has changed. More... | |
jem::util::Event< Self & > | newValuesEvent |
Signals that the contents of this matrix have been modified. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from jem::Collectable | |
Collectable () | |
Creates an empty Collectable . More... | |
~Collectable () | |
Frees resources. More... | |
Protected Member Functions inherited from jem::Clonable | |
virtual | ~Clonable () |
virtual void | emitVTable_ () |
Protected Member Functions inherited from jem::Interface | |
virtual | ~Interface () |
Empty destructor. More... | |
Protected Member Functions inherited from jem::io::Serializable | |
virtual | ~Serializable () |
virtual void | emitVtableFunc_ () |
The abstract class SparseMatrix
encapsulates a sparse matrix. Since it is derived from the AbstractMatrix
class, an instance of the SparseMatrix
class can be used wherever an instance of the AbstractMatrix
class is required.
The SparseMatrix
class itself has no data; derived classes are responsible for storing the actual sparse matrix and any additional data structures that they require.
The Self
type is a convenient synonym for SparseMatrix
.
typedef jem::numeric::SparseMatrix<double> jive::algebra::SparseMatrix::RawMatrix |
The RawMatrix
type represents the sparse matrix that is encapsulated by a SparseMatrix
object. It is an alias for jem::numeric::SparseMatrix<double>
.
The Structure
type encapsulates the non-zero pattern of a parse matrix. It is an alias for jem::numeric::SparseStructure
.
|
virtual |
Retruns the shape of this sparse matrix. The implementation of this function provided by the SparseMatrix
class simply executes:
Derived classes may provide a more efficient implementation.
Implements jive::algebra::AbstractMatrix.
|
pure virtual |
Assigns the sparse matrix encapsulated by this object the value mat. For performance reasons, the matrix mat may be copied by reference. This means that the original matrix should not be modified after calling this function.
An implementation of this function should emit the event
If the new matrix has a different shape than the current matrix, then this function should also emit the event newStructureEvent
.newShapeEvent
. Otherwise, it should emit the event newValuesEvent
.
mat | - the sparse matrix that is to be copied into this SparseMatrix object. |
|
pure virtual |
Returns a reference to the sparse matrix encapulated by this object. The reference remains valid until this object is destroyed or until the setMatrix()
member function is called.
The structure of the returned matrix may not be modified. That is, you may not modify the contents of the row offset and column index arrays. You may modify the matrix values, provided that you call the function handleNewValues()
afterwards.
void jive::algebra::SparseMatrix::SparseMatrix::handleNewValues | ( | ) |
Notifies this object that its sparse matrix values have been modified and that it should update its internal data structures, if necessary. An implementation of this function should emit the event newValuesEvent
.
The implementation provided by the SparseMatrix
class simply calls newValuesEvent.emit()
.
const Vector& jive::algebra::SparseMatrix::getValues | ( | ) | const |
Returns a reference to a Vector
that contains the values of the sparse matrix encapsulated by this object. The contents of the vector may be modified, provided that the function handleNewValues()
is called afterwards.
This function is equivalent with:
Structure jive::algebra::SparseMatrix::getStructure | ( | ) | const |
Returns the non-zero pattern of the sparse matrix encapsulated by this object. The contents of returned Structure
object may not be modified.
This function simply executes
|
static |
|
virtual |
Returns a pointer to the Class
instance representing the runtime class of this object. If T
denotes the runtime class of this object, then this function is equivalent with T::getType()
. The pointer is valid during the entire lifetime of the program.
Class
instance representing the runtime class of this object. Reimplemented from jive::algebra::AbstractMatrix.
|
virtual |
Implements jem::io::Serializable.
|
virtual |
Implements jem::io::Serializable.
|
virtual |
Implements jem::Clonable.
|
virtual |
Multiplies the vector rhs with this matrix and stores the result in the vector lhs. The sizes of the two vectors must be compatible with the shape of this matrix.
lhs | - the result vector. |
rhs | - the vector to be multiplied by this matrix. |
Implements jive::algebra::AbstractMatrix.
jem::util::Event<Self&> jive::algebra::SparseMatrix::newStructureEvent |
The newStructureEvent
is emitted whenever the structure of this sparse matrix has been modified. The argument of the event is a reference to this SparseMatrix
object.