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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1639 - (show annotations)
Mon Jul 14 08:55:25 2008 UTC (11 years, 2 months ago) by gross
File MIME type: text/plain
File size: 3227 byte(s)


1
2 /* $Id$ */
3
4 /*******************************************************
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
16 /**************************************************************/
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 void Paso_SystemMatrix_MatrixVector(const double alpha,
36 Paso_SystemMatrix* A,
37 const double* in,
38 const double beta,
39 double* out) {
40
41 double *snd_buffer=NULL, *rcv_buffer=NULL;
42 Paso_MPIInfo *mpi_info=A->mpi_info;
43
44 if (A->type & MATRIX_FORMAT_CSC) {
45 if ( mpi_info->size>1) {
46 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSC is not supported by MPI.");
47 return;
48 } else {
49 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 }
55 } 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 } else {
59 if (A->type & MATRIX_FORMAT_OFFSET1) {
60 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 } else {
67 if (Paso_noError()) {
68 Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(alpha,A,in,beta,out);
69 }
70 }
71 }
72 }
73
74 void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(const double alpha,
75 Paso_SystemMatrix* A,
76 const double* in,
77 const double beta,
78 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 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->col_coupleBlock,remote_values,1.,out);
89 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26