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

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

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

revision 1703 by artak, Thu Aug 14 05:34:25 2008 UTC revision 1778 by gross, Tue Sep 9 07:46:02 2008 UTC
# Line 75  err_t Paso_Solver_TFQMR( Line 75  err_t Paso_Solver_TFQMR(
75      Paso_Performance* pp) {      Paso_Performance* pp) {
76    
77    /* Local variables */    /* Local variables */
78      
79      int m=1;  
80      int j=0;
81      
82    dim_t num_iter=0,maxit;    dim_t num_iter=0,maxit;
83    bool_t breakFlag=FALSE, maxIterFlag=FALSE, convergeFlag=FALSE;    bool_t breakFlag=FALSE, maxIterFlag=FALSE, convergeFlag=FALSE;
84    err_t status = SOLVER_NO_ERROR;    err_t status = SOLVER_NO_ERROR;
85    dim_t n = Paso_SystemMatrix_getTotalNumRows(A);    dim_t n = Paso_SystemMatrix_getTotalNumRows(A);
86    double  *u1=NULL, *u2=NULL, *y1=NULL, *y2=NULL, *d=NULL, *w=NULL, *v=NULL, *v_old=NULL, *tmp=NULL ;    double  *u1=NULL, *u2=NULL, *y1=NULL, *y2=NULL, *d=NULL, *w=NULL, *v=NULL, *v_old=NULL;
87    
88    double eta,theta,tau,rho,beta,alpha,sigma,rhon,c;    double eta,theta,tau,rho,beta,alpha,sigma,rhon,c;
89    
90    double norm_of_residual;    double norm_of_residual;
91      
92  /*                                                                 */  /*                                                                 */
93  /*-----------------------------------------------------------------*/  /*-----------------------------------------------------------------*/
94  /*                                                                 */  /*                                                                 */
# Line 101  err_t Paso_Solver_TFQMR( Line 105  err_t Paso_Solver_TFQMR(
105    v=TMPMEMALLOC(n,double);    v=TMPMEMALLOC(n,double);
106    v_old=TMPMEMALLOC(n,double);    v_old=TMPMEMALLOC(n,double);
107        
     
   tmp=TMPMEMALLOC(n,double);  
     
108    
109   if (u1 ==NULL || u2== NULL || y1 == NULL || y2== NULL || d==NULL || w==NULL || v==NULL || v_old==NULL) {   if (u1 ==NULL || u2== NULL || y1 == NULL || y2== NULL || d==NULL || w==NULL || v==NULL || v_old==NULL) {
110       status=SOLVER_MEMORY_ERROR;       status=SOLVER_MEMORY_ERROR;
# Line 150  err_t Paso_Solver_TFQMR( Line 151  err_t Paso_Solver_TFQMR(
151    tau = Paso_l2(n,r,A->mpi_info);    tau = Paso_l2(n,r,A->mpi_info);
152        
153    rho = tau * tau;    rho = tau * tau;
154    int m=1;          
   int j=0;  
       
155    norm_of_residual=tau*sqrt ( m + 1 );    norm_of_residual=tau*sqrt ( m + 1 );
156        
157    while (!(convergeFlag || maxIterFlag || breakFlag || (status !=SOLVER_NO_ERROR) ))    while (!(convergeFlag || maxIterFlag || breakFlag || (status !=SOLVER_NO_ERROR) ))
# Line 209  err_t Paso_Solver_TFQMR( Line 208  err_t Paso_Solver_TFQMR(
208       Paso_LinearCombination(n,y1,1.,w,beta,y2);       Paso_LinearCombination(n,y1,1.,w,beta,y2);
209    
210       Performance_stopMonitor(pp,PERFORMANCE_SOLVER);       Performance_stopMonitor(pp,PERFORMANCE_SOLVER);
211        
212       Performance_startMonitor(pp,PERFORMANCE_MVM);       Performance_startMonitor(pp,PERFORMANCE_MVM);
213       Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(ONE, A, y1,ZERO,u1);       Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(ONE, A, y1,ZERO,u1);
214       Performance_stopMonitor(pp,PERFORMANCE_MVM);       Performance_stopMonitor(pp,PERFORMANCE_MVM);
      Performance_startMonitor(pp,PERFORMANCE_SOLVER);  
215            
      Performance_stopMonitor(pp,PERFORMANCE_SOLVER);  
216       Performance_startMonitor(pp,PERFORMANCE_PRECONDITIONER);       Performance_startMonitor(pp,PERFORMANCE_PRECONDITIONER);
217       Paso_Solver_solvePreconditioner(A,u1,u1);       Paso_Solver_solvePreconditioner(A,u1,u1);
218       Performance_stopMonitor(pp,PERFORMANCE_PRECONDITIONER);       Performance_stopMonitor(pp,PERFORMANCE_PRECONDITIONER);
219        
220       Performance_startMonitor(pp,PERFORMANCE_SOLVER);       Performance_startMonitor(pp,PERFORMANCE_SOLVER);
221            
222       Paso_Copy(n,v_old,v);       Paso_Copy(n,v_old,v);
# Line 254  err_t Paso_Solver_TFQMR( Line 253  err_t Paso_Solver_TFQMR(
253            
254    /*     End of TFQMR */    /*     End of TFQMR */
255    return status;    return status;
 }  
256    }

Legend:
Removed from v.1703  
changed lines
  Added in v.1778

  ViewVC Help
Powered by ViewVC 1.1.26