All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines
Xpetra_MultiVector.hpp
Go to the documentation of this file.
00001 // @HEADER
00002 //
00003 // ***********************************************************************
00004 //
00005 //             Xpetra: A linear algebra interface package
00006 //                  Copyright 2012 Sandia Corporation
00007 //
00008 // Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
00009 // the U.S. Government retains certain rights in this software.
00010 //
00011 // Redistribution and use in source and binary forms, with or without
00012 // modification, are permitted provided that the following conditions are
00013 // met:
00014 //
00015 // 1. Redistributions of source code must retain the above copyright
00016 // notice, this list of conditions and the following disclaimer.
00017 //
00018 // 2. Redistributions in binary form must reproduce the above copyright
00019 // notice, this list of conditions and the following disclaimer in the
00020 // documentation and/or other materials provided with the distribution.
00021 //
00022 // 3. Neither the name of the Corporation nor the names of the
00023 // contributors may be used to endorse or promote products derived from
00024 // this software without specific prior written permission.
00025 //
00026 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
00027 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00028 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00029 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
00030 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00031 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00032 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
00033 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
00034 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
00035 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 //
00038 // Questions? Contact
00039 //                    Jeremie Gaidamour (jngaida@sandia.gov)
00040 //                    Jonathan Hu       (jhu@sandia.gov)
00041 //                    Ray Tuminaro      (rstumin@sandia.gov)
00042 //
00043 // ***********************************************************************
00044 //
00045 // @HEADER
00046 #ifndef XPETRA_MULTIVECTOR_HPP
00047 #define XPETRA_MULTIVECTOR_HPP
00048 
00049 /* this file is automatically generated - do not edit (see script/interfaces.py) */
00050 
00051 #include <Teuchos_LabeledObject.hpp>
00052 #include <Teuchos_DataAccess.hpp>
00053 #include <Teuchos_BLAS_types.hpp>
00054 #include <Teuchos_Range1D.hpp>
00055 #include "Xpetra_ConfigDefs.hpp"
00056 #include "Xpetra_DistObject.hpp"
00057 #include "Xpetra_Map.hpp"
00058 
00059 namespace Xpetra {
00060 
00061 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00062   // forward declaration of Vector, needed to prevent circular inclusions
00063   template<class S, class LO, class GO, class N> class Vector;
00064 #endif
00065 
00066   template <class Scalar, class LocalOrdinal = int, class GlobalOrdinal = LocalOrdinal, class Node = Kokkos::DefaultNode::DefaultNodeType>
00067   class MultiVector
00068     : public DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node >
00069   {
00070 
00071   public:
00072 
00074 
00075 
00077     virtual ~MultiVector() { }
00078 
00080 
00082 
00083 
00085     virtual void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)= 0;
00086 
00088     virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)= 0;
00089 
00091     virtual void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)= 0;
00092 
00094     virtual void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)= 0;
00095 
00097     virtual void putScalar(const Scalar &value)= 0;
00098 
00100 
00102 
00103 
00105     virtual Teuchos::ArrayRCP< const Scalar > getData(size_t j) const = 0;
00106 
00108     virtual Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)= 0;
00109 
00111 
00113 
00114 
00116     virtual void dot(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< Scalar > &dots) const = 0;
00117 
00119     virtual void abs(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)= 0;
00120 
00122     virtual void reciprocal(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)= 0;
00123 
00125     virtual void scale(const Scalar &alpha)= 0;
00126 
00128     virtual void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)= 0;
00129 
00131     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;
00132 
00134     virtual void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const = 0;
00135 
00137     virtual void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const = 0;
00138 
00140     virtual void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const = 0;
00141 
00143     virtual void normWeighted(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &weights, const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const = 0;
00144 
00146     virtual void meanValue(const Teuchos::ArrayView< Scalar > &means) const = 0;
00147 
00149     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;
00150 
00152     virtual void elementWiseMultiply(Scalar scalarAB, const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarThis)= 0;
00153 
00155 
00157 
00158 
00160     virtual size_t getNumVectors() const = 0;
00161 
00163     virtual size_t getLocalLength() const = 0;
00164 
00166     virtual global_size_t getGlobalLength() const = 0;
00167 
00169 
00171 
00172 
00174     virtual std::string description() const = 0;
00175 
00177     virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const = 0;
00178 
00180 
00182 
00183  
00185     virtual void setSeed(unsigned int seed)= 0;
00186 
00187 
00188     virtual void randomize(bool bUseXpetraImplementation = false)= 0;
00189 
00191     virtual void Xpetra_randomize()
00192     {
00193         typedef Teuchos::ScalarTraits<Scalar> SCT;
00194 
00195         const size_t numVectors = getNumVectors();
00196         for (size_t i = 0; i < numVectors; i++)
00197         {
00198             Teuchos::ArrayRCP< Scalar > datai = getDataNonConst(i);
00199 
00200             const size_t myLength = getLocalLength();
00201             for(size_t j=0; j<myLength; j++)
00202             {
00203                 datai[j] = SCT::random();
00204             }
00205         }
00206     }
00207 
00208 
00210 
00211   }; // MultiVector class
00212 
00213 } // Xpetra namespace
00214 
00215 #define XPETRA_MULTIVECTOR_SHORT
00216 #endif // XPETRA_MULTIVECTOR_HPP
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines