/[escript]/trunk/paso/src/MINRES.c
ViewVC logotype

Diff of /trunk/paso/src/MINRES.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2565 by artak, Tue Jul 28 05:50:15 2009 UTC revision 3120 by gross, Mon Aug 30 10:48:00 2010 UTC
# Line 1  Line 1 
1    
2  /*******************************************************  /*******************************************************
3  *  *
4  * Copyright (c) 2003-2009 by University of Queensland  * Copyright (c) 2003-2010 by University of Queensland
5  * Earth Systems Science Computational Center (ESSCC)  * Earth Systems Science Computational Center (ESSCC)
6  * http://www.uq.edu.au/esscc  * http://www.uq.edu.au/esscc
7  *  *
# Line 118  err_t Paso_Solver_MINRES( Line 118  err_t Paso_Solver_MINRES(
118    Paso_Copy(n,r1,r);    Paso_Copy(n,r1,r);
119        
120    Performance_startMonitor(pp,PERFORMANCE_PRECONDITIONER);    Performance_startMonitor(pp,PERFORMANCE_PRECONDITIONER);
121    Paso_Solver_solvePreconditioner(A,y,r1);    Paso_SystemMatrix_solvePreconditioner(A,y,r1);
122    Performance_stopMonitor(pp,PERFORMANCE_PRECONDITIONER);    Performance_stopMonitor(pp,PERFORMANCE_PRECONDITIONER);
123        
124    beta1=Paso_InnerProduct(n,r1,y,A->mpi_info);    beta1=Paso_InnerProduct(n,r1,y,A->mpi_info);
# Line 135  err_t Paso_Solver_MINRES( Line 135  err_t Paso_Solver_MINRES(
135    Paso_zeroes(n,w);    Paso_zeroes(n,w);
136    Paso_zeroes(n,w2);    Paso_zeroes(n,w2);
137        
138        Paso_zeroes(n,x);
139      
140    Paso_Copy(n,r2,r1);    Paso_Copy(n,r2,r1);
141        
142    Anorm = 0;    Anorm = 0;
# Line 153  err_t Paso_Solver_MINRES( Line 155  err_t Paso_Solver_MINRES(
155    sn     = 0;    sn     = 0;
156    eps    = 0.000001;    eps    = 0.000001;
157    
158    while (!(convergeFlag || maxIterFlag || breakFlag || (status !=SOLVER_NO_ERROR) ))    while (!(convergeFlag || (status !=SOLVER_NO_ERROR) ))
159    {    {
160                        
161       s=1/beta;       s=1/beta;
# Line 176  err_t Paso_Solver_MINRES( Line 178  err_t Paso_Solver_MINRES(
178    
179       Performance_stopMonitor(pp,PERFORMANCE_SOLVER);       Performance_stopMonitor(pp,PERFORMANCE_SOLVER);
180       Performance_startMonitor(pp,PERFORMANCE_PRECONDITIONER);       Performance_startMonitor(pp,PERFORMANCE_PRECONDITIONER);
181       Paso_Solver_solvePreconditioner(A,y,r2);       Paso_SystemMatrix_solvePreconditioner(A,y,r2);
182       Performance_stopMonitor(pp,PERFORMANCE_PRECONDITIONER);       Performance_stopMonitor(pp,PERFORMANCE_PRECONDITIONER);
183       Performance_startMonitor(pp,PERFORMANCE_SOLVER);       Performance_startMonitor(pp,PERFORMANCE_SOLVER);
184    
# Line 238  err_t Paso_Solver_MINRES( Line 240  err_t Paso_Solver_MINRES(
240    
241       rnorm  = phibar;       rnorm  = phibar;
242       epsx   = Anorm*ynorm*eps;       epsx   = Anorm*ynorm*eps;
243        
244       maxIterFlag = (num_iter > maxit);      
245       norm_of_residual=rnorm;       if (status==SOLVER_NO_ERROR) {  
246       convergeFlag=((norm_of_residual/(Anorm*ynorm))<(*tolerance) || 1+(norm_of_residual/(Anorm*ynorm)) <=1);          maxIterFlag = (num_iter > maxit);
247                norm_of_residual=rnorm;
248       if (maxIterFlag) {          convergeFlag=((norm_of_residual/(Anorm*ynorm))<(*tolerance) || 1+(norm_of_residual/(Anorm*ynorm)) <=1);
249           status = SOLVER_MAXITER_REACHED;          if (maxIterFlag) {
250       } else if (breakFlag) {              status = SOLVER_MAXITER_REACHED;
251           status = SOLVER_BREAKDOWN;          } else if (breakFlag) {
252                status = SOLVER_BREAKDOWN;
253            }
254       }       }
255      ++(num_iter);      ++(num_iter);
256    }    }

Legend:
Removed from v.2565  
changed lines
  Added in v.3120

  ViewVC Help
Powered by ViewVC 1.1.26