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

revision 1708 by ksteube, Thu Aug 14 22:42:24 2008 UTC revision 2557 by artak, Mon Jul 27 04:46:37 2009 UTC
# Line 1  Line 1
1
2  /*******************************************************  /*******************************************************
3   *  *
4   *           Copyright 2003-2007 by ACceSS MNRF  * Copyright (c) 2003-2009 by University of Queensland
5   *       Copyright 2007 by University of Queensland  * Earth Systems Science Computational Center (ESSCC)
6   *  * http://www.uq.edu.au/esscc
7   *                http://esscc.uq.edu.au  *
11   *  *
12   *******************************************************/  *******************************************************/
13
14
15  /* TFQMR iterations */  /* TFQMR iterations */
16
# Line 40  Line 41
41  *  =========  *  =========
42  *  *
43  *  r       (input) DOUBLE PRECISION array, dimension N.  *  r       (input) DOUBLE PRECISION array, dimension N.
44  *          On entry, residual of inital guess x  *
45  *  *
46  *  x       (input/output) DOUBLE PRECISION array, dimension N.  *  x       (input/output) DOUBLE PRECISION array, dimension N.
47  *          On input, the initial guess.  *
48  *  *
49  *  ITER    (input/output) INT  *  ITER    (input/output) INT
50  *          On input, the maximum iterations to be performed.  *          On input, the maximum iterations to be performed.
# Line 83  err_t Paso_Solver_TFQMR( Line 84  err_t Paso_Solver_TFQMR(
84    bool_t breakFlag=FALSE, maxIterFlag=FALSE, convergeFlag=FALSE;    bool_t breakFlag=FALSE, maxIterFlag=FALSE, convergeFlag=FALSE;
85    err_t status = SOLVER_NO_ERROR;    err_t status = SOLVER_NO_ERROR;
86    dim_t n = Paso_SystemMatrix_getTotalNumRows(A);    dim_t n = Paso_SystemMatrix_getTotalNumRows(A);
87    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;
88
89    double eta,theta,tau,rho,beta,alpha,sigma,rhon,c;    double eta,theta,tau,rho,beta,alpha,sigma,rhon,c;
90
# Line 105  err_t Paso_Solver_TFQMR( Line 106  err_t Paso_Solver_TFQMR(
106    v=TMPMEMALLOC(n,double);    v=TMPMEMALLOC(n,double);
107    v_old=TMPMEMALLOC(n,double);    v_old=TMPMEMALLOC(n,double);
108

tmp=TMPMEMALLOC(n,double);

109
110   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) {
111       status=SOLVER_MEMORY_ERROR;       status=SOLVER_MEMORY_ERROR;
# Line 136  err_t Paso_Solver_TFQMR( Line 134  err_t Paso_Solver_TFQMR(
134
135    Performance_stopMonitor(pp,PERFORMANCE_SOLVER);    Performance_stopMonitor(pp,PERFORMANCE_SOLVER);
136    Performance_startMonitor(pp,PERFORMANCE_MVM);    Performance_startMonitor(pp,PERFORMANCE_MVM);
137    Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(ONE, A, y1,ZERO,v);    Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(PASO_ONE, A, y1,PASO_ZERO,v);
138    Performance_stopMonitor(pp,PERFORMANCE_MVM);    Performance_stopMonitor(pp,PERFORMANCE_MVM);
139    Performance_startMonitor(pp,PERFORMANCE_SOLVER);    Performance_startMonitor(pp,PERFORMANCE_SOLVER);
140
# Line 175  err_t Paso_Solver_TFQMR( Line 173  err_t Paso_Solver_TFQMR(
173
174            Performance_stopMonitor(pp,PERFORMANCE_SOLVER);            Performance_stopMonitor(pp,PERFORMANCE_SOLVER);
175            Performance_startMonitor(pp,PERFORMANCE_MVM);            Performance_startMonitor(pp,PERFORMANCE_MVM);
176            Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(ONE, A, y2,ZERO,u2);            Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(PASO_ONE, A, y2,PASO_ZERO,u2);
177            Performance_stopMonitor(pp,PERFORMANCE_MVM);            Performance_stopMonitor(pp,PERFORMANCE_MVM);
178            Performance_startMonitor(pp,PERFORMANCE_SOLVER);            Performance_startMonitor(pp,PERFORMANCE_SOLVER);
179
# Line 211  err_t Paso_Solver_TFQMR( Line 209  err_t Paso_Solver_TFQMR(
209       Paso_LinearCombination(n,y1,1.,w,beta,y2);       Paso_LinearCombination(n,y1,1.,w,beta,y2);
210
211       Performance_stopMonitor(pp,PERFORMANCE_SOLVER);       Performance_stopMonitor(pp,PERFORMANCE_SOLVER);
212
213       Performance_startMonitor(pp,PERFORMANCE_MVM);       Performance_startMonitor(pp,PERFORMANCE_MVM);
214       Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(ONE, A, y1,ZERO,u1);       Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(PASO_ONE, A, y1,PASO_ZERO,u1);
215       Performance_stopMonitor(pp,PERFORMANCE_MVM);       Performance_stopMonitor(pp,PERFORMANCE_MVM);
Performance_startMonitor(pp,PERFORMANCE_SOLVER);
216
Performance_stopMonitor(pp,PERFORMANCE_SOLVER);
217       Performance_startMonitor(pp,PERFORMANCE_PRECONDITIONER);       Performance_startMonitor(pp,PERFORMANCE_PRECONDITIONER);
218       Paso_Solver_solvePreconditioner(A,u1,u1);       Paso_Solver_solvePreconditioner(A,u1,u1);
219       Performance_stopMonitor(pp,PERFORMANCE_PRECONDITIONER);       Performance_stopMonitor(pp,PERFORMANCE_PRECONDITIONER);
220
221       Performance_startMonitor(pp,PERFORMANCE_SOLVER);       Performance_startMonitor(pp,PERFORMANCE_SOLVER);
222
223       Paso_Copy(n,v_old,v);       Paso_Copy(n,v_old,v);

Legend:
 Removed from v.1708 changed lines Added in v.2557