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

Annotation of /trunk/paso/src/SystemMatrix_MatrixVector.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2608 - (hide annotations)
Tue Aug 18 01:25:18 2009 UTC (10 years, 2 months ago) by jfenwick
File MIME type: text/plain
File size: 3260 byte(s)
Updating Lutz' email

1 ksteube 1312
2     /*******************************************************
3 ksteube 1811 *
4 jfenwick 2548 * Copyright (c) 2003-2009 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 ksteube 1312 Paso_MPIInfo *mpi_info=A->mpi_info;
42    
43 gross 415 if (A->type & MATRIX_FORMAT_CSC) {
44 ksteube 1312 if ( mpi_info->size>1) {
45     Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSC is not supported by MPI.");
46     return;
47 gross 415 } else {
48 ksteube 1312 if (A->type & MATRIX_FORMAT_OFFSET1) {
49     Paso_SparseMatrix_MatrixVector_CSC_OFFSET1(alpha,A->mainBlock,in,beta,out);
50     } else {
51     Paso_SparseMatrix_MatrixVector_CSC_OFFSET0(alpha,A->mainBlock,in,beta,out);
52     }
53 gross 415 }
54 ksteube 1312 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
55     Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: TRILINOS is not supported with MPI.");
56     return;
57 gross 415 } else {
58     if (A->type & MATRIX_FORMAT_OFFSET1) {
59 ksteube 1312 if ( mpi_info->size>1) {
60     Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSR with index 1 is not supported by MPI.");
61     return;
62     } else {
63     Paso_SparseMatrix_MatrixVector_CSR_OFFSET1(alpha,A->mainBlock,in,beta,out);
64     }
65 gross 415 } else {
66 ksteube 1312 if (Paso_noError()) {
67     Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(alpha,A,in,beta,out);
68     }
69 gross 415 }
70     }
71     }
72    
73 phornby 2039 void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(double alpha,
74 ksteube 1312 Paso_SystemMatrix* A,
75 gross 1639 const double* in,
76     const double beta,
77 ksteube 1312 double* out)
78     {
79     double *remote_values=NULL;
80     /* start exchange */
81     Paso_SystemMatrix_startCollect(A,in);
82     /* process main block */
83     Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->mainBlock,in,beta,out);
84     /* finish exchange */
85     remote_values=Paso_SystemMatrix_finishCollect(A);
86     /* process couple block */
87 artak 2159 if (A->col_coupleBlock->pattern->ptr!=NULL) {
88     Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->col_coupleBlock,remote_values,1.,out);
89     }
90    
91 gross 415 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26