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.");
416  return 0;
417  }
418 
420  virtual global_size_t getGlobalLength() const {
421  return this->getBlockedMap()->getFullMap()->getGlobalNumElements();
422  }
423 
425 
427 
428 
430  virtual std::string description() const {
431  return std::string("BlockedVector");
432  }
433 
436  out << description() << std::endl;
437  for(size_t r = 0; r < this->getBlockedMap()->getNumMaps(); r++)
438  getMultiVector(r)->describe(out, verbLevel);
439  }
440 
441  virtual void replaceMap(const RCP<const Map>& map) {
443  }
444 
446  virtual void doImport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node> &source, const Import& importer, CombineMode CM) {
447  throw Xpetra::Exceptions::RuntimeError("BlockedVector::doImport: Not supported by BlockedVector.");
448  }
449 
451  virtual void doExport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node> &dest, const Import& importer, CombineMode CM) {
452  throw Xpetra::Exceptions::RuntimeError("BlockedVector::doExport: Not supported by BlockedVector.");
453  }
454 
456  virtual void doImport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node> &source, const Export& exporter, CombineMode CM) {
457  throw Xpetra::Exceptions::RuntimeError("BlockedVector::doImport: Not supported by BlockedVector.");
458  }
459 
461  virtual void doExport(const DistObject<Scalar, LocalOrdinal, GlobalOrdinal, Node> &dest, const Export& exporter, CombineMode CM) {
462  throw Xpetra::Exceptions::RuntimeError("BlockedVector::doExport: Not supported by BlockedVector.");
463  }
464 
466 
468 
469 
471  virtual void setSeed(unsigned int seed) {
472  for(size_t r = 0; r < this->getBlockedMap()->getNumMaps(); ++r) {
473  getMultiVector(r)->setSeed(seed);
474  }
475  }
476 
477 
478  virtual void randomize(bool bUseXpetraImplementation = false) {
479  for(size_t r = 0; r < this->getBlockedMap()->getNumMaps(); ++r) {
480  getMultiVector(r)->randomize(bUseXpetraImplementation);
481  }
482  }
483 
485  virtual void Xpetra_randomize()
486  {
488  }
489 
490 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
491  typedef typename Kokkos::Details::ArithTraits<Scalar>::val_type impl_scalar_type;
492  typedef Kokkos::DualView<impl_scalar_type**, Kokkos::LayoutStride,
493  typename node_type::execution_space,
494  Kokkos::MemoryUnmanaged> dual_view_type;
495  typedef typename dual_view_type::host_mirror_space host_execution_space;
496  typedef typename dual_view_type::t_dev::execution_space dev_execution_space;
497 
503  template<class TargetDeviceType>
504  typename Kokkos::Impl::if_c<
505  Kokkos::Impl::is_same<
506  typename dev_execution_space::memory_space,
507  typename TargetDeviceType::memory_space>::value,
508  typename dual_view_type::t_dev_um,
509  typename dual_view_type::t_host_um>::type
510  getLocalView () const {
511  if(Kokkos::Impl::is_same<
512  typename host_execution_space::memory_space,
513  typename TargetDeviceType::memory_space
514  >::value) {
515  return getHostLocalView();
516  } else {
517  return getDeviceLocalView();
518  }
519  }
520 
521  virtual typename dual_view_type::t_host_um getHostLocalView () const {
522  typename dual_view_type::t_host_um test;
523  return test;
524  }
525  virtual typename dual_view_type::t_dev_um getDeviceLocalView() const {
526  typename dual_view_type::t_dev_um test;
527  return test;
528  }
529 
530 #endif
531 
533 
535  Teuchos::RCP< const Map> getMap() const { XPETRA_MONITOR("BlockedVector::getMap"); return this->getBlockedMap(); }
536 
540  }
541 
543  Teuchos::RCP<MultiVector> getMultiVector(size_t r, bool bThyraMode) const {
544  return BlockedMultiVector::getMultiVector(r,bThyraMode);
545  }
546 
548  void setMultiVector(size_t r, Teuchos::RCP<const Vector> v, bool bThyraMode) {
549  BlockedMultiVector::setMultiVector(r,v,bThyraMode);
550  return;
551  }
552 
555  return BlockedMultiVector::Merge();
556  }
557 
558 
559  protected:
566  virtual void assign (const MultiVector& rhs) {
568  }
569 
570  //virtual void assign (const MultiVector& rhs) {
571  // throw Xpetra::Exceptions::RuntimeError("BlockedVector::assign: Not supported by BlockedVector.");
572  //}
573 
574  private:
575  //Teuchos::RCP<const BlockedMap> map_; ///< blocked map containing the sub block maps (either thyra or xpetra mode)
576  //std::vector<Teuchos::RCP<Vector> > vv_; ///< array containing RCPs of the partial vectors
577  }; // BlockedVector class
578 
579 } // Xpetra namespace
580 
581 #define XPETRA_BLOCKEDVECTOR_SHORT
582 #endif // XPETRA_BLOCKEDVECTOR_HPP
virtual void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export &exporter, CombineMode CM)
Import (using an Exporter).
virtual void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
virtual void putScalar(const Scalar &value)
Set all values in the vector with the given value.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm2() const
Compute 2-norm of vector.
LocalOrdinal local_ordinal_type
Definition: Xpetra_Map.hpp:85
virtual size_t getLocalLength() const
Local number of rows on the calling process.
virtual void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Teuchos::RCP< const Xpetra::BlockedMap< LocalOrdinal, GlobalOrdinal, Node > > getBlockedMap() const
Access function for the underlying Map this DistObject was constructed with.
virtual void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
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]).
GlobalOrdinal global_ordinal_type
Definition: Xpetra_Map.hpp:86
virtual Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this vector.
virtual void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
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).
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.
void setMultiVector(size_t r, Teuchos::RCP< const Vector > v, bool bThyraMode)
set partial Vector associated with block row r
virtual void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
virtual void sumIntoLocalValue(LocalOrdinal myRow, const Scalar &value)
Add value to existing value, using local (row) index.
Node node_type
Definition: Xpetra_Map.hpp:87
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.
Xpetra namespace
virtual void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export &exporter, CombineMode CM)
Export (using an Importer).
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 reciprocal(const MultiVector &A)
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 &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 describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with the given verbosity level to a FancyOStream.
Teuchos::RCP< MultiVector > getMultiVector(size_t r) const
return partial multivector associated with block row r
virtual void replaceMap(const RCP< const Map > &map)
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 void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
virtual Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
virtual void elementWiseMultiply(Scalar scalarAB, const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Vector &B, Scalar scalarThis)
Element-wise multiply of a Vector A with a Vector B.
virtual void assign(const MultiVector &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
bool is_null() const
virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, const Scalar &value)
Add value to existing value, using global (row) index.
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]).
BlockedVector(Teuchos::RCP< const Xpetra::MapExtractor< Scalar, LocalOrdinal, GlobalOrdinal, Node > > mapExtractor, Teuchos::RCP< Vector > v)
Teuchos::RCP< MultiVector > getMultiVector(size_t r, bool bThyraMode) const
return partial Vector associated with block row r
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.
Teuchos::RCP< MultiVector > Merge() const
merge BlockedVector blocks to a single Vector
virtual void randomize(bool bUseXpetraImplementation=false)
Teuchos::RCP< MultiVector > getMultiVector(size_t r) const
return partial Vector associated with block row r
virtual Scalar dot(const Vector &A) const
Computes dot product of this Vector against input Vector x.
Teuchos::RCP< const Map > getMap() const
Access function for the underlying Map this DistObject was constructed with.
virtual void abs(const MultiVector &A)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
virtual size_t getNumVectors() const
Number of columns in the Vector.
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 void assign(const MultiVector &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
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 scalarAB, const Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector &B, Scalar scalarThis)
Element-wise multiply of a Vector A with a MultiVector B.
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 Scalar meanValue() const
Compute mean (average) value of this Vector.
virtual Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this vector.
void setMultiVector(size_t r, Teuchos::RCP< const MultiVector > v, bool bThyraMode)
set partial multivector associated with block row r
BlockedVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & operator=(const MultiVector &rhs)
Assignment operator: Does a deep copy.
virtual void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import &importer, CombineMode CM)
Import.
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.
Teuchos::RCP< MultiVector > Merge() const
merge BlockedMultiVector blocks to a single MultiVector
static const EVerbosityLevel verbLevel_default
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 global_size_t getGlobalLength() const
Global number of rows in the Vector.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType normInf() const
Compute Inf-norm in vector.
BlockedVector(const Teuchos::RCP< const BlockedMap > &map, bool zeroOut=true)
Constructor.
virtual void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
virtual void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import &importer, CombineMode CM)
Export.
virtual void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
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 void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
virtual void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
virtual void meanValue(const Teuchos::ArrayView< Scalar > &means) const
Compute mean (average) value of each vector in vector. The outcome of this routine is undefined for n...
virtual void multiply(Teuchos::ETransp transA, Teuchos::ETransp transB, const Scalar &alpha, const MultiVector &A, const MultiVector &B, const Scalar &beta)
Matrix-matrix multiplication: this = beta*this + alpha*op(A)*op(B).
virtual void multiply(Teuchos::ETransp transA, Teuchos::ETransp transB, const Scalar &alpha, const Vector &A, const Vector &B, const Scalar &beta)
Matrix-matrix multiplication: this = beta*this + alpha*op(A)*op(B).
CombineMode
Xpetra::Combine Mode enumerable type.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm1() const
Compute 1-norm of vector.
virtual ~BlockedVector()
Destructor.
#define XPETRA_MONITOR(funcName)
virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
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 replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
BlockedVector(Teuchos::RCP< const Xpetra::BlockedMap< LocalOrdinal, GlobalOrdinal, Node > > bmap, Teuchos::RCP< const Vector > v)
virtual void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
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 std::string description() const
A simple one-line description of this object.
virtual void reciprocal(const MultiVector &A)
Put element-wise reciprocal values of input vector in target, this(i,j) = 1/A(i,j).