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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4797 - (show annotations)
Mon Mar 24 05:42:42 2014 UTC (5 years, 5 months ago) by caltinay
File size: 2426 byte(s)
put SparseMatrix into paso namespace, accompanied by minor code cleanup.

1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2014 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17
18 /****************************************************************************/
19
20 /* Paso: SparseMatrix: adds the absolute values of row entries to an array */
21
22 /****************************************************************************/
23
24 /* Author: Lutz Gross, l.gross@uq.edu.au */
25
26 /****************************************************************************/
27
28 #include "Paso.h"
29 #include "SparseMatrix.h"
30
31 namespace paso {
32
33 void SparseMatrix_addAbsRow_CSR_OFFSET0(const SparseMatrix* A, double* array)
34 {
35 dim_t ir,icb,irb;
36 index_t iptr;
37 #pragma omp parallel for private(ir,irb,iptr,icb) schedule(static)
38 for (ir=0;ir< A->pattern->numOutput;ir++) {
39 for (irb=0;irb< A->row_block_size;irb++) {
40 const dim_t irow=irb+A->row_block_size*ir;
41 register double fac=0.;
42 for (iptr=A->pattern->ptr[ir];iptr<A->pattern->ptr[ir+1]; iptr++) {
43 for (icb=0;icb< A->col_block_size;icb++) {
44 const double rtmp=A->val[iptr*A->block_size+irb+A->row_block_size*icb];
45 fac+=ABS(rtmp);
46 }
47 }
48 array[irow]+=fac;
49 }
50 }
51 }
52
53 void SparseMatrix_maxAbsRow_CSR_OFFSET0(const SparseMatrix* A, double* array)
54 {
55 dim_t ir,icb,irb;
56 index_t iptr;
57 #pragma omp parallel for private(ir,irb,iptr,icb) schedule(static)
58 for (ir=0;ir< A->pattern->numOutput;ir++) {
59 for (irb=0;irb< A->row_block_size;irb++) {
60 const dim_t irow=irb+A->row_block_size*ir;
61 register double fac=0.;
62 for (iptr=A->pattern->ptr[ir];iptr<A->pattern->ptr[ir+1]; iptr++) {
63 for (icb=0;icb< A->col_block_size;icb++) {
64 const double rtmp=A->val[iptr*A->block_size+irb+A->row_block_size*icb];
65 fac=MAX(fac,rtmp);
66 }
67 }
68 array[irow]=MAX(array[irow], fac);
69 }
70 }
71 }
72
73 } // namespace paso
74

Properties

Name Value
svn:mergeinfo /branches/amg_from_3530/paso/src/SparseMatrix_addAbsRow.cpp:3531-3826 /branches/lapack2681/paso/src/SparseMatrix_addAbsRow.cpp:2682-2741 /branches/pasowrap/paso/src/SparseMatrix_addAbsRow.cpp:3661-3674 /branches/py3_attempt2/paso/src/SparseMatrix_addAbsRow.cpp:3871-3891 /branches/restext/paso/src/SparseMatrix_addAbsRow.cpp:2610-2624 /branches/ripleygmg_from_3668/paso/src/SparseMatrix_addAbsRow.cpp:3669-3791 /branches/stage3.0/paso/src/SparseMatrix_addAbsRow.cpp:2569-2590 /branches/symbolic_from_3470/paso/src/SparseMatrix_addAbsRow.cpp:3471-3974 /branches/symbolic_from_3470/ripley/test/python/paso/src/SparseMatrix_addAbsRow.cpp:3517-3974 /release/3.0/paso/src/SparseMatrix_addAbsRow.cpp:2591-2601 /trunk/paso/src/SparseMatrix_addAbsRow.cpp:4257-4344 /trunk/ripley/test/python/paso/src/SparseMatrix_addAbsRow.cpp:3480-3515

  ViewVC Help
Powered by ViewVC 1.1.26