10#ifndef XPETRA_BLOCKEDMULTIVECTOR_DEF_HPP
11#define XPETRA_BLOCKEDMULTIVECTOR_DEF_HPP
15#include "Xpetra_MultiVectorFactory.hpp"
16#include "Xpetra_BlockedVector.hpp"
17#include "Xpetra_MapExtractor.hpp"
21template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
29 vv_.reserve(map->getNumMaps());
32 for (
size_t r = 0; r < map->getNumMaps(); ++r)
48template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
54 "BlockedMultiVector: inconsistent number of local elements of MultiVector and BlockedMap. The BlockedMap has "
55 << bmap->getMap()->getLocalNumElements() <<
" local elements. The vector has " << v->getMap()->getLocalNumElements()
59 "BlockedMultiVector: inconsistent number of global elements of MultiVector and BlockedMap. The BlockedMap has "
60 << bmap->getMap()->getGlobalNumElements() <<
" local elements. The vector has " << v->getMap()->getGlobalNumElements()
69 numVectors_ = v->getNumVectors();
74 vv_.reserve(bmap->getNumMaps());
77 for (
size_t r = 0; r < bmap->getNumMaps(); ++r)
78 vv_.push_back(this->ExtractVector(v, r, bmap->getThyraMode()));
92template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
96 numVectors_ = v->getNumVectors();
99 std::vector<RCP<const Map>> maps;
100 maps.reserve(mapExtractor->NumMaps());
101 for (
size_t r = 0; r < mapExtractor->NumMaps(); ++r)
102 maps.push_back(mapExtractor->getMap(r, mapExtractor->getThyraMode()));
106 vv_.reserve(mapExtractor->NumMaps());
109 for (
size_t r = 0; r < mapExtractor->NumMaps(); ++r)
110 vv_.push_back(this->ExtractVector(v, r, mapExtractor->getThyraMode()));
113template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
117 numVectors_ = vin[0]->getNumVectors();
119 vv_.resize(vin.size());
120 for (
size_t i = 0; i < vv_.size(); i++)
124template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
127 for (
size_t r = 0; r < vv_.size(); ++r) {
128 vv_[r] = Teuchos::null;
131 map_ = Teuchos::null;
135template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
143template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
149template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
155template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
161template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
167template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
171 for (
size_t r = 0; r < map_->getNumMaps(); r++) {
172 getMultiVector(r)->putScalar(value);
176template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
183 for (
size_t r = 0; r < getBlockedMap()->getNumMaps(); r++) {
185 this->getMultiVector(r, this->getBlockedMap()->getThyraMode())->getVector(j);
186 ret->setMultiVector(r, subvec, this->getBlockedMap()->getThyraMode());
191template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
196 Teuchos::rcp_const_cast<Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>(getVector(j));
200template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
204 if (map_->getNumMaps() == 1) {
205 return vv_[0]->getData(j);
211template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
215 if (map_->getNumMaps() == 1) {
216 return vv_[0]->getDataNonConst(j);
222template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
228template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
234template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
240template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
244 for (
size_t r = 0; r < map_->getNumMaps(); ++r) {
245 if (getMultiVector(r) != Teuchos::null) {
246 getMultiVector(r)->scale(alpha);
251template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
255 for (
size_t r = 0; r < map_->getNumMaps(); ++r) {
256 if (getMultiVector(r) != Teuchos::null) {
257 getMultiVector(r)->scale(alpha);
262template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
270 "BlockedMultiVector::update: update with incompatible vector (different number of vectors in multivector).");
271 if (bA != Teuchos::null) {
276 "BlockedMultiVector::update: update with incompatible vector (different thyra mode).");
279 "BlockedMultiVector::update: update with incompatible vector (different number of partial vectors).");
280 for (
size_t r = 0; r < map_->getNumMaps(); r++) {
281 XPETRA_TEST_FOR_EXCEPTION(getMultiVector(r)->getMap()->getLocalNumElements() != bA->getMultiVector(r)->getMap()->getLocalNumElements(),
283 "BlockedMultiVector::update: in subvector "
284 << r <<
": Cannot add a vector of (local) length " << bA->getMultiVector(r)->getMap()->getLocalNumElements()
285 <<
" to the existing vector with " << getMultiVector(r)->getMap()->getLocalNumElements() <<
" entries.");
286 XPETRA_TEST_FOR_EXCEPTION(getMultiVector(r)->getMap()->getGlobalNumElements() != bA->getMultiVector(r)->getMap()->getGlobalNumElements(),
288 "BlockedMultiVector::update: in subvector "
289 << r <<
": Cannot add a vector of length " << bA->getMultiVector(r)->getMap()->getGlobalNumElements()
290 <<
" to the existing vector with " << getMultiVector(r)->getMap()->getGlobalNumElements() <<
" entries.");
309 "BlockedMultiVector::update: Standard MultiVector object does not accept BlockedMultVector object as "
310 "parameter in update call.");
311 lmv->update(alpha, *(brmv->getMultiVector(0)), beta);
313 lmv->update(alpha, *rmv, beta);
320 if (getBlockedMap()->getNumMaps() == 1) {
324 getMultiVector(0)->getMap()->isSameAs(*(rcpA->getMap())) ==
false,
326 "BlockedMultiVector::update: update with incompatible vector (maps of full vector do not match with map in MapExtractor).");
327 getMultiVector(0)->update(alpha, *rcpA, beta);
333 for (
size_t r = 0; r < map_->getNumMaps(); r++) {
339 "BlockedMultiVector::update: in subvector "
340 << r <<
": Cannot add a vector of (local) length " << part->getMap()->getLocalNumElements()
341 <<
" to the existing vector with " << getMultiVector(r)->getMap()->getLocalNumElements() <<
" entries.");
344 "BlockedMultiVector::update: in subvector "
345 << r <<
": Cannot add a vector of length " << part->getMap()->getGlobalNumElements()
346 <<
" to the existing vector with " << getMultiVector(r)->getMap()->getGlobalNumElements() <<
" entries.");
347 getMultiVector(r)->update(alpha, *part, beta);
353template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
361 if (bA != Teuchos::null && bB != Teuchos::null) {
364 "BlockedMultiVector::update: update with incompatible vector (different thyra mode in vector A).");
367 "BlockedMultiVector::update: update with incompatible vector (different number of partial vectors in vector A).");
369 numVectors_ != bA->getNumVectors(),
371 "BlockedMultiVector::update: update with incompatible vector (different number of vectors in multivector in vector A).");
374 "BlockedMultiVector::update: update with incompatible vector (different thyra mode in vector B).");
377 "BlockedMultiVector::update: update with incompatible vector (different number of partial vectors in vector B).");
379 numVectors_ != bB->getNumVectors(),
381 "BlockedMultiVector::update: update with incompatible vector (different number of vectors in multivector in vector B).");
383 for (
size_t r = 0; r < map_->getNumMaps(); r++) {
386 "BlockedMultiVector::update: update with incompatible vector (different maps in partial vector " << r <<
").");
387 getMultiVector(r)->update(alpha, *(bA->getMultiVector(r)), beta, *(bB->getMultiVector(r)), gamma);
394template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
402 for (
size_t r = 0; r < map_->getNumMaps(); ++r) {
403 if (getMultiVector(r) != Teuchos::null) {
404 getMultiVector(r)->norm1(temp_norms);
405 for (
size_t c = 0; c < getNumVectors(); ++c)
406 norms[c] += temp_norms[c];
411template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
421 for (
size_t r = 0; r < map_->getNumMaps(); ++r) {
422 if (getMultiVector(r) != Teuchos::null) {
423 getMultiVector(r)->norm2(temp_norms);
424 for (
size_t c = 0; c < getNumVectors(); ++c)
425 results[c] += temp_norms[c] * temp_norms[c];
428 for (
size_t c = 0; c < getNumVectors(); ++c)
432template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
440 for (
size_t r = 0; r < map_->getNumMaps(); ++r) {
441 if (getMultiVector(r) != Teuchos::null) {
442 getMultiVector(r)->normInf(temp_norms);
443 for (
size_t c = 0; c < getNumVectors(); ++c)
444 norms[c] = std::max(norms[c], temp_norms[c]);
449template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
455template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
466template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
475 "BlockedMultiVector::elementWiseMultipy: B must have same blocked map than this.");
480 "BlockedMultiVector::elementWiseMultipy: A has " << A.
getMap()->getLocalNumElements() <<
" elements, B has "
481 << B.
getMap()->getLocalNumElements() <<
".");
484 "BlockedMultiVector::elementWiseMultipy: A has " << A.
getMap()->getGlobalNumElements() <<
" elements, B has "
485 << B.
getMap()->getGlobalNumElements() <<
".");
490 Teuchos::rcp_dynamic_cast<const Xpetra::BlockedVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>(rcpA);
500 for (
size_t m = 0; m < bmap->getNumMaps(); m++) {
505 thisPart->elementWiseMultiply(scalarAB, *partA, *partB, scalarThis);
509template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
516template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
521 return map_->getFullMap()->getLocalNumElements();
524template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
529 return map_->getFullMap()->getGlobalNumElements();
532template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
538 for (
size_t r = 0; r < map_->getNumMaps(); ++r) {
541 if ((a == Teuchos::null && b != Teuchos::null) || (a != Teuchos::null && b == Teuchos::null))
543 if (a != Teuchos::null && b != Teuchos::null && !a->isSameSize(*b))
549template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
553 return std::string(
"BlockedMultiVector");
556template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
559 out << description() << std::endl;
560 for (
size_t r = 0; r < map_->getNumMaps(); r++)
561 getMultiVector(r)->describe(out, verbLevel);
564template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
571 if (this->getBlockedMap()->getNumMaps() > 1) {
573 "BlockedMultiVector::replaceMap: map is not of type BlockedMap. General implementation not available, yet.");
578 std::vector<Teuchos::RCP<const Map>> subMaps(1, map);
580 this->getMultiVector(0)->replaceMap(map);
588 for (
size_t r = 0; r < map_->getNumMaps(); r++)
589 getMultiVector(r)->replaceMap(bmap->getMap(r, map_->getThyraMode()));
592template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
600template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
608template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
616template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
624template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
627 for (
size_t r = 0; r < map_->getNumMaps(); ++r) {
628 getMultiVector(r)->setSeed(seed);
632template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
634 randomize(
bool bUseXpetraImplementation) {
635 for (
size_t r = 0; r < map_->getNumMaps(); ++r) {
636 getMultiVector(r)->randomize(bUseXpetraImplementation);
640template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
642 randomize(
const Scalar& minVal,
const Scalar& maxVal,
bool bUseXpetraImplementation) {
643 for (
size_t r = 0; r < map_->getNumMaps(); ++r) {
644 getMultiVector(r)->randomize(minVal, maxVal, bUseXpetraImplementation);
648template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
654template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
660template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
668template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
676template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
683 "Error, r = " << r <<
" is too big. The BlockedMultiVector only contains " << map_->getNumMaps()
684 <<
" partial blocks.");
688template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
692 XPETRA_MONITOR(
"BlockedMultiVector::getMultiVector(r,bThyraMode)");
695 "Error, r = " << r <<
" is too big. The BlockedMultiVector only contains " << map_->getNumMaps()
696 <<
" partial blocks.");
703template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
715 "Error, r = " << r <<
" is too big. The BlockedMultiVector only contains " << map_->getNumMaps() <<
" partial blocks.");
718 "The BlockedMultiVectors expects " << getNumVectors() <<
" vectors. The provided partial multivector has "
719 << v->getNumVectors() <<
" vectors.");
728template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
736 for (
size_t r = 0; r < map_->getNumMaps(); ++r) {
740 this->InsertVector(vi, r, v, map_->getThyraMode());
743 this->InsertVector(mvi, r, v, map_->getThyraMode());
752template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
757 if (bRhs == Teuchos::null)
761 vv_ = std::vector<Teuchos::RCP<MultiVector>>(map_->getNumMaps());
762 for (
size_t r = 0; r < map_->getNumMaps(); ++r) {
768 map_->getMap(r, bRhs->getBlockedMap()->getThyraMode()), rcpRhs->getNumVectors(),
true);
781 if (bsrc->getBlockedMap()->getNumMaps() > 1) {
783 "BlockedMultiVector::assign: source vector is of type BlockedMultiVector (with more than "
784 "1 blocks) and target is a MultiVector.");
791 "BlockedMultiVector::assign: sub block must not be of type BlockedMultiVector.");
797 "BlockedMultiVector::assign: source and target are BlockedMultiVectors with a different number of submaps.");
802 numVectors_ = rcpRhs->getNumVectors();
805template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
810 ExtractVector(*full, block, *partial);
813template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
818 ExtractVector(*full, block, *partial);
821template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
826 bool bThyraMode)
const {
829 "ExtractVector: Error, block = " << block <<
" is too big. The MapExtractor only contains " << map_->getNumMaps()
830 <<
" partial blocks.");
844 RCP<MultiVector> rcpNonConstFull = Teuchos::rcp_const_cast<MultiVector>(full);
845 rcpNonConstFull->replaceMap(map_->getImporter(block)->getSourceMap());
846 ExtractVector(*rcpNonConstFull, block, *vv);
849 "MapExtractor::ExtractVector: ExtractVector in Thyra-style numbering only possible if MapExtractor has been "
850 "created using Thyra-style numbered submaps.");
851 if (bThyraMode ==
true)
852 vv->replaceMap(map_->getMap(block,
true));
853 rcpNonConstFull->replaceMap(oldThyMapFull);
860 "ExtractVector: Number of blocks in map extractor is " << map_->getNumMaps() <<
" but should be "
861 << bfull->getBlockedMap()->getNumMaps()
862 <<
" (number of blocks in BlockedMultiVector)");
863 return bfull->getMultiVector(block, bThyraMode);
867template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
872 bool bThyraMode)
const {
875 "ExtractVector: Error, block = " << block <<
" is too big. The MapExtractor only contains " << map_->getNumMaps()
876 <<
" partial blocks.");
890 full->replaceMap(map_->getImporter(block)->getSourceMap());
891 ExtractVector(*full, block, *vv);
894 "MapExtractor::ExtractVector: ExtractVector in Thyra-style numbering only possible if MapExtractor has been "
895 "created using Thyra-style numbered submaps.");
896 if (bThyraMode ==
true)
897 vv->replaceMap(map_->getMap(block,
true));
898 full->replaceMap(oldThyMapFull);
905 "ExtractVector: Number of blocks in map extractor is " << map_->getNumMaps() <<
" but should be "
906 << bfull->getBlockedMap()->getNumMaps()
907 <<
" (number of blocks in BlockedMultiVector)");
908 return bfull->getMultiVector(block, bThyraMode);
912template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
919 "ExtractVector: Error, block = " << block <<
" is too big. The BlockedMultiVector only contains " << map_->getNumMaps()
920 <<
" partial blocks.");
925template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
930 bool bThyraMode)
const {
933 "ExtractVector: Error, block = " << block <<
" is too big. The MapExtractor only contains " << map_->getNumMaps()
934 <<
" partial blocks.");
939 "MapExtractor::InsertVector: InsertVector in Thyra-style numbering only possible if MapExtractor has been created "
940 "using Thyra-style numbered submaps.");
950 RCP<MultiVector> rcpNonConstPartial = Teuchos::rcp_const_cast<MultiVector>(rcpPartial);
965 rcpNonConstPartial->replaceMap(map_->getMap(block,
false));
966 full.
replaceMap(map_->getImporter(block)->getSourceMap());
973 rcpNonConstPartial->replaceMap(oldThyMapPartial);
980template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
985 bool bThyraMode)
const {
987 Teuchos::rcp_dynamic_cast<Xpetra::BlockedMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>(full);
989 InsertVector(*partial, block, *full, bThyraMode);
996 full->setMultiVector(block, partial, bThyraMode);
1003template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1008 bool bThyraMode)
const {
1010 Teuchos::rcp_dynamic_cast<Xpetra::BlockedMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>(full);
1012 InsertVector(*partial, block, *full, bThyraMode);
1015 bfull->setMultiVector(block, partial, bThyraMode);
#define XPETRA_MONITOR(funcName)
#define XPETRA_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual void meanValue(const Teuchos::ArrayView< Scalar > &) const
Compute mean (average) value of each vector in multi-vector. The outcome of this routine is undefined...
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.
Teuchos::RCP< const BlockedMap > map_
blocked map containing the sub block maps (either thyra or xpetra mode)
virtual void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
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 sumIntoLocalValue(LocalOrdinal, size_t, const Scalar &)
Add value to existing value, using local (row) index.
Teuchos::RCP< const Map > getMap() const
Access function for the underlying Map this DistObject was constructed with.
virtual Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
BlockedMultiVector(const Teuchos::RCP< const BlockedMap > &map, size_t NumVectors, bool zeroOut=true)
Constructor.
Teuchos::RCP< MultiVector > getMultiVector(size_t r) const
return partial multivector associated with block row r
void setMultiVector(size_t r, Teuchos::RCP< const MultiVector > v, bool bThyraMode)
set partial multivector associated with block row r
virtual global_size_t getGlobalLength() const
Global number of rows in the multivector.
virtual void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Import &, CombineMode)
Import.
virtual ~BlockedMultiVector()
Destructor.
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 Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
virtual size_t getNumVectors() const
Number of columns in the multivector.
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]).
virtual void reciprocal(const MultiVector &)
Put element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,...
virtual void sumIntoGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Add value to existing value, using global (row) index.
virtual void replaceLocalValue(LocalOrdinal, size_t, const Scalar &)
Replace value, using local (row) index.
virtual bool isSameSize(const Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Local number of rows on the calling process.
Teuchos::RCP< MultiVector > Merge() const
merge BlockedMultiVector blocks to a single MultiVector
virtual Teuchos::RCP< Xpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
void ExtractVector(RCP< const MultiVector > &full, size_t block, RCP< MultiVector > &partial) const
void InsertVector(const MultiVector &partial, size_t block, MultiVector &full, bool bThyraMode=false) const
virtual void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
virtual void replaceGlobalValue(GlobalOrdinal, size_t, const Scalar &)
Replace value, using global (row) index.
virtual void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
virtual void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &, const Import &, CombineMode)
Export.
virtual void setSeed(unsigned int seed)
Set seed for Random function.
size_t numVectors_
number of vectors (columns in multi vector)
virtual void assign(const MultiVector &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
virtual std::string description() const
A simple one-line description of this object.
virtual void scale(const Scalar &alpha)
Scale the current values of a multi-vector, this = alpha*this.
virtual void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
Teuchos::RCP< const Xpetra::BlockedMap< LocalOrdinal, GlobalOrdinal, Node > > getBlockedMap() const
Access function for the underlying Map this DistObject was constructed with.
std::vector< Teuchos::RCP< MultiVector > > vv_
array containing RCPs of the partial vectors
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 Xpetra_randomize()
Set multi-vector values to random numbers. XPetra implementation.
virtual void abs(const MultiVector &)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
virtual void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
BlockedMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > & operator=(const MultiVector &rhs)
Assignment operator: Does a deep copy.
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 size_t getLocalLength() const
Local number of rows on the calling process.
virtual void replaceMap(const RCP< const Map > &map)
virtual void doExport(const DistObject< Packet, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)=0
Export data into this object using an Export object ("forward mode").
virtual Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const =0
The Map describing the parallel distribution of this object.
virtual void doImport(const DistObject< Packet, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)=0
Import data into this object using an Import object ("forward mode").
Exception throws to report errors in the internal logical of the program.
Factory for any type of Xpetra::MultiVector and its derived classes.
static Teuchos::RCP< MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > Build(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Constructor specifying the number of non-zeros for all rows.
virtual void replaceMap(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)=0
virtual void Xpetra_randomize()
Set multi-vector values to random numbers. XPetra implementation.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
size_t global_size_t
Global size_t object.
CombineMode
Xpetra::Combine Mode enumerable type.