JavaView© v3.95.000

jvx.numeric
Class PnBiconjugateGradient

java.lang.Object
  extended byjvx.numeric.PnBiconjugateGradient

public class PnBiconjugateGradient
extends java.lang.Object

Solve sparse linear equation systems using preconditioned biconjugate gradient method.


Constructor Summary
PnBiconjugateGradient()
          Constructor
 
Method Summary
 double getActualEstimatedError()
          Get estimated error of last linbcg call.
 int getActualNumOfTakenIterations()
          Get number of iterations used in last linbcg call.
 double getConvergenceTest()
          There are four different methods measure the convergence of the solution of the linear equation used in linbcg.
 int getDimension()
          Get dimension.
 double getEPS()
          Set EPS used during solving of linear equations.
 int getMaxNumIterations()
          Get maximum number of allowed iterations.
 double getTolerance()
          Get desired convergence tolerance of linbcg.
 boolean isUsingPrecondioning()
          Check if precondioning is enabled.
 double linbcg(PnSparseMatrix smat, PdVector x, PdVector b)
          Method solves a sparse linear equation system A*x=b using a preconditioned biconjugate gradient method.
static void preconditionJacobiLeft(PnSparseMatrix smat, PdVector b)
          Perform a diagonal (Jacobi) preconditioning from the left to the a linear equation system smat.x=b.
static void preconditionJacobiLeft(PnSparseMatrix smat, PdVector b, int dim)
          Perform a diagonal (Jacobi) preconditioning from the left to the a linear equation system smat.x=b.
 void setConvergenceTest(int aTest)
          There are four different methods measure the convergence of the solution of the linear equation used in linbcg.
 void setDimension(int dim)
          Set dimension of surface matrix is based on.
 void setEPS(double eps)
          Set EPS used during solving of linear equations.
 void setMaxNumIterations(int itmax)
          Set maximum number of allowed iterations.
 void setTolerance(double tol)
          Set desired convergence tolerance of linbcg.
 void usePreconditioning(boolean flag)
          Enable/Disable preconditioning before solving the linear equation system.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PnBiconjugateGradient

public PnBiconjugateGradient()
Constructor

Method Detail

getActualEstimatedError

public double getActualEstimatedError()
Get estimated error of last linbcg call.


getActualNumOfTakenIterations

public int getActualNumOfTakenIterations()
Get number of iterations used in last linbcg call.


setMaxNumIterations

public void setMaxNumIterations(int itmax)
Set maximum number of allowed iterations. Default value is 1000.


getMaxNumIterations

public int getMaxNumIterations()
Get maximum number of allowed iterations.


setTolerance

public void setTolerance(double tol)
Set desired convergence tolerance of linbcg.


getTolerance

public double getTolerance()
Get desired convergence tolerance of linbcg.


setDimension

public void setDimension(int dim)
Set dimension of surface matrix is based on. Coordinate vectors must have length equal dim*(dim of sparseMatrix).


getDimension

public int getDimension()
Get dimension.


setEPS

public void setEPS(double eps)
Set EPS used during solving of linear equations.


getEPS

public double getEPS()
Set EPS used during solving of linear equations. Default value is PuMath.EPS.


setConvergenceTest

public void setConvergenceTest(int aTest)
There are four different methods measure the convergence of the solution of the linear equation used in linbcg. The default is 1.

1. |A*x-b|/|b| 2. |Diag(A)^-1*x-b|/|Diag(A)^-1*b| With Diag(A) denoting the diagonal part of A.
3. This routine uses its own estimate of error in x, and requires its magnitude, divided by the magnitude of x, to be less than tol.
4. Same as 3., except that the largest (in absolute value) component of the error and the largest component of x are used instead of the vector magnitude.


getConvergenceTest

public double getConvergenceTest()
There are four different methods measure the convergence of the solution of the linear equation used in linbcg. Get the index of the method actually used.

See Also:
setConvergenceTest(int)

usePreconditioning

public void usePreconditioning(boolean flag)
Enable/Disable preconditioning before solving the linear equation system. Method uses a Jacobi preconditioning. If the preconditioning is enabled, the method linbcg modifies the given matrix and vector.


isUsingPrecondioning

public boolean isUsingPrecondioning()
Check if precondioning is enabled.


linbcg

public double linbcg(PnSparseMatrix smat,
                     PdVector x,
                     PdVector b)
Method solves a sparse linear equation system A*x=b using a preconditioned biconjugate gradient method. Preconditioning is done by inverting the diagonal part of A.

Returns:
estimated error of solution or -1 at error.

preconditionJacobiLeft

public static void preconditionJacobiLeft(PnSparseMatrix smat,
                                          PdVector b,
                                          int dim)
Perform a diagonal (Jacobi) preconditioning from the left to the a linear equation system smat.x=b. Setting the parameter dim larger than 1, allow to handle more than one equation system with the same matrix in one run. The first equation system uses the 0-th, dim-th, 2*dim-th, 3*dim-th,... entries of b, the second the 1-th, (1+dim)-th, (1+2*dim)-th, ... and so on.


preconditionJacobiLeft

public static void preconditionJacobiLeft(PnSparseMatrix smat,
                                          PdVector b)
Perform a diagonal (Jacobi) preconditioning from the left to the a linear equation system smat.x=b.


JavaView© v3.95.000

The software JavaView© is copyright protected. All Rights Reserved.