46 #ifndef XPETRA_EPETRAMULTIVECTOR_HPP 47 #define XPETRA_EPETRAMULTIVECTOR_HPP 51 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 52 #include <Kokkos_Core.hpp> 53 #include <Kokkos_DualView.hpp> 68 #include "Epetra_SerialComm.h" 70 #include <Epetra_MultiVector.h> 75 template<
class GlobalOrdinal,
class Node>
76 const Epetra_MultiVector &
toEpetra(
const MultiVector<double,int,GlobalOrdinal,Node> &);
77 template<
class GlobalOrdinal,
class Node>
78 Epetra_MultiVector &
toEpetra(MultiVector<double, int,GlobalOrdinal,Node> &);
79 template<
class GlobalOrdinal,
class Node>
80 RCP<MultiVector<double, int, GlobalOrdinal, Node> >
toXpetra(RCP<Epetra_MultiVector> vec);
83 #ifndef DOXYGEN_SHOULD_SKIP_THIS 84 template<
class GlobalOrdinal,
class Node>
class EpetraVectorT;
87 template<
class EpetraGlobalOrdinal,
class Node>
89 :
public virtual MultiVector<double, int, EpetraGlobalOrdinal, Node>
103 "Xpetra::EpetraMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
109 "Xpetra::EpetraMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
115 "Xpetra::EpetraMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
148 return Teuchos::null;
153 return Teuchos::null;
190 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) { }
205 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) { }
238 void randomize(
bool bUseXpetraImplementation =
false) { }
269 "Xpetra::EpetraMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
278 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 292 template<
class TargetDeviceType>
293 typename Kokkos::Impl::if_c<
294 Kokkos::Impl::is_same<
295 typename dual_view_type::t_dev_um::execution_space::memory_space,
296 typename TargetDeviceType::memory_space>::value,
297 typename dual_view_type::t_dev_um,
298 typename dual_view_type::t_host_um>::type
299 getLocalView ()
const {
300 typename Kokkos::Impl::if_c<
301 Kokkos::Impl::is_same<
302 typename dual_view_type::t_dev_um::execution_space::memory_space,
303 typename TargetDeviceType::memory_space>::value,
304 typename dual_view_type::t_dev_um,
305 typename dual_view_type::t_host_um>::type dummy;
309 typename dual_view_type::t_host_um getHostLocalView ()
const {
310 return typename dual_view_type::t_host_um();
313 typename dual_view_type::t_dev_um getDeviceLocalView()
const {
314 throw std::runtime_error(
"Epetra does not support device views!");
315 typename dual_view_type::t_dev_um ret;
339 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES 342 :
public virtual MultiVector<double, int, int, EpetraNode>
360 : vec_(
Teuchos::
rcp(new Epetra_MultiVector(
toEpetra<GlobalOrdinal,Node>(source)))) { }
366 const std::string tfecfFuncName(
"MultiVector(ArrayOfPtrs)");
368 ": ArrayOfPtrs.size() must be strictly positive and as large as ArrayOfPtrs.");
370 #ifdef HAVE_XPETRA_DEBUG 373 size_t localLength = map->getNodeNumElements();
374 for(
int j=0; j<ArrayOfPtrs.size(); j++) {
376 ": ArrayOfPtrs[" << j <<
"].size() (== " << ArrayOfPtrs[j].size() <<
377 ") is not equal to getLocalLength() (== " << localLength);
385 for(
int i=0; i<ArrayOfPtrs.size(); i++) {
386 arrayOfRawPtrs[i] = ArrayOfPtrs[i].
getRawPtr();
388 double** rawArrayOfRawPtrs =
const_cast<double**
>(arrayOfRawPtrs.getRawPtr());
390 vec_ =
Teuchos::rcp(
new Epetra_MultiVector(
Copy, toEpetra<GlobalOrdinal,Node>(map), rawArrayOfRawPtrs, NumVectors));
402 void replaceGlobalValue(GlobalOrdinal globalRow,
size_t vectorIndex,
const Scalar &value) {
XPETRA_MONITOR(
"EpetraMultiVectorT::replaceGlobalValue"); vec_->ReplaceGlobalValue(globalRow, Teuchos::as<int>(vectorIndex), value); }
405 void sumIntoGlobalValue(GlobalOrdinal globalRow,
size_t vectorIndex,
const Scalar &value) {
XPETRA_MONITOR(
"EpetraMultiVectorT::sumIntoGlobalValue"); vec_->SumIntoGlobalValue(globalRow, Teuchos::as<int>(vectorIndex), value); }
408 void replaceLocalValue(LocalOrdinal myRow,
size_t vectorIndex,
const Scalar &value) {
XPETRA_MONITOR(
"EpetraMultiVectorT::replaceLocalValue"); vec_->ReplaceMyValue(myRow, Teuchos::as<int>(vectorIndex), value); }
411 void sumIntoLocalValue(LocalOrdinal myRow,
size_t vectorIndex,
const Scalar &value) {
XPETRA_MONITOR(
"EpetraMultiVectorT::sumIntoLocalValue"); vec_->SumIntoMyValue(myRow, Teuchos::as<int>(vectorIndex), value); }
431 double ** arrayOfPointers;
433 vec_->ExtractView(&arrayOfPointers);
435 double * data = arrayOfPointers[j];
436 int localLength = vec_->MyLength();
445 double ** arrayOfPointers;
447 vec_->ExtractView(&arrayOfPointers);
449 double * data = arrayOfPointers[j];
450 int localLength = vec_->MyLength();
465 vec_->Dot(*eA.getEpetra_MultiVector(), dots.
getRawPtr());
483 for (
size_t j = 0; j < numVecs; ++j) {
484 vec_->Scale (alpha[j]);
492 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) {
XPETRA_MONITOR(
"EpetraMultiVectorT::update"); vec_->Update(alpha, toEpetra<GlobalOrdinal,Node>(A), beta, toEpetra<GlobalOrdinal,Node>(B), gamma); }
507 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) {
XPETRA_MONITOR(
"EpetraMultiVectorT::multiply"); vec_->Multiply(
toEpetra(transA),
toEpetra(transB), alpha,
toEpetra(A),
toEpetra(B), beta); }
510 void elementWiseMultiply(Scalar scalarAB,
const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarThis) {
XPETRA_MONITOR(
"EpetraMultiVectorT::elementWiseMultiply"); vec_->Multiply(scalarAB, toEpetra<GlobalOrdinal,Node>(A), toEpetra<GlobalOrdinal,Node>(B), scalarThis); }
550 if (bUseXpetraImplementation)
613 if (!map.is_null()) {
618 Epetra_SerialComm SComm;
619 Epetra_Map NewMap((GlobalOrdinal) vec_->MyLength(), (
GlobalOrdinal) vec_->Map().IndexBase64(), SComm);
644 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 658 template<
class TargetDeviceType>
659 typename Kokkos::Impl::if_c<
660 Kokkos::Impl::is_same<
661 typename dual_view_type::t_dev_um::execution_space::memory_space,
662 typename TargetDeviceType::memory_space>::value,
663 typename dual_view_type::t_dev_um,
664 typename dual_view_type::t_host_um>::type
665 getLocalView ()
const {
669 typename dual_view_type::t_host_um getHostLocalView ()
const {
670 typedef Kokkos::View<
typename dual_view_type::t_host::data_type ,
672 typename dual_view_type::t_host::device_type ,
673 Kokkos::MemoryUnmanaged> epetra_view_type;
678 vec_->ExtractView(&data, &myLDA);
679 int localLength = vec_->MyLength();
683 epetra_view_type test = epetra_view_type(data, localLength, numVectors);
684 typename dual_view_type::t_host_um ret = subview(test, Kokkos::ALL(), Kokkos::ALL());
689 typename dual_view_type::t_dev_um getDeviceLocalView()
const {
690 throw std::runtime_error(
"Epetra does not support device views!");
691 typename dual_view_type::t_dev_um ret;
705 const this_type* rhsPtr =
dynamic_cast<const this_type*
> (&rhs);
707 rhsPtr == NULL, std::invalid_argument,
"Xpetra::MultiVector::operator=: " 708 "The left-hand side (LHS) of the assignment has a different type than " 709 "the right-hand side (RHS). The LHS has type Xpetra::EpetraMultiVectorT " 710 "(which means it wraps an Epetra_MultiVector), but the RHS has some " 711 "other type. This probably means that the RHS wraps a Tpetra::Multi" 712 "Vector. Xpetra::MultiVector does not currently implement assignment " 713 "from a Tpetra object to an Epetra object, though this could be added " 714 "with sufficient interest.");
720 rhsImpl.
is_null (), std::logic_error,
"Xpetra::MultiVector::operator= " 721 "(in Xpetra::EpetraMultiVectorT::assign): *this (the right-hand side of " 722 "the assignment) has a null RCP<Epetra_MultiVector> inside. Please " 723 "report this bug to the Xpetra developers.");
725 lhsImpl.
is_null (), std::logic_error,
"Xpetra::MultiVector::operator= " 726 "(in Xpetra::EpetraMultiVectorT::assign): The left-hand side of the " 727 "assignment has a null RCP<Epetra_MultiVector> inside. Please report " 728 "this bug to the Xpetra developers.");
742 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES 745 :
public virtual MultiVector<double, int, long long, EpetraNode>
763 : vec_(
Teuchos::
rcp(new Epetra_MultiVector(
toEpetra<GlobalOrdinal,Node>(source)))) { }
769 const std::string tfecfFuncName(
"MultiVector(ArrayOfPtrs)");
771 ": ArrayOfPtrs.size() must be strictly positive and as large as ArrayOfPtrs.");
773 #ifdef HAVE_XPETRA_DEBUG 776 size_t localLength = map->getNodeNumElements();
777 for(
int j=0; j<ArrayOfPtrs.size(); j++) {
779 ": ArrayOfPtrs[" << j <<
"].size() (== " << ArrayOfPtrs[j].size() <<
780 ") is not equal to getLocalLength() (== " << localLength);
788 for(
int i=0; i<ArrayOfPtrs.size(); i++) {
789 arrayOfRawPtrs[i] = ArrayOfPtrs[i].
getRawPtr();
791 double** rawArrayOfRawPtrs =
const_cast<double**
>(arrayOfRawPtrs.getRawPtr());
793 vec_ =
Teuchos::rcp(
new Epetra_MultiVector(
Copy, toEpetra<GlobalOrdinal,Node>(map), rawArrayOfRawPtrs, NumVectors));
805 void replaceGlobalValue(GlobalOrdinal globalRow,
size_t vectorIndex,
const Scalar &value) {
XPETRA_MONITOR(
"EpetraMultiVectorT::replaceGlobalValue"); vec_->ReplaceGlobalValue(globalRow, Teuchos::as<int>(vectorIndex), value); }
808 void sumIntoGlobalValue(GlobalOrdinal globalRow,
size_t vectorIndex,
const Scalar &value) {
XPETRA_MONITOR(
"EpetraMultiVectorT::sumIntoGlobalValue"); vec_->SumIntoGlobalValue(globalRow, Teuchos::as<int>(vectorIndex), value); }
811 void replaceLocalValue(LocalOrdinal myRow,
size_t vectorIndex,
const Scalar &value) {
XPETRA_MONITOR(
"EpetraMultiVectorT::replaceLocalValue"); vec_->ReplaceMyValue(myRow, Teuchos::as<int>(vectorIndex), value); }
814 void sumIntoLocalValue(LocalOrdinal myRow,
size_t vectorIndex,
const Scalar &value) {
XPETRA_MONITOR(
"EpetraMultiVectorT::sumIntoLocalValue"); vec_->SumIntoMyValue(myRow, Teuchos::as<int>(vectorIndex), value); }
834 double ** arrayOfPointers;
836 vec_->ExtractView(&arrayOfPointers);
838 double * data = arrayOfPointers[j];
839 int localLength = vec_->MyLength();
848 double ** arrayOfPointers;
850 vec_->ExtractView(&arrayOfPointers);
852 double * data = arrayOfPointers[j];
853 int localLength = vec_->MyLength();
868 vec_->Dot(*eA.getEpetra_MultiVector(), dots.
getRawPtr());
886 for (
size_t j = 0; j < numVecs; ++j) {
887 vec_->Scale (alpha[j]);
895 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) {
XPETRA_MONITOR(
"EpetraMultiVectorT::update"); vec_->Update(alpha, toEpetra<GlobalOrdinal,Node>(A), beta, toEpetra<GlobalOrdinal,Node>(B), gamma); }
910 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) {
XPETRA_MONITOR(
"EpetraMultiVectorT::multiply"); vec_->Multiply(
toEpetra(transA),
toEpetra(transB), alpha,
toEpetra(A),
toEpetra(B), beta); }
913 void elementWiseMultiply(Scalar scalarAB,
const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A,
const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarThis) {
XPETRA_MONITOR(
"EpetraMultiVectorT::elementWiseMultiply"); vec_->Multiply(scalarAB, toEpetra<GlobalOrdinal,Node>(A), toEpetra<GlobalOrdinal,Node>(B), scalarThis); }
953 if (bUseXpetraImplementation)
1016 if (!map.is_null()) {
1021 Epetra_SerialComm SComm;
1022 Epetra_Map NewMap((GlobalOrdinal) vec_->MyLength(), (
GlobalOrdinal) vec_->Map().IndexBase64(), SComm);
1044 vec_->SetSeed(seed);
1047 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR 1061 template<
class TargetDeviceType>
1062 typename Kokkos::Impl::if_c<
1063 Kokkos::Impl::is_same<
1064 typename dual_view_type::t_dev_um::execution_space::memory_space,
1065 typename TargetDeviceType::memory_space>::value,
1066 typename dual_view_type::t_dev_um,
1067 typename dual_view_type::t_host_um>::type
1068 getLocalView ()
const {
1072 typename dual_view_type::t_host_um getHostLocalView ()
const {
1073 typedef Kokkos::View<
typename dual_view_type::t_host::data_type ,
1075 typename dual_view_type::t_host::device_type ,
1076 Kokkos::MemoryUnmanaged> epetra_view_type;
1079 double* data = NULL;
1081 vec_->ExtractView(&data, &myLDA);
1082 int localLength = vec_->MyLength();
1086 epetra_view_type test = epetra_view_type(data, localLength, numVectors);
1087 typename dual_view_type::t_host_um ret = subview(test, Kokkos::ALL(), Kokkos::ALL());
1092 typename dual_view_type::t_dev_um getDeviceLocalView()
const {
1093 throw std::runtime_error(
"Epetra does not support device views!");
1094 typename dual_view_type::t_dev_um ret;
1108 const this_type* rhsPtr =
dynamic_cast<const this_type*
> (&rhs);
1110 rhsPtr == NULL, std::invalid_argument,
"Xpetra::MultiVector::operator=: " 1111 "The left-hand side (LHS) of the assignment has a different type than " 1112 "the right-hand side (RHS). The LHS has type Xpetra::EpetraMultiVectorT " 1113 "(which means it wraps an Epetra_MultiVector), but the RHS has some " 1114 "other type. This probably means that the RHS wraps a Tpetra::Multi" 1115 "Vector. Xpetra::MultiVector does not currently implement assignment " 1116 "from a Tpetra object to an Epetra object, though this could be added " 1117 "with sufficient interest.");
1123 rhsImpl.
is_null (), std::logic_error,
"Xpetra::MultiVector::operator= " 1124 "(in Xpetra::EpetraMultiVectorT::assign): *this (the right-hand side of " 1125 "the assignment) has a null RCP<Epetra_MultiVector> inside. Please " 1126 "report this bug to the Xpetra developers.");
1128 lhsImpl.
is_null (), std::logic_error,
"Xpetra::MultiVector::operator= " 1129 "(in Xpetra::EpetraMultiVectorT::assign): The left-hand side of the " 1130 "assignment has a null RCP<Epetra_MultiVector> inside. Please report " 1131 "this bug to the Xpetra developers.");
1134 *lhsImpl = *rhsImpl;
1148 #endif // XPETRA_EPETRAMULTIVECTOR_HPP void dot(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< Scalar > &dots) const
Compute the dot product of each corresponding pair of vectors (columns) in A and B.
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: this = gamma*this + alpha*A + beta*B.
EpetraMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &ArrayOfPtrs, size_t NumVectors)
Set multi-vector values from array of pointers using Teuchos memory management classes. (copy).
size_t getNumVectors() const
Number of columns in the multivector.
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
Update: this = beta*this + alpha*A.
std::string description() const
A simple one-line description of this object.
Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
void dot(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< Scalar > &dots) const
Compute the dot product of each corresponding pair of vectors (columns) in A and B.
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: this = gamma*this + alpha*A + beta*B.
EpetraMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &ArrayOfPtrs, size_t NumVectors)
Set multi-vector values from array of pointers using Teuchos memory management classes. (copy).
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: this = gamma*this + alpha*A + beta*B.
void scale(const Scalar &alpha)
Scale in place: this = alpha*this.
void scale(const Scalar &alpha)
Scale in place: this = alpha*this.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
Update: this = beta*this + alpha*A.
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
virtual ~EpetraMultiVectorT()
MultiVector destructor.
void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
RCP< Epetra_MultiVector > vec_
The Epetra_MultiVector which this class wraps.
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
size_t getLocalLength() const
Local number of rows on the calling process.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
#define TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(throw_exception_test, Exception, msg)
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...
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual void Xpetra_randomize()
Set multi-vector values to random numbers. XPetra implementation.
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
EpetraMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Basic MultiVector constuctor.
EpetraMultiVectorT(const RCP< Epetra_MultiVector > &vec)
EpetraMultiVectorT constructor to wrap a Epetra_MultiVector object.
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 doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
Exception throws to report errors in the internal logical of the program.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
EpetraMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Basic MultiVector constuctor.
Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
void abs(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
void scale(Teuchos::ArrayView< const Scalar > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
RCP< Epetra_MultiVector > getEpetra_MultiVector() const
Get the underlying Epetra multivector.
void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
void elementWiseMultiply(Scalar scalarAB, const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarThis)
Multiply a Vector A elementwise by a MultiVector B.
global_size_t getGlobalLength() const
Global number of rows in the multivector.
void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
size_t getLocalLength() const
Local number of rows on the calling process.
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).
void replaceMap(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
Replace the underlying Map in place.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
EpetraMultiVectorT(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source)
MultiVector copy constructor.
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
void elementWiseMultiply(Scalar scalarAB, const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarThis)
Multiply a Vector A elementwise by a MultiVector B.
EpetraGlobalOrdinal GlobalOrdinal
RCP< Epetra_MultiVector > getEpetra_MultiVector() const
Get the underlying Epetra multivector.
global_size_t getGlobalLength() const
Global number of rows in the multivector.
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
std::string description() const
A simple one-line description of this object.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
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_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
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.
size_t getNumVectors() const
Number of columns in the multivector.
void setSeed(unsigned int seed)
Set seed for Random function.
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 randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
EpetraMultiVectorT(const RCP< Epetra_MultiVector > &vec)
EpetraMultiVectorT constructor to wrap a Epetra_MultiVector object.
virtual ~EpetraMultiVectorT()
MultiVector destructor.
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
EpetraMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &ArrayOfPtrs, size_t NumVectors)
Set multi-vector values from array of pointers using Teuchos memory management classes. (copy).
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
EpetraMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Basic MultiVector constuctor.
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 doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
size_t getNumVectors() const
Number of columns in the multivector.
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
void replaceMap(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
Replace the underlying Map in place.
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).
global_size_t getGlobalLength() const
Global number of rows in the multivector.
Exception throws when you call an unimplemented method of Xpetra.
Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
static void seedrandom(unsigned int s)
Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
size_t global_size_t
Global size_t object.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
Update: this = beta*this + alpha*A.
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
size_t getLocalLength() const
Local number of rows on the calling process.
static const EVerbosityLevel verbLevel_default
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
void abs(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
void setSeed(unsigned int seed)
Set seed for Random function.
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).
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
void scale(Teuchos::ArrayView< const Scalar > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
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 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,j).
EpetraMultiVectorT(const RCP< Epetra_MultiVector > &vec)
EpetraMultiVectorT constructor to wrap a Epetra_MultiVector object.
void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
void scale(Teuchos::ArrayView< const Scalar > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
void setSeed(unsigned int seed)
Set seed for Random function.
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
void scale(const Scalar &alpha)
Scale in place: this = alpha*this.
TypeTo as(const TypeFrom &t)
RCP< Epetra_MultiVector > vec_
The Epetra_MultiVector which this class wraps.
virtual ~EpetraMultiVectorT()
MultiVector destructor.
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
void replaceMap(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
Replace the underlying Map in place.
EpetraMultiVectorT(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source)
MultiVector copy constructor.
RCP< Epetra_MultiVector > getEpetra_MultiVector() const
Get the underlying Epetra multivector.
CombineMode
Xpetra::Combine Mode enumerable type.
#define XPETRA_MONITOR(funcName)
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
void elementWiseMultiply(Scalar scalarAB, const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarThis)
Multiply a Vector A elementwise by a MultiVector B.
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,j).
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
EpetraMultiVectorT(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source)
MultiVector copy constructor.
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
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,j).
std::string description() const
A simple one-line description of this object.
Teuchos::RCP< const Vector< double, int, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
Teuchos::RCP< Vector< double, int, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
void dot(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< Scalar > &dots) const
Compute the dot product of each corresponding pair of vectors (columns) in A and B.
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const