Jive reference manual
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions
jive::solver::Solver Class Referenceabstract

Computes the solution of a linear system of equations. More...

Inheritance diagram for jive::solver::Solver:
Inheritance graph

Public Types

typedef jem::util::Properties Properties
 A type representing a set of properties. More...
 
typedef util::Vector Vector
 A type that represents a vector. More...
 

Public Member Functions

virtual void solve (const Vector &lhs, const Vector &rhs)=0
 Computes the solution of a linear system of equations. More...
 
virtual void configure (const Properties &conf, const Properties &props)
 Configures this solver given a set of properties. More...
 
virtual jem::ClassgetClass () const
 Returns the Class instance representing the runtime class of this object. 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< Objectclone () const
 Returns a copy of this object. More...
 

Static Public Member Functions

static jem::ClassgetType ()
 
- Static Public Member Functions inherited from jem::Object
static ClassgetType ()
 Returns the Class instance representing the Object class. More...
 

Protected Member Functions

virtual ~Solver ()
 
- Protected Member Functions inherited from jem::Collectable
 Collectable ()
 Creates an empty Collectable. More...
 
 ~Collectable ()
 Frees resources. More...
 

Detailed Description

#include <jive/solver/Solver.h>

The abstract class Solver defines a single interface for various algorithms that compute the solution of a linear system of equations. You can use this class to implement algorithms that require the solution of one or more linear systems and that do not care how that solution is computed.

See also
Constrainer, Preconditioner

Member Typedef Documentation

The Properties type represents a set of properties. It is just a convenient alias for jem::util::Properties.

The Vector type is just a convenient alias for jive::util::Vector, which, in turn, is an alias for jem::Array<double>.

Constructor & Destructor Documentation

virtual jive::solver::Solver::~Solver ( )
protectedvirtual

Member Function Documentation

virtual void jive::solver::Solver::solve ( const Vector lhs,
const Vector rhs 
)
pure virtual

Computes the solution of the linear system of equations

A * lhs = rhs

in which A denotes the coefficient matrix. This matrix is not passed as a parameter to this function. The reason is that a particular implementation of this function may require a particular data structure in which the coefficient matrix is stored. For instance, a direct solution algorithm must know how the matrix elements are stored in memory. An iterative algorithm, on the other hand, only needs to execute a series of matrix-vector products and does not care how the matrix elements are stored.

Since the coefficient matrix is not passed as an parameter, a Solver object must either store the matrix itself or store a reference to the matrix. The latter approach has been adopted by all classes in Jive that are derived from the Solver class.

Note that the coefficient matrix does not necessarily have to be a square matrix.

When calling this function, the vector rhs should be filled with the components of the right-hand side vector. On exit, the vector lhs will contain the components of the solution vector. The size of the vector lhs must be equal to the number of columns in the coefficient matrix, while the size of the vector rhs must be equal to the number of rows in the coefficient matrix.

Parameters
lhs- the solution vector.
rhs- the right-hand side vector.
Exceptions
SolverException- if the solution could not be computed (singular matrix, breakdown of the solution algorithm, etc).
Precondition
The sizes of the vectors lhs and rhs are compatible with the shape of the coefficient matrix.

Implemented in jive::solver::SparseLU, and jive::solver::ConstrainedSolver.

virtual void jive::solver::Solver::configure ( const Properties conf,
const Properties props 
)
virtual

Configures this solver given the set of properties stored in the object props. To be precise, this function sets the parameters that affect the solution procedure implemented by this solver by extracting the relevant properties from the props object. The object conf provides information about the actual configuration of this solver object: when this function returns, conf contains all the properties that have been used to configure this solver.

Because a solver object knows which properties to use, a program can call this function to configure a solver without having any specific knowledge of the solver. The program can therefore simply read the properties from an input file and pass them straight on to the solver. Only the user who creates the property file needs to know which properties are relevant for which type of solver.

Parameters
conf- used properties.
props- input properties.
Exceptions
jem::util::PropertyException- if an invalid property has been specified.

Reimplemented in jive::solver::DirectSolver.

static jem::Class* jive::solver::Solver::getType ( )
static
virtual jem::Class* jive::solver::Solver::getClass ( ) const
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.

Returns
A pointer to the Class instance representing the runtime class of this object.

Reimplemented from jem::Object.