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.
RealCommonSolver Basic abstract class for direct orthogonal solvers of SLAE with a real rectangular dense matrix.
RealDirectSolver Basic abstract class for all real direct solvers of SLAE.
RealSquareSolver Basic abstract class for direct solvers of SLAE with a real dense square matrix.
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 RealSquareSolver abstract class extends the RealDirectSolver. It is devoted to the solving of SLAE with a square 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 type.

The RealCommonSolver abstract class extends the RealDirectSolver. 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 RealSquareSolver class.

The GaussSolver class solves SLAE with Dense Matrix by the Gauss Method without pivoting. The solver extends the RealSquareSolver 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 RealSquareSolver 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. The normal "pseudo"-solution is constructed if the SLAE is inconsistent or has many solutions. This solver is 2 times faster than the ReflectionSolver but essentially loses in accuracy. The solver extends the RealCommonSolver class.