/[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 1639 - (hide annotations)
Mon Jul 14 08:55:25 2008 UTC (11 years, 7 months ago) by gross
File MIME type: text/plain
File size: 3227 byte(s)


1 ksteube 1312
2 jgs 150 /* $Id$ */
3    
4 ksteube 1312 /*******************************************************
5     *
6     * Copyright 2003-2007 by ACceSS MNRF
7     * Copyright 2007 by University of Queensland
8     *
9     * http://esscc.uq.edu.au
10     * Primary Business: Queensland, Australia
11     * Licensed under the Open Software License version 3.0
12     * http://www.opensource.org/licenses/osl-3.0.php
13     *
14     *******************************************************/
15 dhawcroft 631
16 jgs 150 /**************************************************************/
17    
18     /* Paso: matrix vector product with sparse matrix */
19    
20     /**************************************************************/
21    
22     /* Copyrights by ACcESS Australia 2003,2004,2005 */
23     /* Author: gross@access.edu.au */
24    
25     /**************************************************************/
26    
27     #include "Paso.h"
28     #include "SystemMatrix.h"
29    
30     /**************************************************************************/
31    
32     /* raw scaled vector update operation: out = alpha * A * in + beta * out */
33    
34    
35 gross 1639 void Paso_SystemMatrix_MatrixVector(const double alpha,
36 ksteube 1312 Paso_SystemMatrix* A,
37 gross 1639 const double* in,
38     const double beta,
39 ksteube 1312 double* out) {
40 jgs 150
41 ksteube 1312 double *snd_buffer=NULL, *rcv_buffer=NULL;
42     Paso_MPIInfo *mpi_info=A->mpi_info;
43    
44 gross 415 if (A->type & MATRIX_FORMAT_CSC) {
45 ksteube 1312 if ( mpi_info->size>1) {
46     Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSC is not supported by MPI.");
47     return;
48 gross 415 } else {
49 ksteube 1312 if (A->type & MATRIX_FORMAT_OFFSET1) {
50     Paso_SparseMatrix_MatrixVector_CSC_OFFSET1(alpha,A->mainBlock,in,beta,out);
51     } else {
52     Paso_SparseMatrix_MatrixVector_CSC_OFFSET0(alpha,A->mainBlock,in,beta,out);
53     }
54 gross 415 }
55 ksteube 1312 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
56     Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: TRILINOS is not supported with MPI.");
57     return;
58 gross 415 } else {
59     if (A->type & MATRIX_FORMAT_OFFSET1) {
60 ksteube 1312 if ( mpi_info->size>1) {
61     Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSR with index 1 is not supported by MPI.");
62     return;
63     } else {
64     Paso_SparseMatrix_MatrixVector_CSR_OFFSET1(alpha,A->mainBlock,in,beta,out);
65     }
66 gross 415 } else {
67 ksteube 1312 if (Paso_noError()) {
68     Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(alpha,A,in,beta,out);
69     }
70 gross 415 }
71     }
72     }
73    
74 gross 1639 void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(const double alpha,
75 ksteube 1312 Paso_SystemMatrix* A,
76 gross 1639 const double* in,
77     const double beta,
78 ksteube 1312 double* out)
79     {
80     double *remote_values=NULL;
81     /* start exchange */
82     Paso_SystemMatrix_startCollect(A,in);
83     /* process main block */
84     Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->mainBlock,in,beta,out);
85     /* finish exchange */
86     remote_values=Paso_SystemMatrix_finishCollect(A);
87     /* process couple block */
88 gross 1552 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->col_coupleBlock,remote_values,1.,out);
89 gross 415 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26