Actual source code: taolinearsolver.c

  1: #include "tao_solver.h"    /*I "tao_solver.h"  I*/
  2: #include "taolinearsolver.h"

  6: /*@C
  7:    PreSolve - Prepares a matrix for the linear solve.

  9:    Input Parameter:
 10: .  M - the matrix

 12:    Level: intermediate
 13: @*/
 14: int TaoLinearSolver::PreSolve(TaoMat *M)
 15: {
 16:   TaoFunctionBegin;
 17:   SETERRQ(56, "Operation not defined");
 18:   TaoFunctionReturn(1);
 19: }

 23: /*@C
 24:    Solve - Finds the solution to A x = b .

 26:    Input Parameter:
 27: .  b - the right-hand side

 29:    Output Parameter:
 30: +  x - the solution
 31: -  flag - TAO_TRUE if successful solve, TAO_FALSE otherwise.

 33:    Level: intermediate
 34: @*/
 35: int TaoLinearSolver::Solve(TaoVec *b, TaoVec *x, TaoTruth *flag)
 36: {
 37:   TaoFunctionBegin;
 38:   SETERRQ(56, "Operation not defined");
 39:   TaoFunctionReturn(1);
 40: }

 44: /*@C
 45:    SolveTrustRegion - Finds the solution to the trust-region problem 
 46:        min <x, Ax - b>
 47:        st  |x| <= r
 48:    If A is a symmetrix positive definite matrix and r is large enough,
 49:    then x solves the system of equations Ax = b.
 50:    
 51:    Input Parameter:
 52: .  b - the right-hand side
 53: .  r - the trust-region radius

 55:    Output Parameter:
 56: +  x - the solution
 57: -  flag - TAO_TRUE if successful solve, TAO_FALSE otherwise.

 59:    Level: intermediate
 60: @*/
 61: int TaoLinearSolver::SolveTrustRegion(TaoVec *b, TaoVec *x, double r, 
 62:                                       TaoTruth *t)
 63: {
 64:   TaoFunctionBegin;
 65:   SETERRQ(56,"Operation not defined");
 66:   TaoFunctionReturn(1);
 67: }

 71: /*@C
 72:    GetNumberIterations - Gets the number of iterations used to solve the system.

 74:    Output Parameter:
 75: .  iters - the number of iterations

 77:    Level: intermediate
 78: @*/
 79: int TaoLinearSolver::GetNumberIterations(int * iters){
 80:   int info;
 81:   TaoFunctionBegin;
 82:   info = PetscInfo(0,"TaoLinearSolver::GetNumberIterations() iterations not available.\n"); CHKERRQ(info);
 83:   TaoFunctionReturn(0);
 84: }

 88: /*@C 
 89:   SetTolerances - Sets the convergence tolerances for solving the linear system
 90:   
 91:   Input Parameters:
 92: + rtol - the relative tolerance
 93: . atol - the absolute tolerance
 94: . dtol - the divergence tolerance
 95: - maxits - the maximum number of iterates

 97:   Level: intermediate
 98: @*/  

100: int TaoLinearSolver::SetTolerances(double rtol, double atol, double dtol, int maxits) {
101:   int info;
102:   info = PetscInfo(0,"inherited method not defined.  Tolerances ignored.\n");
103:   CHKERRQ(info);
104:   TaoFunctionReturn(0);
105: }
108: /*@C
109:   SetOptions - Sets any relevant options from the command line.

111:   Input Parameters: none
112:   
113:   Level: intermediate
114: @*/
115: int TaoLinearSolver::SetOptions(){
116:   int info;
117:   TaoFunctionBegin;
118:   info = PetscInfo(0,"TaoLinearSolver::SetOptions(): method not defined or implemented.\n"); CHKERRQ(info);
119:   info = TaoOptionsHead("TaoLinearSolverOptions:  Not currently implemented through TAO");CHKERRQ(info);
120:   info = TaoOptionsTail();CHKERRQ(info);
121:   TaoFunctionReturn(0);
122: }

126: /*@C
127:   View - Views the linear solver.

129:   Input Parameters: none
130:   
131:   Level: intermediate
132: @*/
133: int TaoLinearSolver::View(){
134:   int info;
135:   TaoFunctionBegin;
136:   info = PetscInfo(0,"TaoLinearSolver::View() method not defined.\n"); CHKERRQ(info);
137:   info = TaoPrintStatement(0,"  TaoLinearSolverView: No information available: \n");CHKERRQ(info);
138:   TaoFunctionReturn(0);
139: }