Package com.imsl.test.example.math
Class GenMinResEx6
java.lang.Object
com.imsl.test.example.math.GenMinResEx6
- All Implemented Interfaces:
GenMinRes.Function,GenMinRes.Preconditioner
Solves the Poisson equation using the second Householder implementation and preconditioning.
The coefficient matrix in this example corresponds to the five-point discretization of the 2-d Poisson equation with the Dirichlet boundary condition. Assuming the natural ordering of the unknowns, and moving all boundary terms to the right hand side, we obtain a block tridiagonal matrix. (Consider the tridiagonal matrix \(T\) which has the value 4.0 down the main diagonal and -1.0 along the upper and lower co-diagonals. Then the coefficient matrix is the block tridiagonal matrix consisting of \(T\)'s down the main diagonal and \(-I\), the identity matrix, along the upper and lower co-diagonals.)Discretizing on a 20 x 20 grid implies that the coefficient matrix is 400 x 400. In the solution, the second Householder implementation is selected and we choose to update the residual vector by direct evaluation.
Preconditioning is used with the preconditioning matrix being a diagonal
matrix with 4.0 down the main diagonal and -1.0 along the upper and lower
co-diagonals. This preconditioner method solves this tridiagonal
matrix.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidamultp(double[] p, double[] z) Obtains the multiplication of the matrixaand the inputp.static voidvoidpreconditioner(double[] r, double[] z) Solve the tridiagonal preconditioning matrix problem for z.
-
Constructor Details
-
GenMinResEx6
- Throws:
Exception
-
-
Method Details
-
amultp
public void amultp(double[] p, double[] z) Obtains the multiplication of the matrixaand the inputp. The result is returned inz.- Specified by:
amultpin interfaceGenMinRes.Function- Parameters:
p- adoublearray withp.length=a[0].lengthz- adoublearray
-
preconditioner
public void preconditioner(double[] r, double[] z) Solve the tridiagonal preconditioning matrix problem for z.- Specified by:
preconditionerin interfaceGenMinRes.Preconditioner- Parameters:
r- an inputdoublearray of lengthngenerated during the implementation of thesolvemethod.z- an outputdoublearray of lengthn.
-
main
- Throws:
Exception
-