Jive reference manual
|
Applies a set of constraints to a linear system of equations. More...
Public Types | |
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 void | apply ()=0 |
Updates the coefficient matrix of the constrained system of equations. More... | |
virtual void | getRhs (const Vector &g, const Vector &f) const =0 |
Computes a right-hand side vector for the constrained system of equations. More... | |
virtual void | getSolution (const Vector &x, const Vector &y) const =0 |
Computes the solution of the original system of equations. More... | |
virtual Shape | inputMatrixShape () const =0 |
Returns the shape of the input matrix. More... | |
virtual Shape | outputMatrixShape () const =0 |
Returns the shape of the output matrix. More... | |
Protected Member Functions | |
virtual | ~Constrainer () |
#include <jive/solver/Constrainer.h>
The abstract class Constrainer
can be used to apply a set of constraints to a linear system of equations. It extends the algebra::MatrixTransformer
class with functions for computing the right-hand side vector for the constrained system of equations, and for transforming the solution of the constrained system to the original system.
A Constrainer
has in input matrix and an output matrix of type algebra::AbstractMatrix
. The input matrix represents the coefficient matrix of the original, unconstrained system of equations, while the output matrix represents the coefficient matrix of the constrained system of equations. The input and output matrices do not necessarily have to be square; a subclass of the Constrainer
class may provide support for non-square matrices. All current Constrainer
subclasses in Jive, however, only support square matrices.
The Constrainer
class is typically used together with the Solver
class to compute the solution of a linear system of equations that is subjected to a set of constraints.
Note that a Constrainer
object is sometimes called a constraints handler.
ConstrainedSolver
typedef jem::Tuple<int,2> jive::solver::Constrainer::Shape |
The Shape
type represents the shape of a matrix.
The Vector
type represents a one-dimensional array containing double precision numbers. It is just an alias for jive::util::Vector
.
|
protectedvirtual |
|
pure virtual |
Updates the output matrix and the internal state of this Constrainer
object using the current set of constraints. A reference to the output matrix can be obtained by calling the member function getOutputMatrix()
.
The function apply()
should be called whenever the constraints and/or the input matrix have been modified. This function should do nothing if the constraints and the input matrix have not been modified since the last time that this function was called.
|
pure virtual |
Computes a right-hand side vector for the constrained system of equations given a right-hand side vector for the original system of equations. The output parameter g will be set to the constrained right-hand side vector. The input parameter f should contain the original right-hand side vector.
Before calling this function you must have called the function apply()
, unless the coefficient matrix of the original system of equations and the constraints have not been modified.
g | - the right-hand side vector for the constrained system of equations. |
f | - the right-hand side vector for the original system of equations. |
Implemented in jive::solver::GenericConstrainer, jive::solver::PointConstrainer, jive::solver::StdConstrainer, and jive::solver::DummyConstrainer.
|
pure virtual |
Transforms a solution of the constrained system of equations into a solution of the original system of equations. The output parameter x will be set to the solution of the original system. The input parameter y should contain the solution of the constrained system of equations.
x | - the solution of the original system of equations. |
y | - the solution of the constrained system of equations. |
|
pure virtual |
Returns the shape of the input matrix at the last time that the function apply()
was called. The returned shape may be different from
getInputMatrix()->shape()
because the input matrix may have been modified since apply()
was called. This is the case, for instance, if this constraints handler modifies the input matrix in place (that is, if the input and output matrices point to the same object).
You can use this function to determine the size of the solution vector and the right-hand side vector for the original system of equations.
apply()
was called.
|
pure virtual |
Returns the shape of the output matrix at the last time that the function apply()
was called.
You can use this function to determine the size of the solution vector and the right-hand side vector for the constrained system of equations.
apply()
was called.inputMatrixShape()