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

Contents of /branches/doubleplusgood/paso/src/SparseMatrix_applyDiagonal.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: 1810 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
20
21 applies diagonal matrices from the left and the right
22
23
24 ************************************************************************************/
25
26 /* Author: Lutz Gross, l.gross@uq.edu.au */
27
28 /************************************************************************************/
29
30 #include "Paso.h"
31 #include "SparseMatrix.h"
32
33
34
35 void Paso_SparseMatrix_applyDiagonal_CSR_OFFSET0(Paso_SparseMatrix* A, const double* left, const double* right) {
36 index_t ir,icol,iptr,icb,irb,irow,l;
37 const dim_t row_block=A->row_block_size;
38 const dim_t col_block=A->col_block_size;
39 const dim_t n_block=row_block*col_block;
40
41 register double rtmp;
42 #pragma omp parallel for private(l,irow, iptr,icol,ir,irb,icb, rtmp) schedule(static)
43 for (ir=0;ir< A->pattern->numOutput;ir++) {
44 for (irb=0;irb< row_block;irb++) {
45 irow=irb+row_block*ir;
46 rtmp=left[irow];
47 for (iptr=A->pattern->ptr[ir];iptr<A->pattern->ptr[ir+1]; iptr++) {
48 #pragma ivdep
49 for (icb=0;icb< A->col_block_size;icb++) {
50 icol=icb+col_block*(A->pattern->index[iptr]);
51 l=iptr*n_block+irb+row_block*icb;
52 A->val[l]*=rtmp*right[icol];
53 }
54 }
55 }
56 }
57 }

  ViewVC Help
Powered by ViewVC 1.1.26