Jive reference manual
|
Provides an interface for classes that implement direct solution algorithms. More...
Public Member Functions | |
virtual void | configure (const Properties &conf, const Properties &props) |
Configures this solver given a set of properties. More... | |
virtual void | setZeroPivotThreshold (double eps)=0 |
Sets the threshold for detecting zero pivots. More... | |
virtual double | getZeroPivotThreshold () const =0 |
Returns the current zero pivot threshold. More... | |
virtual void | setMaxZeroPivotCount (int n)=0 |
Sets the maximum number of allowed zero pivots. More... | |
virtual int | getMaxZeroPivotCount () const =0 |
Returns the maximum number of allowed zero pivots. More... | |
Public Member Functions inherited from jive::solver::Solver | |
virtual void | solve (const Vector &lhs, const Vector &rhs)=0 |
Computes the solution of a linear system of equations. More... | |
virtual jem::Class * | getClass () 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< Object > | clone () const |
Returns a copy of this object. More... | |
Public Attributes | |
jem::util::Event< double > | progressEvent |
Signals that progress is being made. More... | |
Static Public Attributes | |
static const double | DEFAULT_ZERO_PIVOT_THRESHOLD |
The default zero pivot threshold. More... | |
Protected Member Functions | |
virtual | ~DirectSolver () |
Protected Member Functions inherited from jive::solver::Solver | |
virtual | ~Solver () |
Protected Member Functions inherited from jem::Collectable | |
Collectable () | |
Creates an empty Collectable . More... | |
~Collectable () | |
Frees resources. More... | |
Additional Inherited Members | |
Public Types inherited from jive::solver::Solver | |
typedef jem::util::Properties | Properties |
A type representing a set of properties. More... | |
typedef util::Vector | Vector |
A type that represents a vector. More... | |
Static Public Member Functions inherited from jive::solver::Solver | |
static jem::Class * | getType () |
Static Public Member Functions inherited from jem::Object | |
static Class * | getType () |
Returns the Class instance representing the Object class. More... | |
#include<jive/solver/DirectSolver.h>
The abstract class DirectSolver
encapsulates a direct algorithm, such as Gaussian elimination, for solving a linear system of equations. Its main purpose is to provide a single interface for the classes that implement direct solution algorithms.
All classes that are derived from the DirectSolver
class have at least two properties that provide some control over the solution procedure. The first property, called the zero pivot threshold, is a floating point number below which a pivot is marked as zero. To be precise, the i-th pivot p
[i] is marked as a zero pivot if
abs( p[i] ) < eps * s[i]
with the
zero pivot threshold and s
[i] the i-th scale factor. This factor is of the same order of magnitude as the largest element – in absolute value – on the i-th row of the coefficient matrix of the linear system of equations to be solved. The precise definition of the scale factor depends on the dynamic type of a DirectSolver
instance. That is, each class that is derived from the DirectSolver
class may implement its own strategy for computing the scale factors, as long as they are of the same order magnitude as the maximum row elements.
The zero pivot threshold controls the detection of singular systems of equations. If the threshold is very small – close to machine accuracy – then roundoff errors may prevent the solver from detecting that the system of equations is singular. If, on the other hand, the threshold is large – close to one – than the solver may mark a non-singular system of equations as being singular. By default, the zero pivot threshold equals the constant DEFAULT_ZERO_PIVOT_THRESHOLD
.
The second property that controls the solution procedure is an integer, here denoted by n
, that specifies the maximum number of allowed zero pivots. If n equals zero, a DirectSolver
object will throw a SolverException
whenever it encounters a zero pivot. If n is larger than zero, it will only throw an exception if it encounters n or more zero pivots. The first (n-1) zero pivots will be replaced by some non-zero value. Setting n to a non-zero value is useful when you want to compute a solution of a singular, or near singular, system of equations. By default, the maximum number of allowed zero pivots is zero.
|
protectedvirtual |
|
virtual |
Configures this solver given the set of properties stored in the object props. When this function returns, conf contains all the properties that have been used.
The following table lists the properties that are recognized by the DirectSolver
class.
Name | Description | Type | Valid range |
zeroPivotThreshold | Sets the zero pivot threshold | double |
|
maxZeroPivotCount | Sets the maximum number of allowed zero pivots | int | [0,inf) |
Both properties are optional.
conf | - used properties. |
props | - input properties. |
Reimplemented from jive::solver::Solver.
|
pure virtual |
Sets the zero pivot threshold to eps.
eps | - the relative zero pivot threshold. |
eps > 0.0
this->getZeroPivotThreshold() == eps
Implemented in jive::solver::SparseLU.
|
pure virtual |
Returns the current zero pivot threshold.
Implemented in jive::solver::SparseLU.
|
pure virtual |
Sets the maximum number of allowed zero pivots to n.
n | - the maximum number of allowed zero pivots. |
n >= 0
this->getMaxZeroPivotCount() == n
Implemented in jive::solver::SparseLU.
|
pure virtual |
Returns the maximum number of allowed zero pivots.
Implemented in jive::solver::SparseLU.
|
static |
The default zero pivot threshold. Its value is currently set to 1.0e-8
.
jem::util::Event<double> jive::solver::DirectSolver::progressEvent |
The event progressEvent
is emitted repeatedly when the solution of the linear system of equations is being computed. The argument of event is a double precision number between zero and one that indicates how much work has been completed.