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

Contents of /trunk/paso/src/SparseMatrix_addAbsRow.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3369 - (show annotations)
Fri Nov 19 06:26:11 2010 UTC (8 years, 10 months ago) by gross
File MIME type: text/plain
File size: 2092 byte(s)
matrix balance introduced in paso
1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2010 by University of Queensland
5 * Earth Systems Science Computational Center (ESSCC)
6 * http://www.uq.edu.au/esscc
7 *
8 * Primary Business: Queensland, Australia
9 * Licensed under the Open Software License version 3.0
10 * http://www.opensource.org/licenses/osl-3.0.php
11 *
12 *******************************************************/
13
14
15 /***************************************************************************/
16
17 /* Paso: SparseMatrix: adds the absolut values of row entries to an array */
18
19 /***************************************************************************/
20
21 /* Author: Lutz Gross, l.gross@uq.edu.au */
22
23 /**************************************************************/
24
25 #include "Paso.h"
26 #include "SparseMatrix.h"
27
28 void Paso_SparseMatrix_addAbsRow_CSR_OFFSET0(const Paso_SparseMatrix* A, double* array) {
29 dim_t ir,irow,icb,irb;
30 index_t iptr;
31 register double fac;
32 #pragma omp parallel for private(ir,irb,irow,fac,iptr,icb) schedule(static)
33 for (ir=0;ir< A->pattern->numOutput;ir++) {
34 for (irb=0;irb< A->row_block_size;irb++) {
35 irow=irb+A->row_block_size*ir;
36 fac=0.;
37 for (iptr=A->pattern->ptr[ir];iptr<A->pattern->ptr[ir+1]; iptr++) {
38 for (icb=0;icb< A->col_block_size;icb++)
39 fac+=ABS(A->val[iptr*A->block_size+irb+A->row_block_size*icb]);
40 }
41 array[irow]+=fac;
42 }
43 }
44 }
45 void Paso_SparseMatrix_maxAbsRow_CSR_OFFSET0(const Paso_SparseMatrix* A, double* array) {
46 dim_t ir,irow,icb,irb;
47 index_t iptr;
48 register double fac;
49 #pragma omp parallel for private(ir,irb,irow,fac,iptr,icb) schedule(static)
50 for (ir=0;ir< A->pattern->numOutput;ir++) {
51 for (irb=0;irb< A->row_block_size;irb++) {
52 irow=irb+A->row_block_size*ir;
53 fac=0.;
54 for (iptr=A->pattern->ptr[ir];iptr<A->pattern->ptr[ir+1]; iptr++) {
55 for (icb=0;icb< A->col_block_size;icb++)
56 fac=MAX(fac,ABS(A->val[iptr*A->block_size+irb+A->row_block_size*icb]));
57 }
58 array[irow]+=fac;
59 }
60 }
61 }

  ViewVC Help
Powered by ViewVC 1.1.26