Package ru.sscc.matrix.solve

Collection of Solvers intended for solving of Systems of Linear Algebraic Equations (SLAE).

See:
          Description

Interface Summary
RealSolver Describes interface for solving of System of Linear Algebraic Equations (SLAE).
 

Class Summary
CholeskyBandSolver Performs the solving of SLAE with Positive Definite Symmetric Banded Matrix by the Cholesky method (eg Square Root factorization).
CholeskySolver Performs the solving of SLAE with Positive Definite Symmetric Dense Matrix by the Cholesky method (eg Square Root factorization).
CrautSolver Performs the solving of SLAE with Square Dense Matrix by the Craut method with partial pivoting by column.
EliminationSolver Solves SLAE with a rectangular dense matrix using Gauss eliminations with partial pivoting by column.
GaussSolver Performs the solving of SLAE with Square Dense Matrix by the Gauss method without pivoting.
GeneralGreenSolver Performs the solving of SLAE having the form Cx+By=b, BTx=c.
GreenSolver Performs the solving of SLAE having the form Cx+By=b with restriction BTx=0.
RealCommonSolver Basic abstract class for direct solvers of SLAE with a real rectangular dense matrix.
RealDenseSolver Basic abstract class for direct solvers of SLAE with a real dense matrix.
RealDirectSolver Basic abstract class for all real direct solvers of SLAE.
ReflectionSolver Solves SLAE with a rectangular dense matrix using Hausholder reflections.
RotationSolver Solves SLAE with a rectangular dense matrix using Givens rotations.
 

Package ru.sscc.matrix.solve Description

Collection of Solvers intended for solving of Systems of Linear Algebraic Equations (SLAE).

Basic interfaces and classes

The RealSolver is the interface implemented by any solver of SLAE having a real matrix and real right-hand side. It contains the solve(source,target) method that solves SLAE using the source vector as the right-hand side and writes the solution to the target vector. Two auxiliary methods, sourceSize() and targetSize(), return the sizes of source and target vectors used by the solver.

The RealSolver class supports the serialization.

The RealDirectSolver abstract class is the basic class for all solvers using direct methods for solving SLAE. The matrix to be used in SLAE is attached to the solver. Before the solving of SLAE, a direct solver does some preliminary job that we call the factorization: the matrix is decomposed to a number of multiples using an elimination algorithm. This job is done in the abstract factorize() method. While the factorization, the CalculatingException may be thrown if the matrix is "bad" in some sense. A direct solver can have two states: before the factorization and after it. If the matrix is not-factorized yet, the solve method is inaccessible. When the matrix is factorized, it becomes non-algebraic, and all algebraic operations with it are blocked. The reuse method implemented in all solver's subclasses changes the state of the solver and the attached matrix to the initial state: the factorization tag is cleared and the matrix becomes algebraic again. So, after that, you can again fill the attached matrix in and solve SLAE once more.

The iterative refinement algorithm is implemented in this class by the solveAndRefine(initialMatrix,source,target) method. To do the refinement, the non-factorized copy of the matrix is needed. The refinement is most efficient if the attached matrix entries are of the float type. If the refinement has an effect, the method returns the true.

The construction of the inverse matrix is also implemented in this class. You can use the constructInverse(targetMatrix) or constructRefinedInverse(initialMatrix,targetMatrix) methods for this purpose.

The RealDirectSolver class supports cloning. A clone is always clear solver without attached matrix.

The RealDenseSolver abstract class extends the RealDirectSolver. It is devoted to the solving of SLAE with a dense matrix. The solving of SLAE with lower and upper triangular square dense matrices is implemented in this class by static methods. If the solving of SLAE by a solver of this type is unsuccessful, try to use the solver of the RealCommonSolver subtype.

The RealCommonSolver abstract class extends the RealDenseSolver. It is devoted to the solving of SLAE with a rectangular dense matrix. The features of the class are the following:

Collection of solvers

The CholeskyBandSolver class solves SLAE with Positive Definite Symmetric Banded Matrix by the Cholesky (Square Root) Method.

The CholeskySolver class solves SLAE with Positive Definite Symmetric Dense Matrix by the Cholesky Method. The lower triangular submatrix is used and modified on the factorization. The solver extends the RealDenseSolver class.

The GaussSolver class solves SLAE with Dense Matrix by the Gauss Method without pivoting. The solver extends the RealDenseSolver class. We recommend to use this method for diagonal dominant matrices. It may be also used for positive or negative definite matrices, but in this case the accuracy of the solution may be unsatisfactory if the matrix asymmetric part is too large. Use the CrautSolver instead.

The CrautSolver class solves SLAE with Dense Matrix by the Craut Method with partial pivoting by column. The solver extends the RealDenseSolver class. If the matrix is ill-posed or singular, use a solver of the RealCommonSolver type.

The RotationSolver class solves SLAE with Rectangular Dense Matrix on the base of Givens Rotations. The normal pseudo-solution is constructed if the SLAE is inconsistent or has many solutions. The solver extends the RealCommonSolver class.

The ReflectionSolver class solves SLAE with Rectangular Dense Matrix on the base of Hausholder Reflections. The normal pseudo-solution is constructed if the SLAE is inconsistent or has many solutions. This solver is 30% faster than the RotationSolver but loses in accuracy. The solver extends the RealCommonSolver class.

The EliminationSolver class solves SLAE with Rectangular Dense Matrix on the base of Gauss Eliminations with partial pivoting by column. It uses nonorthogonal transformations, so the solution of inconsistent SLAE isn't pseudo-solution, but, if the SLAE has many solutions, the constructed solution is always normal. The solveT() method constructs the pseudo-solution that isn't normal, e.g. the pseudo-solution for the transposed system isn't orthogonal to the null space of the transposed matrix. This solver is 2 times faster than the ReflectionSolver but usually loses in accuracy. The solver extends the RealCommonSolver class.

The GreenSolver class solves the special block SLAE

æ
ç
è
C
B
BT
O
ö
÷
ø
æ
ç
è
x
y
ö
÷
ø
= æ
ç
è
b
0
ö
÷
ø
with square m×m-matrix C and rectangular m×k-matrix B. The matrices C and B are stored together in one m×n-matrix, n = m+k. The right-hand side vector b has the length m and the solution vector has the length n and consists of vectors x and y merged together: x is first and y is last. The solver uses the special transformation reducing the dimensionality of the system. Two solvers are used by this solver inside: (1) the solver of RealDenseSolver's subtype is used for factorization of the reduced system and (2) the solver of RealCommonSolver's subtype is used in the transformation of the original system. The CrautSolver and ReflectionSolver are used by the default. The user can select other solvers to be internal. This solver extends the RealDenseSolver class.

The GeneralGreenSolver class extends the GreenSolver. It solves the block SLAE

æ
ç
è
C
B
BT
O
ö
÷
ø
æ
ç
è
x
y
ö
÷
ø
= æ
ç
è
b
c
ö
÷
ø
with an arbitrary right-hand side (contrary to the previous solver in which c = 0). The additional solve(b,c,z) method allows to pass right-hand side vectors b and c separately (the null may be used instead of zero vectors).