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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3369 - (show annotations)
Fri Nov 19 06:26:11 2010 UTC (10 years, 3 months ago) by gross
File MIME type: text/plain
File size: 1625 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
18
19 applies diagonal matrices from the left and the right
20
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
32
33 void Paso_SparseMatrix_applyDiagonal_CSR_OFFSET0(Paso_SparseMatrix* A, const double* left, const double* right) {
34 index_t ir,icol,iptr,icb,irb,irow,l;
35 const dim_t row_block=A->row_block_size;
36 const dim_t col_block=A->col_block_size;
37 const dim_t n_block=row_block*col_block;
38
39 register double rtmp;
40 #pragma omp parallel for private(l,irow, iptr,icol,ir,irb,icb, rtmp) schedule(static)
41 for (ir=0;ir< A->pattern->numOutput;ir++) {
42 for (irb=0;irb< row_block;irb++) {
43 irow=irb+row_block*ir;
44 rtmp=left[irow];
45 for (iptr=A->pattern->ptr[ir];iptr<A->pattern->ptr[ir+1]; iptr++) {
46 #pragma ivdep
47 for (icb=0;icb< A->col_block_size;icb++) {
48 icol=icb+col_block*(A->pattern->index[iptr]);
49 l=iptr*n_block+irb+row_block*icb;
50 A->val[l]*=rtmp*right[icol];
51 }
52 }
53 }
54 }
55 }

  ViewVC Help
Powered by ViewVC 1.1.26