/[escript]/trunk/paso/src/Solvers/Solver_applyBlockDiagonalMatrix.c
ViewVC logotype

Contents of /trunk/paso/src/Solvers/Solver_applyBlockDiagonalMatrix.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 495 - (show annotations)
Mon Feb 6 06:32:06 2006 UTC (13 years, 4 months ago) by gross
File MIME type: text/plain
File size: 2461 byte(s)
performance monitoring added. complies without PAPI.
1 /* $Id$ */
2
3 /**************************************************************/
4
5 /* Paso: apply block diagonal matrix D: x=D*b */
6
7 /* should be called within a parallel region */
8 /* barrier synconization should be performed to make sure that the input vector available */
9
10 /**************************************************************/
11
12 /* Copyrights by ACcESS Australia 2003, 2004, 2005 */
13 /* Author: gross@access.edu.au */
14
15 /**************************************************************/
16
17 #include "Paso.h"
18
19 /**************************************************************/
20
21
22 void Paso_Solver_applyBlockDiagonalMatrix(dim_t n_block,dim_t n,double* D,index_t* pivot,double* x,double* b) {
23 dim_t i;
24 register dim_t i3,i9;
25 register double b0,b1,b2,D00,D10,D20,D01,D11,D21,D02,D12,D22;
26
27 if (n_block==1) {
28 #pragma omp for private(i) schedule(static)
29 for (i=0;i<n;++i) {
30 x[i]=D[i]*b[i];
31 }
32 } else if (n_block==2) {
33 #pragma omp for private(i,b0,b1,D00,D10,D01,D11,i3,i9) schedule(static)
34 for (i=0;i<n;++i) {
35 i3=2*i;
36 i9=4*i;
37 b0=b[i3];
38 b1=b[i3+1];
39 D00=D[i9 ];
40 D10=D[i9+1];
41 D01=D[i9+2];
42 D11=D[i9+3];
43 x[i3 ]=D00*b0+D01*b1;
44 x[i3+1]=D10*b0+D11*b1;
45 }
46 } else if (n_block==3) {
47 #pragma omp for private(i,b0,b1,b2,D00,D10,D20,D01,D11,D21,D02,D12,D22,i3,i9) schedule(static)
48 for (i=0;i<n;++i) {
49 i3=3*i;
50 i9=9*i;
51 b0=b[i3];
52 b1=b[i3+1];
53 b2=b[i3+2];
54 D00=D[i9 ];
55 D10=D[i9+1];
56 D20=D[i9+2];
57 D01=D[i9+3];
58 D11=D[i9+4];
59 D21=D[i9+5];
60 D02=D[i9+6];
61 D12=D[i9+7];
62 D22=D[i9+8];
63 x[i3 ]=D00*b0+D01*b1+D02*b2;
64 x[i3+1]=D10*b0+D11*b1+D12*b2;
65 x[i3+2]=D20*b0+D21*b1+D22*b2;
66 }
67 }
68 return;
69 }
70
71 /*
72 * $Log$
73 * Revision 1.2 2005/09/15 03:44:40 jgs
74 * Merge of development branch dev-02 back to main trunk on 2005-09-15
75 *
76 * Revision 1.1.2.1 2005/09/05 06:29:50 gross
77 * These files have been extracted from finley to define a stand alone libray for iterative
78 * linear solvers on the ALTIX. main entry through Paso_solve. this version compiles but
79 * has not been tested yet.
80 *
81 *
82 */

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26