All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Xpetra_MultiVector.hpp
Go to the documentation of this file.
1 // @HEADER
2 //
3 // ***********************************************************************
4 //
5 // Xpetra: A linear algebra interface package
6 // Copyright 2012 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
39 // Jeremie Gaidamour (jngaida@sandia.gov)
40 // Jonathan Hu (jhu@sandia.gov)
41 // Ray Tuminaro (rstumin@sandia.gov)
42 //
43 // ***********************************************************************
44 //
45 // @HEADER
46 #ifndef XPETRA_MULTIVECTOR_HPP
47 #define XPETRA_MULTIVECTOR_HPP
48 
49 /* this file is automatically generated - do not edit (see script/interfaces.py) */
50 
51 #include <Teuchos_LabeledObject.hpp>
52 #include <Teuchos_DataAccess.hpp>
53 #include <Teuchos_BLAS_types.hpp>
54 #include <Teuchos_Range1D.hpp>
55 #include "Xpetra_ConfigDefs.hpp"
56 #include "Xpetra_DistObject.hpp"
57 #include "Xpetra_Map.hpp"
58 
59 namespace Xpetra {
60 
61 #ifndef DOXYGEN_SHOULD_SKIP_THIS
62  // forward declaration of Vector, needed to prevent circular inclusions
63  template<class S, class LO, class GO, class N> class Vector;
64 #endif
65 
66  template <class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = Kokkos::DefaultNode::DefaultNodeType>
68  : public DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node >
69  {
70 
71  public:
72 
74 
75 
77  virtual ~MultiVector() { }
78 
80 
82 
83 
85  virtual void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)= 0;
86 
88  virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)= 0;
89 
91  virtual void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)= 0;
92 
94  virtual void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)= 0;
95 
97  virtual void putScalar(const Scalar &value)= 0;
98 
100 
102 
103 
106 
109 
111  virtual Teuchos::ArrayRCP< const Scalar > getData(size_t j) const = 0;
112 
114  virtual Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)= 0;
115 
117 
119 
120 
123 
126 
129 
131  virtual void scale(const Scalar &alpha)= 0;
132 
134  virtual void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)= 0;
135 
137  virtual void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Scalar &gamma)= 0;
138 
140  virtual void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const = 0;
141 
143  virtual void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const = 0;
144 
146  virtual void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const = 0;
147 
150 
152  virtual void meanValue(const Teuchos::ArrayView< Scalar > &means) const = 0;
153 
155  virtual void multiply(Teuchos::ETransp transA, Teuchos::ETransp transB, const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Scalar &beta)= 0;
156 
159 
161 
163 
164 
166  virtual size_t getNumVectors() const = 0;
167 
169  virtual size_t getLocalLength() const = 0;
170 
172  virtual global_size_t getGlobalLength() const = 0;
173 
175 
177 
178 
180  virtual std::string description() const = 0;
181 
184 
185  virtual void replaceMap(const RCP<const Map<LocalOrdinal,GlobalOrdinal,Node> >& map) = 0;
186 
188 
190 
191 
193  virtual void setSeed(unsigned int seed)= 0;
194 
195 
196  virtual void randomize(bool bUseXpetraImplementation = false)= 0;
197 
199  virtual void Xpetra_randomize()
200  {
201  typedef Teuchos::ScalarTraits<Scalar> SCT;
202 
203  const size_t numVectors = getNumVectors();
204  for (size_t i = 0; i < numVectors; i++)
205  {
207 
208  const size_t myLength = getLocalLength();
209  for(size_t j=0; j<myLength; j++)
210  {
211  datai[j] = SCT::random();
212  }
213  }
214  }
215 
216 
218 
219  }; // MultiVector class
220 
221 } // Xpetra namespace
222 
223 #define XPETRA_MULTIVECTOR_SHORT
224 #endif // XPETRA_MULTIVECTOR_HPP
virtual Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)=0
View of the local values in a particular vector of this multivector.
virtual void normWeighted(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &weights, const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const =0
virtual void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const =0
virtual void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const =0
Compute Inf-norm of each vector in multi-vector.
virtual std::string description() const =0
A simple one-line description of this object.
virtual void randomize(bool bUseXpetraImplementation=false)=0
virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)=0
Add value to existing value, using global (row) index.
virtual void Xpetra_randomize()
Set multi-vector values to random numbers. XPetra implementation.
virtual void putScalar(const Scalar &value)=0
Set all values in the multivector with the given value.
virtual void setSeed(unsigned int seed)=0
Set seed for Random function.
virtual void replaceMap(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)=0
virtual void reciprocal(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)=0
Put element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,j).
virtual void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)=0
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
virtual void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)=0
Add value to existing value, using local (row) index.
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const =0
Print the object with the given verbosity level to a FancyOStream.
virtual void scale(const Scalar &alpha)=0
Scale the current values of a multi-vector, this = alpha*this.
virtual void elementWiseMultiply(Scalar scalarAB, const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarThis)=0
Element-wise multiply of a Vector A with a MultiVector B.
virtual void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const =0
Compute 1-norm of each vector in multi-vector.
virtual void multiply(Teuchos::ETransp transA, Teuchos::ETransp transB, const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Scalar &beta)=0
Matrix-matrix multiplication: this = beta*this + alpha*op(A)*op(B).
virtual size_t getLocalLength() const =0
Local number of rows on the calling process.
size_t global_size_t
Global size_t object.
virtual global_size_t getGlobalLength() const =0
Global number of rows in the multivector.
static const EVerbosityLevel verbLevel_default
virtual void meanValue(const Teuchos::ArrayView< Scalar > &means) const =0
Compute mean (average) value of each vector in multi-vector. The outcome of this routine is undefined...
virtual void abs(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)=0
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
virtual void dot(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< Scalar > &dots) const =0
Compute dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i]).
virtual void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)=0
Replace value, using global (row) index.
virtual Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)=0
Return a Vector which is a nonconst view of column j.
virtual ~MultiVector()
Destructor.
virtual void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)=0
Replace value, using local (row) index.
virtual size_t getNumVectors() const =0
Number of columns in the multivector.
virtual Teuchos::ArrayRCP< const Scalar > getData(size_t j) const =0
Const view of the local values in a particular vector of this multivector.
virtual Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const =0
Return a Vector which is a const view of column j.