Epetra Package Browser (Single Doxygen Collection)  Development
Epetra_RowMatrix.h
Go to the documentation of this file.
1 /*
2 //@HEADER
3 // ************************************************************************
4 //
5 // Epetra: Linear Algebra Services Package
6 // Copyright 2011 Sandia Corporation
7 //
8 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
9 // the U.S. Government retains certain rights in this software.
10 //
11 // Redistribution and use in source and binary forms, with or without
12 // modification, are permitted provided that the following conditions are
13 // met:
14 //
15 // 1. Redistributions of source code must retain the above copyright
16 // notice, this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright
19 // notice, this list of conditions and the following disclaimer in the
20 // documentation and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of the Corporation nor the names of the
23 // contributors may be used to endorse or promote products derived from
24 // this software without specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
27 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
30 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
31 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
32 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
33 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37 //
38 // Questions? Contact Michael A. Heroux (maherou@sandia.gov)
39 //
40 // ************************************************************************
41 //@HEADER
42 */
43 
44 #ifndef EPETRA_ROWMATRIX_H
45 #define EPETRA_ROWMATRIX_H
46 
47 class Epetra_Comm;
48 class Epetra_Import;
49 class Epetra_Export;
50 class Epetra_Vector;
51 class Epetra_MultiVector;
52 #include "Epetra_ConfigDefs.h"
53 #include "Epetra_Operator.h"
54 #include "Epetra_SrcDistObject.h"
55 
56 
58 
68 class EPETRA_LIB_DLL_EXPORT Epetra_RowMatrix: public virtual Epetra_Operator, public virtual Epetra_SrcDistObject {
69 
70  public:
72 
73  virtual ~Epetra_RowMatrix() {};
75 
77 
79 
80 
82 
90  virtual int NumMyRowEntries(int MyRow, int & NumEntries) const = 0;
91 
92 
94  virtual int MaxNumEntries() const = 0;
95 
97 
111  virtual int ExtractMyRowCopy(int MyRow, int Length, int & NumEntries, double *Values, int * Indices) const = 0;
112 
114 
120  virtual int ExtractDiagonalCopy(Epetra_Vector & Diagonal) const = 0;
122 
124 
125 
127 
137  virtual int Multiply(bool TransA, const Epetra_MultiVector& X, Epetra_MultiVector& Y) const = 0;
138 
140 
155  virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector& X,
156  Epetra_MultiVector& Y) const = 0;
157 
159 
169  virtual int InvRowSums(Epetra_Vector& x) const = 0;
170 
172 
179  virtual int LeftScale(const Epetra_Vector& x) = 0;
180 
182 
192  virtual int InvColSums(Epetra_Vector& x) const = 0;
193 
195 
202  virtual int RightScale(const Epetra_Vector& x) = 0;
204 
206 
207 
209  virtual bool Filled() const = 0;
210 
212  /* Returns the quantity \f$ \| A \|_\infty\f$ such that
213  \f[\| A \|_\infty = \max_{1\lei\len} \sum_{i=1}^m |a_{ij}| \f].
214  */
215  virtual double NormInf() const = 0;
216 
218  /* Returns the quantity \f$ \| A \|_1\f$ such that
219  \f[\| A \|_1= \max_{1\lej\len} \sum_{j=1}^n |a_{ij}| \f].
220  */
221  virtual double NormOne() const = 0;
222 
224  /*
225  Note that depending on the matrix implementation, it is sometimes
226  possible to have some nonzeros that appear on multiple processors.
227  In that case, those nonzeros may be counted multiple times (also
228  depending on the matrix implementation).
229  */
230 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
231  virtual int NumGlobalNonzeros() const = 0;
232 #endif
233  virtual long long NumGlobalNonzeros64() const = 0;
234 
236 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
237  virtual int NumGlobalRows() const = 0;
238 #endif
239  virtual long long NumGlobalRows64() const = 0;
240 
242 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
243  virtual int NumGlobalCols() const= 0;
244 #endif
245  virtual long long NumGlobalCols64() const= 0;
246 
248 #ifndef EPETRA_NO_32BIT_GLOBAL_INDICES
249  virtual int NumGlobalDiagonals() const = 0;
250 #endif
251  virtual long long NumGlobalDiagonals64() const = 0;
252 
254  virtual int NumMyNonzeros() const = 0;
255 
257  virtual int NumMyRows() const = 0;
258 
260  virtual int NumMyCols() const = 0;
261 
263  virtual int NumMyDiagonals() const = 0;
264 
266  virtual bool LowerTriangular() const = 0;
267 
269  virtual bool UpperTriangular() const = 0;
270 
272  virtual const Epetra_Map & RowMatrixRowMap() const = 0;
273 
275  virtual const Epetra_Map & RowMatrixColMap() const = 0;
276 
278  virtual const Epetra_Import * RowMatrixImporter() const = 0;
280 };
281 
282 #endif /* EPETRA_ROWMATRIX_H */
Epetra_Comm: The Epetra Communication Abstract Base Class.
Definition: Epetra_Comm.h:73
Epetra_Export: This class builds an export object for efficient exporting of off-processor elements.
Definition: Epetra_Export.h:62
Epetra_Import: This class builds an import object for efficient importing of off-processor elements.
Definition: Epetra_Import.h:63
Epetra_Map: A class for partitioning vectors and matrices.
Definition: Epetra_Map.h:119
Epetra_MultiVector: A class for constructing and using dense multi-vectors, vectors and matrices in p...
Epetra_Operator: A pure virtual class for using real-valued double-precision operators.
Epetra_RowMatrix: A pure virtual class for using real-valued double-precision row matrices.
virtual int NumMyRows() const =0
Returns the number of matrix rows owned by the calling processor.
virtual int NumMyCols() const =0
Returns the number of matrix columns owned by the calling processor.
virtual long long NumGlobalNonzeros64() const =0
virtual int Multiply(bool TransA, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const =0
Returns the result of a Epetra_RowMatrix multiplied by a Epetra_MultiVector X in Y.
virtual int ExtractDiagonalCopy(Epetra_Vector &Diagonal) const =0
Returns a copy of the main diagonal in a user-provided vector.
virtual int NumGlobalCols() const =0
Returns the number of global matrix columns.
virtual int NumGlobalNonzeros() const =0
Returns the number of nonzero entries in the global matrix.
virtual long long NumGlobalRows64() const =0
virtual int NumMyNonzeros() const =0
Returns the number of nonzero entries in the calling processor's portion of the matrix.
virtual int NumMyDiagonals() const =0
Returns the number of local nonzero diagonal entries, based on global row/column index comparisons.
virtual long long NumGlobalCols64() const =0
virtual int NumMyRowEntries(int MyRow, int &NumEntries) const =0
Returns the number of nonzero entries in MyRow.
virtual const Epetra_Map & RowMatrixRowMap() const =0
Returns the Epetra_Map object associated with the rows of this matrix.
virtual int Solve(bool Upper, bool Trans, bool UnitDiagonal, const Epetra_MultiVector &X, Epetra_MultiVector &Y) const =0
Returns result of a local-only solve using a triangular Epetra_RowMatrix with Epetra_MultiVectors X a...
virtual int NumGlobalRows() const =0
Returns the number of global matrix rows.
virtual bool LowerTriangular() const =0
If matrix is lower triangular in local index space, this query returns true, otherwise it returns fal...
virtual int NumGlobalDiagonals() const =0
Returns the number of global nonzero diagonal entries, based on global row/column index comparisons.
virtual int MaxNumEntries() const =0
Returns the maximum of NumMyRowEntries() over all rows.
virtual int ExtractMyRowCopy(int MyRow, int Length, int &NumEntries, double *Values, int *Indices) const =0
Returns a copy of the specified local row in user-provided arrays.
virtual const Epetra_Import * RowMatrixImporter() const =0
Returns the Epetra_Import object that contains the import operations for distributed operations.
virtual int InvRowSums(Epetra_Vector &x) const =0
Computes the sum of absolute values of the rows of the Epetra_RowMatrix, results returned in x.
virtual bool UpperTriangular() const =0
If matrix is upper triangular in local index space, this query returns true, otherwise it returns fal...
virtual int RightScale(const Epetra_Vector &x)=0
Scales the Epetra_RowMatrix on the right with a Epetra_Vector x.
virtual double NormOne() const =0
Returns the one norm of the global matrix.
virtual double NormInf() const =0
Returns the infinity norm of the global matrix.
virtual bool Filled() const =0
If FillComplete() has been called, this query returns true, otherwise it returns false.
virtual int InvColSums(Epetra_Vector &x) const =0
Computes the sum of absolute values of the columns of the Epetra_RowMatrix, results returned in x.
virtual long long NumGlobalDiagonals64() const =0
virtual int LeftScale(const Epetra_Vector &x)=0
Scales the Epetra_RowMatrix on the left with a Epetra_Vector x.
virtual const Epetra_Map & RowMatrixColMap() const =0
Returns the Epetra_Map object associated with the columns of this matrix.
Epetra_SrcDistObject: A class for supporting flexible source distributed objects for import/export op...
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer.