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

Annotation of /branches/doubleplusgood/paso/src/SystemMatrix_MatrixVector.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3369 - (hide annotations)
Fri Nov 19 06:26:11 2010 UTC (9 years, 2 months ago) by gross
Original Path: trunk/paso/src/SystemMatrix_MatrixVector.c
File MIME type: text/plain
File size: 3402 byte(s)
matrix balance introduced in paso
1 ksteube 1312
2     /*******************************************************
3 ksteube 1811 *
4 jfenwick 2881 * Copyright (c) 2003-2010 by University of Queensland
5 ksteube 1811 * 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 dhawcroft 631
14 ksteube 1811
15 jgs 150 /**************************************************************/
16    
17     /* Paso: matrix vector product with sparse matrix */
18    
19     /**************************************************************/
20    
21     /* Copyrights by ACcESS Australia 2003,2004,2005 */
22 jfenwick 2608 /* Author: Lutz Gross, l.gross@uq.edu.au */
23 jgs 150
24     /**************************************************************/
25    
26     #include "Paso.h"
27     #include "SystemMatrix.h"
28    
29     /**************************************************************************/
30    
31     /* raw scaled vector update operation: out = alpha * A * in + beta * out */
32    
33    
34 gross 1639 void Paso_SystemMatrix_MatrixVector(const double alpha,
35 ksteube 1312 Paso_SystemMatrix* A,
36 gross 1639 const double* in,
37     const double beta,
38 ksteube 1312 double* out) {
39 jgs 150
40 jfenwick 1981 /*double *snd_buffer=NULL, *rcv_buffer=NULL;*/
41 jfenwick 3259 Esys_MPIInfo *mpi_info=A->mpi_info;
42 ksteube 1312
43 gross 3369 if (A->is_balanced) {
44     Esys_setError(VALUE_ERROR,"Paso_SystemMatrix_MatrixVector: balanced matrix is not supported.");
45     return;
46     }
47 gross 415 if (A->type & MATRIX_FORMAT_CSC) {
48 ksteube 1312 if ( mpi_info->size>1) {
49 jfenwick 3259 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSC is not supported by MPI.");
50 ksteube 1312 return;
51 gross 415 } else {
52 ksteube 1312 if (A->type & MATRIX_FORMAT_OFFSET1) {
53     Paso_SparseMatrix_MatrixVector_CSC_OFFSET1(alpha,A->mainBlock,in,beta,out);
54     } else {
55     Paso_SparseMatrix_MatrixVector_CSC_OFFSET0(alpha,A->mainBlock,in,beta,out);
56     }
57 gross 415 }
58 ksteube 1312 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
59 jfenwick 3259 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: TRILINOS is not supported with MPI.");
60 ksteube 1312 return;
61 gross 415 } else {
62     if (A->type & MATRIX_FORMAT_OFFSET1) {
63 ksteube 1312 if ( mpi_info->size>1) {
64 jfenwick 3259 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSR with index 1 is not supported by MPI.");
65 ksteube 1312 return;
66     } else {
67     Paso_SparseMatrix_MatrixVector_CSR_OFFSET1(alpha,A->mainBlock,in,beta,out);
68     }
69 gross 415 } else {
70 jfenwick 3259 if (Esys_noError()) {
71 ksteube 1312 Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(alpha,A,in,beta,out);
72     }
73 gross 415 }
74     }
75     }
76    
77 phornby 2039 void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(double alpha,
78 ksteube 1312 Paso_SystemMatrix* A,
79 gross 1639 const double* in,
80     const double beta,
81 ksteube 1312 double* out)
82     {
83     double *remote_values=NULL;
84     /* start exchange */
85     Paso_SystemMatrix_startCollect(A,in);
86     /* process main block */
87     Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->mainBlock,in,beta,out);
88     /* finish exchange */
89     remote_values=Paso_SystemMatrix_finishCollect(A);
90     /* process couple block */
91 artak 2159 if (A->col_coupleBlock->pattern->ptr!=NULL) {
92     Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->col_coupleBlock,remote_values,1.,out);
93     }
94    
95 gross 415 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26