/[escript]/branches/doubleplusgood/paso/src/SparseMatrix_addAbsRow.cpp
ViewVC logotype

Contents of /branches/doubleplusgood/paso/src/SparseMatrix_addAbsRow.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4261 - (show annotations)
Wed Feb 27 06:09:33 2013 UTC (6 years, 9 months ago) by jfenwick
File size: 2386 byte(s)
Initial all c++ build.
But ... there are now reinterpret_cast<>'s
1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 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 since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15
16
17 /*************************************************************************************************/
18
19 /* Paso: SparseMatrix: adds the absolute values of row entries to an array */
20
21 /*************************************************************************************************/
22
23 /* Author: Lutz Gross, l.gross@uq.edu.au */
24
25 /************************************************************************************/
26
27 #include "Paso.h"
28 #include "SparseMatrix.h"
29
30 void Paso_SparseMatrix_addAbsRow_CSR_OFFSET0(const Paso_SparseMatrix* A, double* array) {
31 dim_t ir,icb,irb;
32 index_t iptr;
33 #pragma omp parallel for private(ir,irb,iptr,icb) schedule(static)
34 for (ir=0;ir< A->pattern->numOutput;ir++) {
35 for (irb=0;irb< A->row_block_size;irb++) {
36 const dim_t irow=irb+A->row_block_size*ir;
37 register double fac=0.;
38 for (iptr=A->pattern->ptr[ir];iptr<A->pattern->ptr[ir+1]; iptr++) {
39 for (icb=0;icb< A->col_block_size;icb++) {
40 const double rtmp=A->val[iptr*A->block_size+irb+A->row_block_size*icb];
41 fac+=ABS(rtmp);
42 }
43 }
44 array[irow]+=fac;
45 }
46 }
47 }
48 void Paso_SparseMatrix_maxAbsRow_CSR_OFFSET0(const Paso_SparseMatrix* A, double* array) {
49 dim_t ir,icb,irb;
50 index_t iptr;
51 #pragma omp parallel for private(ir,irb,iptr,icb) schedule(static)
52 for (ir=0;ir< A->pattern->numOutput;ir++) {
53 for (irb=0;irb< A->row_block_size;irb++) {
54 const dim_t irow=irb+A->row_block_size*ir;
55 register double fac=0.;
56 for (iptr=A->pattern->ptr[ir];iptr<A->pattern->ptr[ir+1]; iptr++) {
57 for (icb=0;icb< A->col_block_size;icb++) {
58 const double rtmp=A->val[iptr*A->block_size+irb+A->row_block_size*icb];
59 fac=MAX(fac,rtmp);
60 }
61 }
62 array[irow]=MAX(array[irow], fac);
63 }
64 }
65 }

  ViewVC Help
Powered by ViewVC 1.1.26