/[escript]/branches/doubleplusgood/paso/src/SystemMatrix_MatrixVector.cpp
ViewVC logotype

Contents of /branches/doubleplusgood/paso/src/SystemMatrix_MatrixVector.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4154 - (show annotations)
Tue Jan 22 09:30:23 2013 UTC (7 years ago) by jfenwick
Original Path: trunk/paso/src/SystemMatrix_MatrixVector.c
File MIME type: text/plain
File size: 3942 byte(s)
Round 1 of copyright fixes
1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2013 by University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Open Software License version 3.0
9 * http://www.opensource.org/licenses/osl-3.0.php
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development since 2012 by School of Earth Sciences
13 *
14 *****************************************************************************/
15
16
17 /************************************************************************************/
18
19 /* Paso: matrix vector product with sparse matrix */
20
21 /************************************************************************************/
22
23 /* Copyrights by ACcESS Australia 2003,2004,2005 */
24 /* Author: Lutz Gross, l.gross@uq.edu.au */
25
26 /************************************************************************************/
27
28 #include "Paso.h"
29 #include "SystemMatrix.h"
30
31 /************************************************************************************************/
32
33 /* raw scaled vector update operation: out = alpha * A * in + beta * out */
34
35
36 void Paso_SystemMatrix_MatrixVector(const double alpha,
37 Paso_SystemMatrix* A,
38 const double* in,
39 const double beta,
40 double* out) {
41
42 /*double *snd_buffer=NULL, *rcv_buffer=NULL;*/
43 Esys_MPIInfo *mpi_info=A->mpi_info;
44
45 if (A->is_balanced) {
46 Esys_setError(VALUE_ERROR,"Paso_SystemMatrix_MatrixVector: balanced matrix is not supported.");
47 return;
48 }
49 if (A->type & MATRIX_FORMAT_CSC) {
50 if ( mpi_info->size>1) {
51 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSC is not supported by MPI.");
52 return;
53 } else {
54 if (A->type & MATRIX_FORMAT_OFFSET1) {
55 Paso_SparseMatrix_MatrixVector_CSC_OFFSET1(alpha,A->mainBlock,in,beta,out);
56 } else {
57 Paso_SparseMatrix_MatrixVector_CSC_OFFSET0(alpha,A->mainBlock,in,beta,out);
58 }
59 }
60 } else if (A->type & MATRIX_FORMAT_TRILINOS_CRS) {
61 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: TRILINOS is not supported with MPI.");
62 return;
63 } else {
64 if (A->type & MATRIX_FORMAT_OFFSET1) {
65 if ( mpi_info->size>1) {
66 Esys_setError(SYSTEM_ERROR,"Paso_SystemMatrix_MatrixVector: CSR with index 1 is not supported by MPI.");
67 return;
68 } else {
69 Paso_SparseMatrix_MatrixVector_CSR_OFFSET1(alpha,A->mainBlock,in,beta,out);
70 }
71 } else {
72 if (Esys_noError()) {
73 Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(alpha,A,in,beta,out);
74 }
75 }
76 }
77 }
78
79 void Paso_SystemMatrix_MatrixVector_CSR_OFFSET0(double alpha,
80 Paso_SystemMatrix* A,
81 const double* in,
82 const 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 if (A->type & MATRIX_FORMAT_DIAGONAL_BLOCK) {
90 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0_DIAG(alpha,A->mainBlock,in,beta,out);
91 } else {
92 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->mainBlock,in,beta,out);
93 }
94 /* finish exchange */
95 remote_values=Paso_SystemMatrix_finishCollect(A);
96 /* process couple block */
97 if (A->col_coupleBlock->pattern->ptr!=NULL) {
98 if (A->type & MATRIX_FORMAT_DIAGONAL_BLOCK) {
99 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0_DIAG(alpha,A->col_coupleBlock,remote_values,1.,out);
100 } else {
101 Paso_SparseMatrix_MatrixVector_CSR_OFFSET0(alpha,A->col_coupleBlock,remote_values,1.,out);
102 }
103 }
104 }

Properties

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

  ViewVC Help
Powered by ViewVC 1.1.26