47#ifndef XPETRA_BLOCKEDMULTIVECTOR_DEF_HPP
48#define XPETRA_BLOCKEDMULTIVECTOR_DEF_HPP
52#include "Xpetra_MultiVectorFactory.hpp"
53#include "Xpetra_BlockedVector.hpp"
54#include "Xpetra_MapExtractor.hpp"
60template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
69 vv_.reserve(map->getNumMaps());
72 for(
size_t r = 0; r < map->getNumMaps(); ++r)
89template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
96 "BlockedMultiVector: inconsistent number of local elements of MultiVector and BlockedMap. The BlockedMap has "
97 << bmap->getMap()->getLocalNumElements() <<
" local elements. The vector has " << v->getMap()->getLocalNumElements()
101 "BlockedMultiVector: inconsistent number of global elements of MultiVector and BlockedMap. The BlockedMap has "
102 << bmap->getMap()->getGlobalNumElements() <<
" local elements. The vector has " << v->getMap()->getGlobalNumElements()
111 numVectors_ = v->getNumVectors();
116 vv_.reserve(bmap->getNumMaps());
119 for(
size_t r = 0; r < bmap->getNumMaps(); ++r)
120 vv_.push_back(this->ExtractVector(v, r, bmap->getThyraMode()));
135template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
140 numVectors_ = v->getNumVectors();
143 std::vector<RCP<const Map>> maps;
144 maps.reserve(mapExtractor->NumMaps());
145 for(
size_t r = 0; r < mapExtractor->NumMaps(); ++r)
146 maps.push_back(mapExtractor->getMap(r, mapExtractor->getThyraMode()));
150 vv_.reserve(mapExtractor->NumMaps());
153 for(
size_t r = 0; r < mapExtractor->NumMaps(); ++r)
154 vv_.push_back(this->ExtractVector(v, r, mapExtractor->getThyraMode()));
158template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
163 numVectors_ = vin[ 0 ]->getNumVectors();
165 vv_.resize(vin.size());
166 for(
size_t i = 0; i < vv_.size(); i++)
171template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
175 for(
size_t r = 0; r < vv_.size(); ++r)
177 vv_[ r ] = Teuchos::null;
180 map_ = Teuchos::null;
185template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
195template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
204template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
212template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
221template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
231template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
237 for(
size_t r = 0; r < map_->getNumMaps(); r++)
239 getMultiVector(r)->putScalar(value);
244template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
252 for(
size_t r = 0; r < getBlockedMap()->getNumMaps(); r++)
255 this->getMultiVector(r, this->getBlockedMap()->getThyraMode())->getVector(j);
256 ret->setMultiVector(r, subvec, this->getBlockedMap()->getThyraMode());
262template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
268 Teuchos::rcp_const_cast<Xpetra::Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>(getVector(j));
273template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
278 if(map_->getNumMaps() == 1)
280 return vv_[ 0 ]->getData(j);
287template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
292 if(map_->getNumMaps() == 1)
294 return vv_[ 0 ]->getDataNonConst(j);
301template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
310template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
319template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
328template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
331scale(
const Scalar& alpha)
334 for(
size_t r = 0; r < map_->getNumMaps(); ++r)
336 if(getMultiVector(r) != Teuchos::null)
338 getMultiVector(r)->scale(alpha);
344template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
350 for(
size_t r = 0; r < map_->getNumMaps(); ++r)
352 if(getMultiVector(r) != Teuchos::null)
354 getMultiVector(r)->scale(alpha);
360template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
370 "BlockedMultiVector::update: update with incompatible vector (different number of vectors in multivector).");
371 if(bA != Teuchos::null)
377 "BlockedMultiVector::update: update with incompatible vector (different thyra mode).");
380 "BlockedMultiVector::update: update with incompatible vector (different number of partial vectors).");
381 for(
size_t r = 0; r < map_->getNumMaps(); r++)
386 "BlockedMultiVector::update: in subvector "
387 << r <<
": Cannot add a vector of (local) length " << bA->getMultiVector(r)->getMap()->getLocalNumElements()
388 <<
" to the existing vector with " << getMultiVector(r)->getMap()->getLocalNumElements() <<
" entries.");
389 XPETRA_TEST_FOR_EXCEPTION(getMultiVector(r)->getMap()->getGlobalNumElements() != bA->getMultiVector(r)->getMap()->getGlobalNumElements(),
391 "BlockedMultiVector::update: in subvector "
392 << r <<
": Cannot add a vector of length " << bA->getMultiVector(r)->getMap()->getGlobalNumElements()
393 <<
" to the existing vector with " << getMultiVector(r)->getMap()->getGlobalNumElements() <<
" entries.");
413 "BlockedMultiVector::update: Standard MultiVector object does not accept BlockedMultVector object as "
414 "parameter in update call.");
415 lmv->update(alpha, *(brmv->getMultiVector(0)), beta);
418 lmv->update(alpha, *rmv, beta);
427 if(getBlockedMap()->getNumMaps() == 1)
432 getMultiVector(0)->getMap()->isSameAs(*(rcpA->getMap())) ==
false,
434 "BlockedMultiVector::update: update with incompatible vector (maps of full vector do not match with map in MapExtractor).");
435 getMultiVector(0)->update(alpha, *rcpA, beta);
443 for(
size_t r = 0; r < map_->getNumMaps(); r++)
450 "BlockedMultiVector::update: in subvector "
451 << r <<
": Cannot add a vector of (local) length " << part->getMap()->getLocalNumElements()
452 <<
" to the existing vector with " << getMultiVector(r)->getMap()->getLocalNumElements() <<
" entries.");
455 "BlockedMultiVector::update: in subvector "
456 << r <<
": Cannot add a vector of length " << part->getMap()->getGlobalNumElements()
457 <<
" to the existing vector with " << getMultiVector(r)->getMap()->getGlobalNumElements() <<
" entries.");
458 getMultiVector(r)->update(alpha, *part, beta);
465template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
475 if(bA != Teuchos::null && bB != Teuchos::null)
479 "BlockedMultiVector::update: update with incompatible vector (different thyra mode in vector A).");
482 "BlockedMultiVector::update: update with incompatible vector (different number of partial vectors in vector A).");
484 numVectors_ != bA->getNumVectors(),
486 "BlockedMultiVector::update: update with incompatible vector (different number of vectors in multivector in vector A).");
489 "BlockedMultiVector::update: update with incompatible vector (different thyra mode in vector B).");
492 "BlockedMultiVector::update: update with incompatible vector (different number of partial vectors in vector B).");
494 numVectors_ != bB->getNumVectors(),
496 "BlockedMultiVector::update: update with incompatible vector (different number of vectors in multivector in vector B).");
498 for(
size_t r = 0; r < map_->getNumMaps(); r++)
502 "BlockedMultiVector::update: update with incompatible vector (different maps in partial vector " << r <<
").");
503 getMultiVector(r)->update(alpha, *(bA->getMultiVector(r)), beta, *(bB->getMultiVector(r)), gamma);
511template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
521 for(
size_t r = 0; r < map_->getNumMaps(); ++r)
523 if(getMultiVector(r) != Teuchos::null)
525 getMultiVector(r)->norm1(temp_norms);
526 for(
size_t c = 0; c < getNumVectors(); ++c)
527 norms[ c ] += temp_norms[ c ];
534template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
546 for(
size_t r = 0; r < map_->getNumMaps(); ++r)
548 if(getMultiVector(r) != Teuchos::null)
550 getMultiVector(r)->norm2(temp_norms);
551 for(
size_t c = 0; c < getNumVectors(); ++c)
552 results[ c ] += temp_norms[ c ] * temp_norms[ c ];
555 for(
size_t c = 0; c < getNumVectors(); ++c)
560template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
570 for(
size_t r = 0; r < map_->getNumMaps(); ++r)
572 if(getMultiVector(r) != Teuchos::null)
574 getMultiVector(r)->normInf(temp_norms);
575 for(
size_t c = 0; c < getNumVectors(); ++c)
576 norms[ c ] = std::max(norms[ c ], temp_norms[ c ]);
582template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
591template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
605template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
616 "BlockedMultiVector::elementWiseMultipy: B must have same blocked map than this.");
621 "BlockedMultiVector::elementWiseMultipy: A has " << A.
getMap()->getLocalNumElements() <<
" elements, B has "
622 << B.
getMap()->getLocalNumElements() <<
".");
625 "BlockedMultiVector::elementWiseMultipy: A has " << A.
getMap()->getGlobalNumElements() <<
" elements, B has "
626 << B.
getMap()->getGlobalNumElements() <<
".");
631 Teuchos::rcp_dynamic_cast<const Xpetra::BlockedVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>(rcpA);
641 for(
size_t m = 0; m < bmap->getNumMaps(); m++)
647 thisPart->elementWiseMultiply(scalarAB, *partA, *partB, scalarThis);
653template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
662template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
668 return map_->getFullMap()->getLocalNumElements();
672template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
678 return map_->getFullMap()->getGlobalNumElements();
682template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
690 for(
size_t r = 0; r < map_->getNumMaps(); ++r)
694 if((a == Teuchos::null && b != Teuchos::null) || (a != Teuchos::null && b == Teuchos::null))
696 if(a != Teuchos::null && b != Teuchos::null && !a->isSameSize(*b))
703template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
708 return std::string(
"BlockedMultiVector");
712template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
717 out << description() << std::endl;
718 for(
size_t r = 0; r < map_->getNumMaps(); r++)
719 getMultiVector(r)->describe(out, verbLevel);
723template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
733 if(this->getBlockedMap()->getNumMaps() > 1)
736 "BlockedMultiVector::replaceMap: map is not of type BlockedMap. General implementation not available, yet.");
741 std::vector<Teuchos::RCP<const Map>> subMaps(1, map);
743 this->getMultiVector(0)->replaceMap(map);
751 for(
size_t r = 0; r < map_->getNumMaps(); r++)
752 getMultiVector(r)->replaceMap(bmap->getMap(r, map_->getThyraMode()));
756template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
767template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
778template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
789template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
800template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
805 for(
size_t r = 0; r < map_->getNumMaps(); ++r)
807 getMultiVector(r)->setSeed(seed);
812template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
817 for(
size_t r = 0; r < map_->getNumMaps(); ++r)
819 getMultiVector(r)->randomize(bUseXpetraImplementation);
824template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
827randomize(
const Scalar& minVal,
const Scalar& maxVal,
bool bUseXpetraImplementation)
829 for(
size_t r = 0; r < map_->getNumMaps(); ++r)
831 getMultiVector(r)->randomize(minVal, maxVal, bUseXpetraImplementation);
836template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
845template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
854template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
864template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
874template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
882 "Error, r = " << r <<
" is too big. The BlockedMultiVector only contains " << map_->getNumMaps()
883 <<
" partial blocks.");
888template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
893 XPETRA_MONITOR(
"BlockedMultiVector::getMultiVector(r,bThyraMode)");
896 "Error, r = " << r <<
" is too big. The BlockedMultiVector only contains " << map_->getNumMaps()
897 <<
" partial blocks.");
905template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
919 "Error, r = " << r <<
" is too big. The BlockedMultiVector only contains " << map_->getNumMaps() <<
" partial blocks.");
922 "The BlockedMultiVectors expects " << getNumVectors() <<
" vectors. The provided partial multivector has "
923 << v->getNumVectors() <<
" vectors.");
933template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
942 for(
size_t r = 0; r < map_->getNumMaps(); ++r)
948 this->InsertVector(vi, r, v, map_->getThyraMode());
953 this->InsertVector(mvi, r, v, map_->getThyraMode());
963template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
970 if(bRhs == Teuchos::null)
974 vv_ = std::vector<Teuchos::RCP<MultiVector>>(map_->getNumMaps());
975 for(
size_t r = 0; r < map_->getNumMaps(); ++r)
982 map_->getMap(r, bRhs->getBlockedMap()->getThyraMode()), rcpRhs->getNumVectors(),
true);
1000 if(bsrc->getBlockedMap()->getNumMaps() > 1)
1003 "1 blocks) and target is a MultiVector.");
1010 "BlockedMultiVector::assign: sub block must not be of type BlockedMultiVector.");
1018 "BlockedMultiVector::assign: source and target are BlockedMultiVectors with a different number of submaps.");
1023 numVectors_ = rcpRhs->getNumVectors();
1027template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1034 ExtractVector(*full, block, *partial);
1038template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1045 ExtractVector(*full, block, *partial);
1049template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1054 bool bThyraMode)
const
1058 "ExtractVector: Error, block = " << block <<
" is too big. The MapExtractor only contains " << map_->getNumMaps()
1059 <<
" partial blocks.");
1074 RCP<MultiVector> rcpNonConstFull = Teuchos::rcp_const_cast<MultiVector>(full);
1075 rcpNonConstFull->replaceMap(map_->getImporter(block)->getSourceMap());
1076 ExtractVector(*rcpNonConstFull, block, *vv);
1079 "MapExtractor::ExtractVector: ExtractVector in Thyra-style numbering only possible if MapExtractor has been "
1080 "created using Thyra-style numbered submaps.");
1081 if(bThyraMode ==
true)
1082 vv->replaceMap(map_->getMap(block,
true));
1083 rcpNonConstFull->replaceMap(oldThyMapFull);
1092 "ExtractVector: Number of blocks in map extractor is " << map_->getNumMaps() <<
" but should be "
1093 << bfull->getBlockedMap()->getNumMaps()
1094 <<
" (number of blocks in BlockedMultiVector)");
1095 return bfull->getMultiVector(block, bThyraMode);
1100template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1105 bool bThyraMode)
const
1109 "ExtractVector: Error, block = " << block <<
" is too big. The MapExtractor only contains " << map_->getNumMaps()
1110 <<
" partial blocks.");
1125 full->replaceMap(map_->getImporter(block)->getSourceMap());
1126 ExtractVector(*full, block, *vv);
1129 "MapExtractor::ExtractVector: ExtractVector in Thyra-style numbering only possible if MapExtractor has been "
1130 "created using Thyra-style numbered submaps.");
1131 if(bThyraMode ==
true)
1132 vv->replaceMap(map_->getMap(block,
true));
1133 full->replaceMap(oldThyMapFull);
1142 "ExtractVector: Number of blocks in map extractor is " << map_->getNumMaps() <<
" but should be "
1143 << bfull->getBlockedMap()->getNumMaps()
1144 <<
" (number of blocks in BlockedMultiVector)");
1145 return bfull->getMultiVector(block, bThyraMode);
1150template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1159 "ExtractVector: Error, block = " << block <<
" is too big. The BlockedMultiVector only contains " << map_->getNumMaps()
1160 <<
" partial blocks.");
1166template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1172 bool bThyraMode)
const
1176 "ExtractVector: Error, block = " << block <<
" is too big. The MapExtractor only contains " << map_->getNumMaps()
1177 <<
" partial blocks.");
1182 "MapExtractor::InsertVector: InsertVector in Thyra-style numbering only possible if MapExtractor has been created "
1183 "using Thyra-style numbered submaps.");
1194 RCP<MultiVector> rcpNonConstPartial = Teuchos::rcp_const_cast<MultiVector>(rcpPartial);
1209 rcpNonConstPartial->replaceMap(map_->getMap(block,
false));
1210 full.
replaceMap(map_->getImporter(block)->getSourceMap());
1217 rcpNonConstPartial->replaceMap(oldThyMapPartial);
1227template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1233 bool bThyraMode)
const
1236 Teuchos::rcp_dynamic_cast<Xpetra::BlockedMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>(full);
1238 InsertVector(*partial, block, *full, bThyraMode);
1246 full->setMultiVector(block, partial, bThyraMode);
1254template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1260 bool bThyraMode)
const
1263 Teuchos::rcp_dynamic_cast<Xpetra::BlockedMultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>>(full);
1265 InsertVector(*partial, block, *full, bThyraMode);
1269 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.