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

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

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

revision 155 by jgs, Wed Nov 9 02:02:19 2005 UTC revision 415 by gross, Wed Jan 4 05:37:33 2006 UTC
# Line 15  Line 15 
15  #include "SystemMatrix.h"  #include "SystemMatrix.h"
16  #include "Solver.h"  #include "Solver.h"
17    
 #if PTR_OFFSET !=0 || INDEX_OFFSET!=0  
 #error Paso library usage requires PTR_OFFSET=0 and INDEX_OFFSET=0  
 #endif  
   
   
18  /***********************************************************************************/  /***********************************************************************************/
19    
20  /*  free space */  /*  free space */
# Line 34  void Paso_Solver(Paso_SystemMatrix* A,do Line 29  void Paso_Solver(Paso_SystemMatrix* A,do
29      double norm2_of_b,tol,tolerance,time_iter,time_prec,*r=NULL,norm2_of_residual,last_norm2_of_residual,norm_max_of_b,      double norm2_of_b,tol,tolerance,time_iter,time_prec,*r=NULL,norm2_of_residual,last_norm2_of_residual,norm_max_of_b,
30             norm2_of_b_local,norm_max_of_b_local,norm2_of_residual_local,norm_max_of_residual_local,norm_max_of_residual,             norm2_of_b_local,norm_max_of_b_local,norm2_of_residual_local,norm_max_of_residual_local,norm_max_of_residual,
31             last_norm_max_of_residual,*scaling;             last_norm_max_of_residual,*scaling;
32      dim_t i,totIter,cntIter,method;       dim_t i,totIter,cntIter,method;
33      bool_t finalizeIteration;       bool_t finalizeIteration;
34      err_t errorCode;       err_t errorCode;
35      dim_t n_col = A->num_cols * A-> col_block_size;       dim_t n_col = A->num_cols * A-> col_block_size;
36      dim_t n_row = A->num_rows * A-> row_block_size;       dim_t n_row = A->num_rows * A-> row_block_size;
37    
38      tolerance=MAX(options->tolerance,EPSILON);       tolerance=MAX(options->tolerance,EPSILON);
39      Paso_resetError();       Paso_resetError();
40      method=Paso_Options_getSolver(options->method,PASO_PASO,options->symmetric);       method=Paso_Options_getSolver(options->method,PASO_PASO,options->symmetric);
41      /* check matrix type */       /* check matrix type */
42      if (A->type!=CSR) {       if ((A->type & MATRIX_FORMAT_CSC) || (A->type & MATRIX_FORMAT_OFFSET1) || (A->type & MATRIX_FORMAT_SYM) ) {
43        Paso_setError(TYPE_ERROR,"Iterative solver requires CSR format.");         Paso_setError(TYPE_ERROR,"Iterative solver requires CSR format with unsymmetric storage scheme and index offset 0.");
44      }       }
45      if (A->col_block_size != A->row_block_size) {       if (A->col_block_size != A->row_block_size) {
46         Paso_setError(TYPE_ERROR,"Iterative solver requires row and column block sizes to be equal.");          Paso_setError(TYPE_ERROR,"Iterative solver requires row and column block sizes to be equal.");
47       }       }
48       if (A->num_cols != A->num_rows) {       if (A->num_cols != A->num_rows) {
49         Paso_setError(TYPE_ERROR,"Iterative solver requires requires a square matrix.");          Paso_setError(TYPE_ERROR,"Iterative solver requires requires a square matrix.");
50         return;          return;
51       }       }
52       if (Paso_noError()) {       if (Paso_noError()) {
53          /* get normalization */          /* get normalization */
# Line 137  void Paso_Solver(Paso_SystemMatrix* A,do Line 132  void Paso_Solver(Paso_SystemMatrix* A,do
132                #pragma omp for private(i) schedule(static)                #pragma omp for private(i) schedule(static)
133                for (i = 0; i < n_row; i++) r[i]=b[i];                for (i = 0; i < n_row; i++) r[i]=b[i];
134            
135                Paso_SystemMatrix_MatrixVector(DBLE(-1), A, x, DBLE(1), r);                Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(DBLE(-1), A, x, DBLE(1), r);
136            
137                norm2_of_residual_local = 0;                norm2_of_residual_local = 0;
138                norm_max_of_residual_local = 0;                norm_max_of_residual_local = 0;

Legend:
Removed from v.155  
changed lines
  Added in v.415

  ViewVC Help
Powered by ViewVC 1.1.26