46#ifndef XPETRA_TPETRAMULTIVECTOR_DEF_HPP
47#define XPETRA_TPETRAMULTIVECTOR_DEF_HPP
50#include "Xpetra_TpetraMap.hpp"
52#include "Xpetra_TpetraImport.hpp"
53#include "Xpetra_TpetraExport.hpp"
56#include "Tpetra_MultiVector.hpp"
57#include "Tpetra_Vector.hpp"
63 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
65 : vec_(
Teuchos::rcp(new Tpetra::
MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >(
toTpetra(map), NumVectors, zeroOut))) {
67 TEUCHOS_TEST_FOR_EXCEPTION(NumVectors < 1, std::invalid_argument,
"Xpetra::TpetraMultiVector(map,numVecs,zeroOut): numVecs = " << NumVectors <<
" < 1.");
71 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
77 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
80 : vec_(
Teuchos::rcp(new Tpetra::
MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >(
toTpetra(map), A, LDA, NumVectors))) {
82 TEUCHOS_TEST_FOR_EXCEPTION(NumVectors < 1, std::invalid_argument,
"Xpetra::TpetraMultiVector(map,A,LDA,numVecs): numVecs = " << NumVectors <<
" < 1.");
86 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
89 : vec_(
Teuchos::rcp(new Tpetra::
MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >(
toTpetra(map), ArrayOfPtrs, NumVectors))) {
91 TEUCHOS_TEST_FOR_EXCEPTION(NumVectors < 1, std::invalid_argument,
"Xpetra::TpetraMultiVector(map,ArrayOfPtrs,numVecs): numVecs = " << NumVectors <<
" < 1.");
96 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
101 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
103 replaceGlobalValue(GlobalOrdinal globalRow,
size_t vectorIndex,
const Scalar &value) {
XPETRA_MONITOR(
"TpetraMultiVector::replaceGlobalValue"); vec_->replaceGlobalValue(globalRow, vectorIndex, value); }
106 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
108 sumIntoGlobalValue(GlobalOrdinal globalRow,
size_t vectorIndex,
const Scalar &value) {
XPETRA_MONITOR(
"TpetraMultiVector::sumIntoGlobalValue"); vec_->sumIntoGlobalValue(globalRow, vectorIndex, value); }
111 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
113 replaceLocalValue(LocalOrdinal myRow,
size_t vectorIndex,
const Scalar &value) {
XPETRA_MONITOR(
"TpetraMultiVector::replaceLocalValue"); vec_->replaceLocalValue(myRow, vectorIndex, value); }
116 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
118 sumIntoLocalValue(LocalOrdinal myRow,
size_t vectorIndex,
const Scalar &value) {
XPETRA_MONITOR(
"TpetraMultiVector::sumIntoLocalValue"); vec_->sumIntoLocalValue(myRow, vectorIndex, value); }
121 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
126 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
131 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
137 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
143 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
149 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
155 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
161 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
167 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
173 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
179 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
185 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
191 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
196 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
201 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
206 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
211 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
216 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
221 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
226 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
228 update(
const Scalar &alpha,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A,
const Scalar &beta,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B,
const Scalar &gamma) {
XPETRA_MONITOR(
"TpetraMultiVector::update"); vec_->update(alpha,
toTpetra(A), beta,
toTpetra(B), gamma); }
231 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
236 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
241 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
246 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
251 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
253 multiply(
Teuchos::ETransp transA,
Teuchos::ETransp transB,
const Scalar &alpha,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B,
const Scalar &beta) {
XPETRA_MONITOR(
"TpetraMultiVector::multiply"); vec_->multiply(transA, transB, alpha,
toTpetra(A),
toTpetra(B), beta); }
257 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
262 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
267 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
272 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
277 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
282 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
287 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
289 randomize(
bool bUseXpetraImplementation) {
292 if(bUseXpetraImplementation)
299 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
301 randomize(
const Scalar& minVal,
const Scalar& maxVal,
bool bUseXpetraImplementation) {
304 if(bUseXpetraImplementation)
307 vec_->randomize(minVal, maxVal);
310 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
315 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
322 this->getTpetra_MultiVector()->doImport(*v,
toTpetra(importer),
toTpetra(CM));
325 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
332 this->getTpetra_MultiVector()->beginImport(*v,
toTpetra(importer),
toTpetra(CM));
335 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
342 this->getTpetra_MultiVector()->endImport(*v,
toTpetra(importer),
toTpetra(CM));
346 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
353 this->getTpetra_MultiVector()->doExport(*v,
toTpetra(importer),
toTpetra(CM));
357 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
364 this->getTpetra_MultiVector()->beginExport(*v,
toTpetra(importer),
toTpetra(CM));
368 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
375 this->getTpetra_MultiVector()->endExport(*v,
toTpetra(importer),
toTpetra(CM));
379 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
386 this->getTpetra_MultiVector()->doImport(*v,
toTpetra(exporter),
toTpetra(CM));
390 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
397 this->getTpetra_MultiVector()->beginImport(*v,
toTpetra(exporter),
toTpetra(CM));
402 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
409 this->getTpetra_MultiVector()->endImport(*v,
toTpetra(exporter),
toTpetra(CM));
413 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
420 this->getTpetra_MultiVector()->doExport(*v,
toTpetra(exporter),
toTpetra(CM));
424 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
431 this->getTpetra_MultiVector()->beginExport(*v,
toTpetra(exporter),
toTpetra(CM));
435 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
442 this->getTpetra_MultiVector()->endExport(*v,
toTpetra(exporter),
toTpetra(CM));
446 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
450 this->getTpetra_MultiVector()->replaceMap(
toTpetra(map));
454 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
459 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
465 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
470 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
474 return subview(vec_->getLocalViewHost(Tpetra::Access::ReadOnly),Kokkos::ALL(), Kokkos::ALL());
478 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
482 return subview(vec_->getLocalViewDevice(Tpetra::Access::ReadOnly),Kokkos::ALL(), Kokkos::ALL());
485 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
489 return subview(vec_->getLocalViewHost(Tpetra::Access::OverwriteAll),Kokkos::ALL(), Kokkos::ALL());
493 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
497 return subview(vec_->getLocalViewDevice(Tpetra::Access::OverwriteAll),Kokkos::ALL(), Kokkos::ALL());
500 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
504 return subview(vec_->getLocalViewHost(Tpetra::Access::ReadWrite),Kokkos::ALL(), Kokkos::ALL());
508 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
512 return subview(vec_->getLocalViewDevice(Tpetra::Access::ReadWrite),Kokkos::ALL(), Kokkos::ALL());
517 template<
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
522 const this_type* rhsPtr =
dynamic_cast<const this_type*
> (&rhs);
524 rhsPtr == NULL, std::invalid_argument,
"Xpetra::MultiVector::operator=:"
525 " The left-hand side (LHS) of the assignment has a different type than "
526 "the right-hand side (RHS). The LHS has type Xpetra::TpetraMultiVector"
527 " (which means it wraps a Tpetra::MultiVector), but the RHS has some "
528 "other type. This probably means that the RHS wraps an "
529 "Epetra_MultiVector. Xpetra::MultiVector does not currently implement "
530 "assignment from an Epetra object to a Tpetra object, though this could"
531 " be added with sufficient interest.");
533 typedef Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> TMV;
535 RCP<TMV> lhsImpl = this->getTpetra_MultiVector ();
538 rhsImpl.
is_null (), std::logic_error,
"Xpetra::MultiVector::operator= "
539 "(in Xpetra::TpetraMultiVector::assign): *this (the right-hand side of "
540 "the assignment) has a null RCP<Tpetra::MultiVector> inside. Please "
541 "report this bug to the Xpetra developers.");
543 lhsImpl.
is_null (), std::logic_error,
"Xpetra::MultiVector::operator= "
544 "(in Xpetra::TpetraMultiVector::assign): The left-hand side of the "
545 "assignment has a null RCP<Tpetra::MultiVector> inside. Please report "
546 "this bug to the Xpetra developers.");
548 Tpetra::deep_copy (*lhsImpl, *rhsImpl);
552#ifdef HAVE_XPETRA_EPETRA
554#if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
555 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
558 template <
class Scalar>
560 :
public virtual MultiVector< Scalar, int, int, EpetraNode >
688 void update(
const Scalar &alpha,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A,
const Scalar &beta,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B,
const Scalar &gamma) { }
703 void multiply(
Teuchos::ETransp transA,
Teuchos::ETransp transB,
const Scalar &alpha,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B,
const Scalar &beta) { }
739 void randomize(
bool bUseXpetraImplementation =
false) { }
742 void randomize(
const Scalar& minVal,
const Scalar& maxVal,
bool bUseXpetraImplementation =
false) { }
802#if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
803 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
806 template <
class Scalar>
808 :
public virtual MultiVector< Scalar, int, long long, EpetraNode >
931 void update(
const Scalar &alpha,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A,
const Scalar &beta,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B,
const Scalar &gamma) { }
946 void multiply(
Teuchos::ETransp transA,
Teuchos::ETransp transB,
const Scalar &alpha,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B,
const Scalar &beta) { }
982 void randomize(
bool bUseXpetraImplementation =
false) { }
985 void randomize(
const Scalar& minVal,
const Scalar& maxVal,
bool bUseXpetraImplementation =
false) { }
1054#include "Xpetra_TpetraVector.hpp"
1058 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1071 XPETRA_DYNAMIC_CAST(
const tpv, A, tA,
"Xpetra::TpetraMultiVectorMatrix->multiply() only accept Xpetra::TpetraMultiVector as input arguments.");
1073 vec_->elementWiseMultiply(scalarAB, *tA.getTpetra_Vector(), *tB.getTpetra_MultiVector(), scalarThis);
1078#define XPETRA_TPETRAMULTIVECTOR_SHORT
#define XPETRA_MONITOR(funcName)
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
#define XPETRA_TPETRA_ETI_EXCEPTION(cl, obj, go, node)
static const EVerbosityLevel verbLevel_default
virtual void Xpetra_randomize()
Set multi-vector values to random numbers. XPetra implementation.
void replaceMap(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
void endExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void beginImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void endImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void elementWiseMultiply(Scalar scalarAB, const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarThis)
Element-wise multiply of a Vector A with a TpetraMultiVector B.
Teuchos::ArrayRCP< Teuchos::ArrayRCP< const Scalar > > get2dView() const
Return const persisting pointers to values.
Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
TpetraMultiVector(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Teuchos::DataAccess copyOrView)
Copy constructor (performs a deep copy).
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &ArrayOfPtrs, size_t NumVectors)
Create multivector by copying array of views of local data.
TpetraMultiVector(const Teuchos::RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &vec)
TpetraMultiVector constructor to wrap a Tpetra::MultiVector object.
void beginExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
void scale(Teuchos::ArrayView< const Scalar > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
global_size_t getGlobalLength() const
Global number of rows in the multivector.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
void reduce()
Sum values of a locally replicated multivector across all processes.
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void endImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
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.
TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraMultiVectorClass
void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
void scale(const Scalar &alpha)
Scale the current values of a multi-vector, this = alpha*this.
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Basic constuctor.
void dot(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< Scalar > &dots) const
Compute dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i]).
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
virtual ~TpetraMultiVector()
Destructor (virtual for memory safety of derived classes).
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_MultiVector() const
Get the underlying Tpetra multivector.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
void multiply(Teuchos::ETransp transA, Teuchos::ETransp transB, const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Scalar &beta)
Matrix-matrix multiplication: this = beta*this + alpha*op(A)*op(B).
Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
Teuchos::ArrayRCP< const Scalar > get1dView() const
Const persisting (1-D) view of this multivector's local values.
void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
size_t getLocalLength() const
Local number of rows on the calling process.
void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
void beginExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
void setSeed(unsigned int seed)
Set seed for Random function.
std::string description() const
A simple one-line description of this object.
void scale(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Replace multi-vector values with scaled values of A, this = alpha*A.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Scalar &gamma)
Update multi-vector with scaled values of A and B, this = gamma*this + alpha*A + beta*B.
void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
TpetraMultiVector()
Default constructor.
Teuchos::ArrayRCP< Scalar > get1dViewNonConst()
Nonconst persisting (1-D) view of this multivector's local values.
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
void meanValue(const Teuchos::ArrayView< Scalar > &means) const
Compute mean (average) value of each vector in multi-vector. The outcome of this routine is undefined...
size_t getNumVectors() const
Number of columns in the multivector.
void get1dCopy(Teuchos::ArrayView< Scalar > A, size_t LDA) const
Fill the given array with a copy of this multivector's local values.
Teuchos::ArrayRCP< Teuchos::ArrayRCP< Scalar > > get2dViewNonConst()
Return non-const persisting pointers to values.
void endExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void abs(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
void beginImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void get2dCopy(Teuchos::ArrayView< const Teuchos::ArrayView< Scalar > > ArrayOfPtrs) const
Fill the given array with a copy of this multivector's local values.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const Teuchos::ArrayView< const Scalar > &A, size_t LDA, size_t NumVectors)
Create multivector by copying two-dimensional array of local data.
void reciprocal(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,...
void beginImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Teuchos::ArrayRCP< Teuchos::ArrayRCP< Scalar > > get2dViewNonConst()
Return non-const persisting pointers to values.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void scale(Teuchos::ArrayView< const Scalar > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
size_t getLocalLength() const
Local number of rows on the calling process.
void get2dCopy(Teuchos::ArrayView< const Teuchos::ArrayView< Scalar > > ArrayOfPtrs) const
Fill the given array with a copy of this multivector's local values.
std::string description() const
A simple one-line description of this object.
void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
global_size_t getGlobalLength() const
Global number of rows in the multivector.
void multiply(Teuchos::ETransp transA, Teuchos::ETransp transB, const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Scalar &beta)
Matrix-matrix multiplication: this = beta*this + alpha*op(A)*op(B).
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Scalar &gamma)
Update multi-vector with scaled values of A and B, this = gamma*this + alpha*A + beta*B.
void meanValue(const Teuchos::ArrayView< Scalar > &means) const
Compute mean (average) value of each vector in multi-vector. The outcome of this routine is undefined...
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.
void endExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
TpetraMultiVector(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Teuchos::DataAccess copyOrView)
Copy constructor (performs a deep copy).
void endImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Teuchos::ArrayRCP< Teuchos::ArrayRCP< const Scalar > > get2dView() const
Return const persisting pointers to values.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
void beginImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
void abs(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
void reduce()
Sum values of a locally replicated multivector across all processes.
void setSeed(unsigned int seed)
Set seed for Random function.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &ArrayOfPtrs, size_t NumVectors)
Create multivector by copying array of views of local data.
Teuchos::ArrayRCP< const Scalar > get1dView() const
Const persisting (1-D) view of this multivector's local values.
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
size_t getNumVectors() const
Number of columns in the multivector.
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
TpetraMultiVector(const Teuchos::RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &vec)
TpetraMultiVector constructor to wrap a Tpetra::MultiVector object.
TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraMultiVectorClass
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
void beginExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const Teuchos::ArrayView< const Scalar > &A, size_t LDA, size_t NumVectors)
Create multivector by copying two-dimensional array of local data.
void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
void reciprocal(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,...
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
void beginExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_MultiVector() const
Get the underlying Tpetra multivector.
void elementWiseMultiply(Scalar scalarAB, const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarThis)
Element-wise multiply of a Vector A with a TpetraMultiVector B.
void scale(const Scalar &alpha)
Scale the current values of a multi-vector, this = alpha*this.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Basic constuctor.
void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
virtual ~TpetraMultiVector()
Destructor (virtual for memory safety of derived classes).
void endImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void scale(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Replace multi-vector values with scaled values of A, this = alpha*A.
void dot(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< Scalar > &dots) const
Compute dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i]).
void endExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void replaceMap(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Teuchos::ArrayRCP< Scalar > get1dViewNonConst()
Nonconst persisting (1-D) view of this multivector's local values.
void get1dCopy(Teuchos::ArrayView< Scalar > A, size_t LDA) const
Fill the given array with a copy of this multivector's local values.
void replaceMap(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export data into this object using an Import object ("reverse mode").
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
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.
void multiply(Teuchos::ETransp transA, Teuchos::ETransp transB, const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Scalar &beta)
Matrix-matrix multiplication: this = beta*this + alpha*op(A)*op(B).
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import data into this object using an Import object ("forward mode").
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void beginExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export data into this object using an Import object ("reverse mode").
void meanValue(const Teuchos::ArrayView< Scalar > &means) const
Compute mean (average) value of each vector in multi-vector. The outcome of this routine is undefined...
void dot(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< Scalar > &dots) const
Compute dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i]).
void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
Teuchos::ArrayRCP< Scalar > get1dViewNonConst()
Nonconst persisting (1-D) view of this multivector's local values.
size_t getLocalLength() const
Local number of rows on the calling process.
size_t getNumVectors() const
Number of columns in the multivector.
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
void setSeed(unsigned int seed)
Set seed for Random function.
void reduce()
Sum values of a locally replicated multivector across all processes.
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
void endExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export data into this object using an Import object ("reverse mode").
virtual dual_view_type::t_host_const_um getHostLocalView(Access::ReadOnlyStruct) const
std::string description() const
A simple one-line description of this object.
void scale(const Scalar &alpha)
Scale the current values of a multi-vector, this = alpha*this.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Basic constuctor.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
global_size_t getGlobalLength() const
Global number of rows in the multivector.
void reciprocal(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise reciprocal values of input Multi-vector in target, this(i,j) = 1/A(i,...
virtual dual_view_type::t_dev_const_um getDeviceLocalView(Access::ReadOnlyStruct) const
virtual ~TpetraMultiVector()
Destructor (virtual for memory safety of derived classes).
void endImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import data into this object using an Import object ("forward mode").
void abs(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
void elementWiseMultiply(Scalar scalarAB, const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarThis)
Element-wise multiply of a Vector A with a TpetraMultiVector B.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
Teuchos::ArrayRCP< const Scalar > get1dView() const
Const persisting (1-D) view of this multivector's local values.
Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_MultiVector() const
Get the underlying Tpetra multivector.
Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
void get2dCopy(Teuchos::ArrayView< const Teuchos::ArrayView< Scalar > > ArrayOfPtrs) const
Fill the given array with a copy of this multivector's local values.
void beginImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import data into this object using an Import object ("forward mode").
Teuchos::ArrayRCP< Teuchos::ArrayRCP< Scalar > > get2dViewNonConst()
Return non-const persisting pointers to values.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
void get1dCopy(Teuchos::ArrayView< Scalar > A, size_t LDA) const
Fill the given array with a copy of this multivector's local values.
Teuchos::ArrayRCP< Teuchos::ArrayRCP< const Scalar > > get2dView() const
Return const persisting pointers to values.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
size_t global_size_t
Global size_t object.
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
CombineMode
Xpetra::Combine Mode enumerable type.
static void seedrandom(unsigned int s)