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

Revision 1384 - (show annotations)
Fri Jan 11 02:29:38 2008 UTC (12 years, 1 month ago) by phornby
Original Path: temp_trunk_copy/paso/src/SystemMatrix_MatrixVector.c
File MIME type: text/plain
File size: 3446 byte(s)
```Make a temp copy of the trunk before checking in the windows changes

```
 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 /* has to be called within a parallel region */ 35 /* barrier synconization is performed to make sure that the input vector available */ 36 37 void Paso_SystemMatrix_MatrixVector(double alpha, 38 Paso_SystemMatrix* A, 39 double* in, 40 double beta, 41 double* out) { 42 43 double *snd_buffer=NULL, *rcv_buffer=NULL; 44 dim_t N; 45 Paso_MPIInfo *mpi_info=A->mpi_info; 46 47 if (A->type & MATRIX_FORMAT_CSC) { 48 if ( mpi_info->size>1) { 49 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSC is not supported by MPI."); 50 return; 51 } else { 52 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 } 58 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) { 59 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: TRILINOS is not supported with MPI."); 60 return; 61 } else { 62 if (A->type & MATRIX_FORMAT_OFFSET1) { 63 if ( mpi_info->size>1) { 64 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSR with index 1 is not supported by MPI."); 65 return; 66 } else { 67 Paso_SparseMatrix_MatrixVector_CSR_OFFSET1(alpha,A->mainBlock,in,beta,out); 68 } 69 } else { 70 Paso_SystemMatrix_allocBuffer(A); 71 if (Paso_noError()) { 72 Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(alpha,A,in,beta,out); 73 } 74 Paso_SystemMatrix_freeBuffer(A); 75 } 76 } 77 } 78 79 void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(double alpha, 80 Paso_SystemMatrix* A, 81 double* in, 82 double beta, 83 double* out) 84 { 85 double *remote_values=NULL; 86 /* start exchange */ 87 Paso_SystemMatrix_startCollect(A,in); 88 /* process main block */ 89 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->mainBlock,in,beta,out); 90 /* finish exchange */ 91 remote_values=Paso_SystemMatrix_finishCollect(A); 92 /* process couple block */ 93 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->coupleBlock,remote_values,1.,out); 94 }

## Properties

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