All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Xpetra_BlockedVector.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 // Jonathan Hu (jhu@sandia.gov)
40 // Andrey Prokopenko (aprokop@sandia.gov)
41 // Tobias Wiesner (tawiesn@sandia.gov)
42 // Ray Tuminaro (rstumin@sandia.gov)
43 //
44 // ***********************************************************************
45 //
46 // @HEADER
47 #ifndef XPETRA_BLOCKEDVECTOR_HPP
48 #define XPETRA_BLOCKEDVECTOR_HPP
49 
50 /* this file is automatically generated - do not edit (see script/interfaces.py) */
51 
52 #include "Xpetra_ConfigDefs.hpp"
53 #include "Xpetra_Map.hpp"
54 #include "Xpetra_Vector.hpp"
55 
56 #include "Xpetra_BlockedMap.hpp"
57 
58 namespace Xpetra {
59 
60 #ifndef DOXYGEN_SHOULD_SKIP_THIS
61  // forward declaration of Vector, needed to prevent circular inclusions
62  template<class S, class LO, class GO, class N> class Vector;
63  template<class S, class LO, class GO, class N> class MapExtractor;
64  template<class S, class LO, class GO, class N> class VectorFactory;
65 #endif
66 
67  template <class Scalar = double,
68  class LocalOrdinal = Map<>::local_ordinal_type,
69  class GlobalOrdinal = typename Map<LocalOrdinal>::global_ordinal_type,
70  class Node = typename Map<LocalOrdinal, GlobalOrdinal>::node_type>
72  : public virtual Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >,
73  public virtual Xpetra::BlockedMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node>
74  {
75  public:
76  typedef Scalar scalar_type;
77  typedef LocalOrdinal local_ordinal_type;
78  typedef GlobalOrdinal global_ordinal_type;
79  typedef Node node_type;
80 
81  using Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dot; // overloading, not hiding
82  using Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::norm1; // overloading, not hiding
83  using Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::norm2; // overloading, not hiding
84  using Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::normInf; // overloading, not hiding
90 
91 
92  private:
93 #undef XPETRA_BLOCKEDVECTOR_SHORT
94 #include "Xpetra_UseShortNames.hpp"
95 
96  public:
98 
99 
101 
110  bool zeroOut=true) :
111  BlockedMultiVector(map,1,zeroOut) { };
112 
126  BlockedMultiVector(bmap,v) { }
127 
141  BlockedMultiVector(bmap,v) { }
142 
156  BlockedMultiVector(mapExtractor,v) { }
157 
171  BlockedMultiVector(mapExtractor,v) { }
172 
174  virtual ~BlockedVector() { }
175 
184  operator= (const MultiVector& rhs) {
185  assign (rhs); // dispatch to protected virtual method
186  return *this;
187  }
188 
190 
192 
194  virtual void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
195  BlockedMultiVector::replaceGlobalValue(globalRow, vectorIndex, value);
196  }
197 
199  virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value) {
200  BlockedMultiVector::sumIntoGlobalValue(globalRow, vectorIndex, value);
201  }
202 
204  virtual void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
205  BlockedMultiVector::replaceLocalValue(myRow, vectorIndex, value);
206  }
207 
209  virtual void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value) {
210  BlockedMultiVector::sumIntoLocalValue(myRow, vectorIndex, value);
211  }
212 
214  virtual void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value) {
215  BlockedMultiVector::replaceGlobalValue(globalRow, 0, value);
216  }
217 
219  virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value) {
220  BlockedMultiVector::sumIntoGlobalValue(globalRow, 0, value);
221  }
222 
224  virtual void replaceLocalValue(LocalOrdinal myRow, const Scalar &value) {
225  BlockedMultiVector::replaceLocalValue(myRow, 0, value);
226  }
227 
229  virtual void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value) {
230  BlockedMultiVector::sumIntoLocalValue(myRow, 0, value);
231  }
232 
233 
235  virtual void putScalar(const Scalar &value) {
237  }
238 
240 
242 
243 
247  }
248 
252  }
253 
255  virtual Teuchos::ArrayRCP< const Scalar > getData(size_t j) const {
256  return BlockedMultiVector::getData(j);
257  }
258 
262  }
263 
265 
267 
268 
270  virtual void dot(const MultiVector&A, const Teuchos::ArrayView< Scalar > &dots) const {
271  BlockedMultiVector::dot(A,dots);
272  return;
273  }
274 
275  virtual Scalar dot(const Vector&A) const {
277  BlockedMultiVector::dot(A,dots);
278  return dots[0];
279  }
280 
281 
283  virtual void abs(const MultiVector&A) {
285  return;
286  }
287 
289  virtual void reciprocal(const MultiVector&A) {
291  return;
292  }
293 
295  virtual void scale(const Scalar &alpha) {
297  return;
298  }
299 
303  return ;
304  }
305 
306  virtual void update(const Scalar &alpha, const MultiVector&A, const Scalar &beta) {
307  BlockedMultiVector::update(alpha,A,beta);
308  return;
309  }
310 
311 
313  virtual void update(const Scalar &alpha, const MultiVector&A, const Scalar &beta, const MultiVector&B, const Scalar &gamma) {
314  BlockedMultiVector::update(alpha,A,beta,B,gamma);
315  return;
316  }
317 
322  this->norm1(norm);
323  return norm[0];
324  }
325 
330  this->norm2(norm);
331  return norm[0];
332  }
333 
338  this->normInf(norm);
339  return norm[0];
340  }
341 
343  virtual void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const {
345  }
346 
348  virtual void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const {
350  }
351 
353  virtual void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const {
355  }
356 
358  virtual void meanValue(const Teuchos::ArrayView< Scalar > &/* means */) const {
359  throw Xpetra::Exceptions::RuntimeError("BlockedVector::meanValue: Not (yet) supported by BlockedVector.");
360  }
361 
362  virtual Scalar meanValue() const {
363  throw Xpetra::Exceptions::RuntimeError("BlockedVector::meanValue: Not (yet) supported by BlockedVector.");
364  }
365 
367  virtual void multiply(Teuchos::ETransp /* transA */, Teuchos::ETransp /* transB */, const Scalar &/* alpha */, const Vector&/* A */, const Vector&/* B */, const Scalar &/* beta */) {
368  throw Xpetra::Exceptions::RuntimeError("BlockedVector::multiply: Not (yet) supported by BlockedVector.");
369  }
370 
371  virtual void multiply(Teuchos::ETransp /* transA */, Teuchos::ETransp /* transB */, const Scalar &/* alpha */, const MultiVector&/* A */, const MultiVector&/* B */, const Scalar &/* beta */) {
372  throw Xpetra::Exceptions::RuntimeError("BlockedVector::multiply: Not (yet) supported by BlockedVector.");
373  }
374 
375 
376  virtual void elementWiseMultiply(Scalar /* scalarAB */, const Xpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node>&/* A */, const MultiVector&/* B */, Scalar /* scalarThis */) {
377  throw Xpetra::Exceptions::RuntimeError("BlockedVector::elementWiseMultiply: Not (yet) supported by BlockedVector.");
378  }
379 
381  virtual void elementWiseMultiply(Scalar /* scalarAB */, const Xpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node>&A, const Vector&B, Scalar /* scalarThis */) {
382  XPETRA_TEST_FOR_EXCEPTION(B.getMap()->isSameAs(*(this->getMap()))==false, Xpetra::Exceptions::RuntimeError, "BlockedVector::elementWiseMultipy: B must have same blocked map than this.");
383  TEUCHOS_TEST_FOR_EXCEPTION(A.getMap()->getNodeNumElements() != B.getMap()->getNodeNumElements(), Xpetra::Exceptions::RuntimeError, "BlockedVector::elementWiseMultipy: A has " << A.getMap()->getNodeNumElements() << " elements, B has " << B.getMap()->getNodeNumElements() << ".");
384  TEUCHOS_TEST_FOR_EXCEPTION(A.getMap()->getGlobalNumElements() != B.getMap()->getGlobalNumElements(), Xpetra::Exceptions::RuntimeError, "BlockedVector::elementWiseMultipy: A has " << A.getMap()->getGlobalNumElements() << " elements, B has " << B.getMap()->getGlobalNumElements() << ".");
385 
386  RCP<const BlockedMap> bmap = this->getBlockedMap();
388  RCP<const Vector> bmvec = Teuchos::rcpFromRef(B);
389  RCP<const BlockedVector> bbmvec = Teuchos::rcp_dynamic_cast<const BlockedVector>(bmvec);
390  TEUCHOS_TEST_FOR_EXCEPTION(bbmvec.is_null() == true, Xpetra::Exceptions::RuntimeError, "BlockedVector::elementWiseMultipy: B must be a BlockedVector.");
391 
392  // TODO implement me
393  /*RCP<Xpetra::MapExtractor<Scalar,LocalOrdinal,GlobalOrdinal,Node> > me = Teuchos::rcp(new Xpetra::MapExtractor<Scalar,LocalOrdinal,GlobalOrdinal,Node>(bmap));
394 
395  for(size_t m = 0; m < bmap->getNumMaps(); m++) {
396  // TODO introduce BlockedVector objects and "skip" this expensive ExtractVector call
397  RCP<const Xpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> > pd = me->ExtractVector(rcpA,m,bmap->getThyraMode());
398  XPETRA_TEST_FOR_EXCEPTION(pd->getMap()->isSameAs(*(this->getBlockedMap()->getMap(m,bmap->getThyraMode())))==false, Xpetra::Exceptions::RuntimeError, "BlockedVector::elementWiseMultipy: sub map of B does not fit with sub map of this.");
399  this->getMultiVector(m,bmap->getThyraMode())->elementWiseMultiply(scalarAB,*pd,*(bbmvec->getMultiVector(m,bmap->getThyraMode())),scalarThis);
400  }*/
401  }
402 
404 
406 
407 
409  virtual size_t getNumVectors() const {
410  return 1;
411  }
412 
414  virtual size_t getLocalLength() const {
415  throw Xpetra::Exceptions::RuntimeError("BlockedVector::getLocalLength: routine not implemented. It has no value as one must iterate on the partial vectors.");
417  }
418 
420  virtual global_size_t getGlobalLength() const {
421  return this->getBlockedMap()->getFullMap()->getGlobalNumElements();
422  }
423 
426  throw Xpetra::Exceptions::RuntimeError("BlockedVector::isSameSize: routine not implemented. It has no value as one must iterate on the partial vectors.");
428  }
429 
431 
433 
434 
436  virtual std::string description() const {
437  return std::string("BlockedVector");
438  }
439 
442  out << description() << std::endl;
443  for(size_t r = 0; r < this->getBlockedMap()->getNumMaps(); r++)
444  getMultiVector(r)->describe(out, verbLevel);
445  }
446 
447  virtual void replaceMap(const RCP<const Map>& map) {
449  }
450 
452  virtual void doImport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node> &/* source */, const Import& /* importer */, CombineMode /* CM */) {
453  throw Xpetra::Exceptions::RuntimeError("BlockedVector::doImport: Not supported by BlockedVector.");
454  }
455 
457  virtual void doExport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node> &/* dest */, const Import& /* importer */, CombineMode /* CM */) {
458  throw Xpetra::Exceptions::RuntimeError("BlockedVector::doExport: Not supported by BlockedVector.");
459  }
460 
462  virtual void doImport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node> &/* source */, const Export& /* exporter */, CombineMode /* CM */) {
463  throw Xpetra::Exceptions::RuntimeError("BlockedVector::doImport: Not supported by BlockedVector.");
464  }
465 
467  virtual void doExport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node> &/* dest */, const Export& /* exporter */, CombineMode /* CM */) {
468  throw Xpetra::Exceptions::RuntimeError("BlockedVector::doExport: Not supported by BlockedVector.");
469  }
470 
472 
474 
475 
477  virtual void setSeed(unsigned int seed) {
478  for(size_t r = 0; r < this->getBlockedMap()->getNumMaps(); ++r) {
479  getMultiVector(r)->setSeed(seed);
480  }
481  }
482 
483 
484  virtual void randomize(bool bUseXpetraImplementation = false) {
485  for(size_t r = 0; r < this->getBlockedMap()->getNumMaps(); ++r) {
486  getMultiVector(r)->randomize(bUseXpetraImplementation);
487  }
488  }
489 
491  virtual void Xpetra_randomize()
492  {
494  }
495 
496 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
497  typedef typename Kokkos::Details::ArithTraits<Scalar>::val_type impl_scalar_type;
498  typedef Kokkos::DualView<impl_scalar_type**, Kokkos::LayoutStride,
499  typename node_type::execution_space,
500  Kokkos::MemoryUnmanaged> dual_view_type;
501  typedef typename dual_view_type::host_mirror_space host_execution_space;
502  typedef typename dual_view_type::t_dev::execution_space dev_execution_space;
503 
509  template<class TargetDeviceType>
510  typename Kokkos::Impl::if_c<
511  Kokkos::Impl::is_same<
512  typename dev_execution_space::memory_space,
513  typename TargetDeviceType::memory_space>::value,
514  typename dual_view_type::t_dev_um,
515  typename dual_view_type::t_host_um>::type
516  getLocalView () const {
517  if(Kokkos::Impl::is_same<
518  typename host_execution_space::memory_space,
519  typename TargetDeviceType::memory_space
520  >::value) {
521  return getHostLocalView();
522  } else {
523  return getDeviceLocalView();
524  }
525  }
526 
527  virtual typename dual_view_type::t_host_um getHostLocalView () const {
528  typename dual_view_type::t_host_um test;
529  return test;
530  }
531  virtual typename dual_view_type::t_dev_um getDeviceLocalView() const {
532  typename dual_view_type::t_dev_um test;
533  return test;
534  }
535 
536 #endif
537 
539 
541  Teuchos::RCP< const Map> getMap() const { XPETRA_MONITOR("BlockedVector::getMap"); return this->getBlockedMap(); }
542 
546  }
547 
549  Teuchos::RCP<MultiVector> getMultiVector(size_t r, bool bThyraMode) const {
550  return BlockedMultiVector::getMultiVector(r,bThyraMode);
551  }
552 
554  void setMultiVector(size_t r, Teuchos::RCP<const Vector> v, bool bThyraMode) {
555  BlockedMultiVector::setMultiVector(r,v,bThyraMode);
556  return;
557  }
558 
561  return BlockedMultiVector::Merge();
562  }
563 
564 
565  protected:
572  virtual void assign (const MultiVector& rhs) {
574  }
575 
576  //virtual void assign (const MultiVector& rhs) {
577  // throw Xpetra::Exceptions::RuntimeError("BlockedVector::assign: Not supported by BlockedVector.");
578  //}
579 
580  private:
581  //Teuchos::RCP<const BlockedMap> map_; ///< blocked map containing the sub block maps (either thyra or xpetra mode)
582  //std::vector<Teuchos::RCP<Vector> > vv_; ///< array containing RCPs of the partial vectors
583  }; // BlockedVector class
584 
585 } // Xpetra namespace
586 
587 #define XPETRA_BLOCKEDVECTOR_SHORT
588 #endif // XPETRA_BLOCKEDVECTOR_HPP
virtual void replaceGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Replace value, using global (row) index.
virtual void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
virtual void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Export &, CombineMode)
Export (using an Importer).
Teuchos::RCP< MultiVector > getMultiVector(size_t r) const
return partial multivector associated with block row r
virtual void reciprocal(const MultiVector &)
Put element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,j).
virtual void putScalar(const Scalar &value)
Set all values in the vector with the given value.
virtual void dot(const MultiVector &A, const Teuchos::ArrayView< Scalar > &dots) const
Compute dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i]).
virtual void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Import &, CombineMode)
Export.
virtual void sumIntoGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Add value to existing value, using global (row) index.
virtual Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this vector.
virtual void replaceLocalValue(LocalOrdinal, size_t, const Scalar &)
Replace value, using local (row) index.
virtual void replaceGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Replace value, using global (row) index.
virtual void abs(const MultiVector &A)
Put element-wise absolute values of input vector in target: A = abs(this).
void setMultiVector(size_t r, Teuchos::RCP< const Vector > v, bool bThyraMode)
set partial Vector associated with block row r
virtual void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Add value to existing value, using local (row) index.
BlockedVector(Teuchos::RCP< const Xpetra::BlockedMap< LocalOrdinal, GlobalOrdinal, Node > > bmap, Teuchos::RCP< Vector > v)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual void Xpetra_randomize()
Set multi-vector values to random numbers. XPetra implementation.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of vector.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const
Compute 1-norm of vector.
Teuchos::RCP< const Map > getMap() const
Access function for the underlying Map this DistObject was constructed with.
virtual void scale(Teuchos::ArrayView< const Scalar > alpha)
Scale the current values of a vector, this[j] = alpha[j]*this[j].
Exception throws to report errors in the internal logical of the program.
virtual void replaceLocalValue(LocalOrdinal myRow, const Scalar &value)
Replace value, using local (row) index.
virtual void Xpetra_randomize()
Set vector values to random numbers. XPetra implementation.
virtual void update(const Scalar &alpha, const MultiVector &A, const Scalar &beta)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
virtual void scale(const Scalar &alpha)
Scale the current values of a multi-vector, this = alpha*this.
virtual void multiply(Teuchos::ETransp, Teuchos::ETransp, const Scalar &, const Vector &, const Vector &, const Scalar &)
Matrix-matrix multiplication: this = beta*this + alpha*op(A)*op(B).
virtual void replaceMap(const RCP< const Map > &map)
virtual Teuchos::RCP< const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
virtual void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
virtual void update(const Scalar &alpha, const MultiVector &A, const Scalar &beta)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
virtual Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
virtual void abs(const MultiVector &)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with the given verbosity level to a FancyOStream.
virtual void assign(const MultiVector &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
virtual void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Export &, CombineMode)
Import (using an Exporter).
virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Add value to existing value, using global (row) index.
virtual void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Import &, CombineMode)
Import.
BlockedVector(Teuchos::RCP< const Xpetra::MapExtractor< Scalar, LocalOrdinal, GlobalOrdinal, Node > > mapExtractor, Teuchos::RCP< Vector > v)
BlockedVector(Teuchos::RCP< const Xpetra::MapExtractor< Scalar, LocalOrdinal, GlobalOrdinal, Node > > mapExtractor, Teuchos::RCP< const Vector > v)
virtual void setSeed(unsigned int seed)
Set seed for Random function.
virtual void multiply(Teuchos::ETransp, Teuchos::ETransp, const Scalar &, const MultiVector &, const MultiVector &, const Scalar &)
Matrix-matrix multiplication: this = beta*this + alpha*op(A)*op(B).
virtual void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
virtual global_size_t getGlobalLength() const
Global number of rows in the Vector.
virtual void elementWiseMultiply(Scalar, const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const MultiVector &, Scalar)
Element-wise multiply of a Vector A with a MultiVector B.
virtual void replaceMap(const RCP< const Map > &map)
virtual Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const =0
The Map describing the parallel distribution of this object.
virtual Teuchos::RCP< const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
virtual size_t getLocalLength() const
Local number of rows on the calling process.
virtual void assign(const MultiVector &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void setMultiVector(size_t r, Teuchos::RCP< const MultiVector > v, bool bThyraMode)
set partial multivector associated with block row r
Teuchos::RCP< MultiVector > Merge() const
merge BlockedVector blocks to a single Vector
BlockedVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & operator=(const MultiVector &rhs)
Assignment operator: Does a deep copy.
virtual void sumIntoLocalValue(LocalOrdinal, size_t, const Scalar &)
Add value to existing value, using local (row) index.
virtual void meanValue(const Teuchos::ArrayView< Scalar > &) const
Compute mean (average) value of each vector in vector. The outcome of this routine is undefined for n...
Teuchos::RCP< MultiVector > getMultiVector(size_t r, bool bThyraMode) const
return partial Vector associated with block row r
virtual void scale(const Scalar &alpha)
Scale the current values of a vector, this = alpha*this.
size_t global_size_t
Global size_t object.
virtual Scalar meanValue() const
Compute mean (average) value of this Vector.
static const EVerbosityLevel verbLevel_default
virtual void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
virtual Teuchos::RCP< Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm in vector.
BlockedVector(const Teuchos::RCP< const BlockedMap > &map, bool zeroOut=true)
Constructor.
Teuchos::RCP< MultiVector > Merge() const
merge BlockedMultiVector blocks to a single MultiVector
virtual Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this vector.
virtual void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
virtual void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
virtual void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
virtual size_t getNumVectors() const
Number of columns in the Vector.
virtual void update(const Scalar &alpha, const MultiVector &A, const Scalar &beta, const MultiVector &B, const Scalar &gamma)
Update vector with scaled values of A and B, this = gamma*this + alpha*A + beta*B.
#define XPETRA_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual bool isSameSize(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &) const
Local number of rows on the calling process.
virtual void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
virtual void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
virtual Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
virtual void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
CombineMode
Xpetra::Combine Mode enumerable type.
virtual ~BlockedVector()
Destructor.
#define XPETRA_MONITOR(funcName)
Teuchos::RCP< MultiVector > getMultiVector(size_t r) const
return partial Vector associated with block row r
virtual std::string description() const
A simple one-line description of this object.
virtual Scalar dot(const Vector &A) const
Computes dot product of this Vector against input Vector x.
virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
virtual void dot(const MultiVector &, const Teuchos::ArrayView< Scalar > &) const
Compute dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i]).
BlockedVector(Teuchos::RCP< const Xpetra::BlockedMap< LocalOrdinal, GlobalOrdinal, Node > > bmap, Teuchos::RCP< const Vector > v)
Teuchos::RCP< const Xpetra::BlockedMap< LocalOrdinal, GlobalOrdinal, Node > > getBlockedMap() const
Access function for the underlying Map this DistObject was constructed with.
virtual Teuchos::RCP< Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
virtual void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
virtual void elementWiseMultiply(Scalar, const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Vector &B, Scalar)
Element-wise multiply of a Vector A with a Vector B.
virtual void reciprocal(const MultiVector &A)
Put element-wise reciprocal values of input vector in target, this(i,j) = 1/A(i,j).
bool is_null() const