/[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 1811 - (show annotations)
Thu Sep 25 23:11:13 2008 UTC (11 years ago) by ksteube
File MIME type: text/plain
File size: 3192 byte(s)
Copyright updated in all files

1
2 /*******************************************************
3 *
4 * Copyright (c) 2003-2008 by University of Queensland
5 * 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
14
15 /**************************************************************/
16
17 /* Paso: matrix vector product with sparse matrix */
18
19 /**************************************************************/
20
21 /* Copyrights by ACcESS Australia 2003,2004,2005 */
22 /* Author: gross@access.edu.au */
23
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 void Paso_SystemMatrix_MatrixVector(const double alpha,
35 Paso_SystemMatrix* A,
36 const double* in,
37 const double beta,
38 double* out) {
39
40 double *snd_buffer=NULL, *rcv_buffer=NULL;
41 Paso_MPIInfo *mpi_info=A->mpi_info;
42
43 if (A->type & MATRIX_FORMAT_CSC) {
44 if ( mpi_info->size>1) {
45 Paso_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSC is not supported by MPI.");
46 return;
47 } else {
48 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 }
54 } 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 } else {
58 if (A->type & MATRIX_FORMAT_OFFSET1) {
59 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 } else {
66 if (Paso_noError()) {
67 Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(alpha,A,in,beta,out);
68 }
69 }
70 }
71 }
72
73 void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(const double alpha,
74 Paso_SystemMatrix* A,
75 const double* in,
76 const double beta,
77 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 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->col_coupleBlock,remote_values,1.,out);
88 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26