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

Annotation of /trunk/paso/src/SystemMatrix_borrowNormalization.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 415 - (hide annotations)
Wed Jan 4 05:37:33 2006 UTC (14 years, 2 months ago) by gross
File MIME type: text/plain
File size: 2392 byte(s)
a better way of representing the matrix format type is introduced. this is needed for the Paradiso and UMFPACK interface
1 jgs 150 /* $Id$ */
2    
3     /**************************************************************/
4    
5     /* Paso: SystemMatrix */
6    
7     /* returns a borrowed reference to the matrix normaliztion vector */
8    
9     /* if the vector is in valid a new vector is calculate as the inverse */
10     /* of the sum of the absolute value in each row/column */
11    
12     /**************************************************************/
13    
14     /* Copyrights by ACcESS Australia 2005 */
15     /* Author: gross@access.edu.au */
16    
17     /**************************************************************/
18    
19     #include "Paso.h"
20     #include "SystemMatrix.h"
21    
22     double* Paso_SystemMatrix_borrowNormalization(Paso_SystemMatrix* A) {
23     dim_t ir,irow,ic,icb,icol,irb;
24     index_t iptr,icol_failed,irow_failed;
25     double fac;
26     if (!A->normalizer_is_valid) {
27 gross 415 if ((A->type & MATRIX_FORMAT_CSC) || (A->type & MATRIX_FORMAT_SYM) || (A->type & MATRIX_FORMAT_OFFSET1)) {
28     Paso_setError(TYPE_ERROR,"No normalization available for compressed sparse column, symmetric storage scheme or index offset 1.");
29     } else {
30 jgs 150 irow_failed=-1;
31     #pragma omp parallel for private(ir,irb,irow,fac,iptr,icb) schedule(static)
32     for (ir=0;ir< A->pattern->n_ptr;ir++) {
33     for (irb=0;irb< A->row_block_size;irb++) {
34     irow=irb+A->row_block_size*ir;
35     fac=0.;
36 gross 415 for (iptr=A->pattern->ptr[ir];iptr<A->pattern->ptr[ir+1]; iptr++) {
37 jgs 150 for (icb=0;icb< A->col_block_size;icb++)
38     fac+=ABS(A->val[iptr*A->block_size+irb+A->row_block_size*icb]);
39     }
40     if (fac>0) {
41     A->normalizer[irow]=1./fac;
42     } else {
43     A->normalizer[irow]=1.;
44     irow_failed=irow;
45     }
46     }
47     }
48 gross 415 if (irow_failed>=0)
49 jgs 150 Paso_setError(ZERO_DIVISION_ERROR,"There is a row containing zero entries only.");
50 gross 415 A->normalizer_is_valid=TRUE;
51     }
52 jgs 150 }
53     return A->normalizer;
54     }
55     /*
56     * $Log$
57     * Revision 1.2 2005/09/15 03:44:39 jgs
58     * Merge of development branch dev-02 back to main trunk on 2005-09-15
59     *
60     * Revision 1.1.2.1 2005/09/05 06:29:47 gross
61     * These files have been extracted from finley to define a stand alone libray for iterative
62     * linear solvers on the ALTIX. main entry through Paso_solve. this version compiles but
63     * has not been tested yet.
64     *
65     *
66     */

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26