Epetra Package Browser (Single Doxygen Collection)  Development
Epetra_FastCrsMatrix.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_FASTCRSMATRIX_H
45 #define EPETRA_FASTCRSMATRIX_H
46 
47 #include "Epetra_Operator.h"
48 #include "Epetra_CrsMatrix.h"
49 class Epetra_Vector;
50 class Epetra_MultiVector;
51 
53 
60 
61  public:
62 
64 
65  Epetra_FastCrsOperator(const Epetra_CrsMatrix & Matrix, bool UseFloats = false);
67 
69  virtual ~Epetra_FastCrsOperator();
71 
73 
74  /* Updates the values only using a matrix that has exactly the same structure as
76  the matrix used to construct this Epetra_FastCrsOperator object.
77  */
78  int UpdateValues(const Epetra_CrsMatrix & Matrix);
80 
82 
83 
85  char * Label() const {return(CrsMatrix_.Label());};
86 
88 
98 
100  /* Returns the quantity \f$ \| A \|_\infty\f$ such that
101  \f[\| A \|_\infty = \max_{1\lei\lem} \sum_{j=1}^n |a_{ij}| \f].
102  */
103  double NormInf() const {return(CrsMatrix_.NormInf());};
104 
106  const Epetra_Comm & Comm() const {return(CrsMatrix_.Comm());};
107 
109 
115  int Apply(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
116 
118 
125  int ApplyInverse(const Epetra_MultiVector& X, Epetra_MultiVector& Y) const;
126 
128  bool HasNormInf() const {return(CrsMatrix_.HasNormInf());};
129 
131  bool UseTranspose() const {return(CrsMatrix_.UseTranspose());};
132 
135 
138 
140 
141 
142  protected:
143  int Allocate(bool UseFloats);
147  double *Values_;
148  float * FloatValues_;
149  int * Indices_;
150  unsigned short * ShortIndices_;
151 
155 
156 
159 
160 };
161 #endif /* EPETRA_FASTCRSMATRIX_H */
Epetra_MultiVector: A class for constructing and using dense multi-vectors, vectors and matrices in p...
bool UseTranspose() const
Returns the current UseTranspose setting.
Epetra_Map: A class for partitioning vectors and matrices.
Definition: Epetra_Map.h:119
Epetra_MultiVector * ExportVector_
int Allocate(bool UseFloats)
const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this matrix operator. ...
bool HasNormInf() const
Returns true because this class can compute an Inf-norm.
Epetra_Vector: A class for constructing and using dense vectors on a parallel computer.
const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this matrix.
int Apply(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_Operator applied to a Epetra_MultiVector X in Y.
double NormInf() const
Returns the infinity norm of the global matrix.
const Epetra_Map & OperatorDomainMap() const
Returns the Epetra_Map object associated with the domain of this matrix operator. ...
const Epetra_Comm & Comm() const
Returns a pointer to the Epetra_Comm communicator associated with this matrix.
virtual ~Epetra_FastCrsOperator()
Epetra_FastCrsOperator Destructor.
bool UseTranspose() const
Returns the current UseTranspose setting.
Epetra_MultiVector * ImportVector_
int UpdateValues(const Epetra_CrsMatrix &Matrix)
Update values using a matrix with identical structure.
Epetra_Comm: The Epetra Communication Abstract Base Class.
Definition: Epetra_Comm.h:73
Epetra_FastCrsOperator: A class for constructing matrix objects optimized for common kernels...
char * Label() const
Returns a character string describing the operator.
Epetra_CompObject: Functionality and data that is common to all computational classes.
const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this matrix operator.
unsigned short * ShortIndices_
int SetUseTranspose(bool UseTranspose_in)
If set true, transpose of this operator will be applied.
Epetra_CrsMatrix: A class for constructing and using real-valued double-precision sparse compressed r...
Epetra_Operator: A pure virtual class for using real-valued double-precision operators.
double NormInf() const
Returns the infinity norm of the global matrix.
int SetUseTranspose(bool UseTranspose)
If set true, transpose of this operator will be applied.
bool HasNormInf() const
Returns true because this class can compute an Inf-norm.
Epetra_FastCrsOperator(const Epetra_CrsMatrix &Matrix, bool UseFloats=false)
Epetra_FastCrsOperator constuctor.
const Epetra_CrsMatrix & CrsMatrix_
const Epetra_Map & OperatorRangeMap() const
Returns the Epetra_Map object associated with the range of this matrix operator.
const char * Label() const
Returns a character string describing the operator.
int ApplyInverse(const Epetra_MultiVector &X, Epetra_MultiVector &Y) const
Returns the result of a Epetra_Operator inverse applied to an Epetra_MultiVector X in Y...