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>
59 #include "Xpetra_MultiVector.hpp"
68 #include "Epetra_SerialComm.h"
70 #include <Epetra_MultiVector.h>
71 #include <Epetra_Vector.h>
76 template<
class GlobalOrdinal,
class Node>
78 template<
class GlobalOrdinal,
class Node>
80 template<
class GlobalOrdinal,
class Node>
81 RCP<MultiVector<double, int, GlobalOrdinal, Node> >
toXpetra(RCP<Epetra_MultiVector> vec);
84 #ifndef DOXYGEN_SHOULD_SKIP_THIS
85 template<
class GlobalOrdinal,
class Node>
class EpetraVectorT;
88 template<
class EpetraGlobalOrdinal,
class Node>
90 :
public virtual MultiVector<double, int, EpetraGlobalOrdinal, Node>
104 "Xpetra::EpetraMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
110 "Xpetra::EpetraMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
116 "Xpetra::EpetraMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
149 return Teuchos::null;
154 return Teuchos::null;
191 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) { }
206 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) { }
242 void randomize(
bool bUseXpetraImplementation =
false) { }
273 "Xpetra::EpetraMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
293 #ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
296 :
public virtual MultiVector<double, int, int, EpetraNode>
329 const std::string tfecfFuncName(
"MultiVector(ArrayOfPtrs)");
331 ": ArrayOfPtrs.size() must be strictly positive and as large as ArrayOfPtrs.");
333 #ifdef HAVE_XPETRA_DEBUG
336 size_t localLength = map->getNodeNumElements();
337 for(
int j=0; j<ArrayOfPtrs.size(); j++) {
339 ": ArrayOfPtrs[" << j <<
"].size() (== " << ArrayOfPtrs[j].size() <<
340 ") is not equal to getLocalLength() (== " << localLength);
348 for(
int i=0; i<ArrayOfPtrs.size(); i++) {
349 arrayOfRawPtrs[i] = ArrayOfPtrs[i].
getRawPtr();
351 double** rawArrayOfRawPtrs =
const_cast<double**
>(arrayOfRawPtrs.
getRawPtr());
394 double ** arrayOfPointers;
396 vec_->ExtractView(&arrayOfPointers);
398 double * data = arrayOfPointers[j];
399 int localLength = vec_->MyLength();
408 double ** arrayOfPointers;
410 vec_->ExtractView(&arrayOfPointers);
412 double * data = arrayOfPointers[j];
413 int localLength = vec_->MyLength();
428 vec_->Dot(*eA.getEpetra_MultiVector(), dots.
getRawPtr());
446 for (
size_t j = 0; j < numVecs; ++j) {
456 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); }
471 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); }
474 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); }
493 auto vv = toEpetra<GlobalOrdinal,Node>(vec);
494 return ( (vec_->MyLength() == vv.MyLength()) && (vec_->NumVectors() == vv.NumVectors()));
521 if (bUseXpetraImplementation)
585 if (!map.is_null()) {
616 #ifdef HAVE_XPETRA_KOKKOS_REFACTOR
622 typename dual_view_type::t_dev_const_um getDeviceLocalView(Access::ReadOnlyStruct)
const override {
return getDeviceLocalView(
Access::ReadWrite);}
624 typename dual_view_type::t_host_um getHostLocalView (Access::OverwriteAllStruct)
const override {
return getHostLocalView(
Access::ReadWrite);}
626 typename dual_view_type::t_dev_um getDeviceLocalView(Access::OverwriteAllStruct)
const override {
return getDeviceLocalView(
Access::ReadWrite);}
628 typename dual_view_type::t_host_um getHostLocalView (Access::ReadWriteStruct)
const override {
629 typedef Kokkos::View<
typename dual_view_type::t_host::data_type ,
631 typename dual_view_type::t_host::device_type ,
632 Kokkos::MemoryUnmanaged> epetra_view_type;
637 vec_->ExtractView(&data, &myLDA);
638 int localLength = vec_->MyLength();
642 epetra_view_type test = epetra_view_type(data, localLength, numVectors);
643 typename dual_view_type::t_host_um ret = subview(test, Kokkos::ALL(), Kokkos::ALL());
648 typename dual_view_type::t_dev_um getDeviceLocalView(Access::ReadWriteStruct)
const override {
649 throw std::runtime_error(
"Epetra does not support device views! in "+std::string(__FILE__)+
":"+std::to_string(__LINE__));
651 typename dual_view_type::t_dev_um ret;
666 const this_type* rhsPtr =
dynamic_cast<const this_type*
> (&rhs);
668 rhsPtr == NULL, std::invalid_argument,
"Xpetra::MultiVector::operator=: "
669 "The left-hand side (LHS) of the assignment has a different type than "
670 "the right-hand side (RHS). The LHS has type Xpetra::EpetraMultiVectorT "
671 "(which means it wraps an Epetra_MultiVector), but the RHS has some "
672 "other type. This probably means that the RHS wraps a Tpetra::Multi"
673 "Vector. Xpetra::MultiVector does not currently implement assignment "
674 "from a Tpetra object to an Epetra object, though this could be added "
675 "with sufficient interest.");
681 rhsImpl.
is_null (), std::logic_error,
"Xpetra::MultiVector::operator= "
682 "(in Xpetra::EpetraMultiVectorT::assign): *this (the right-hand side of "
683 "the assignment) has a null RCP<Epetra_MultiVector> inside. Please "
684 "report this bug to the Xpetra developers.");
686 lhsImpl.
is_null (), std::logic_error,
"Xpetra::MultiVector::operator= "
687 "(in Xpetra::EpetraMultiVectorT::assign): The left-hand side of the "
688 "assignment has a null RCP<Epetra_MultiVector> inside. Please report "
689 "this bug to the Xpetra developers.");
703 #ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
706 :
public virtual MultiVector<double, int, long long, EpetraNode>
730 const std::string tfecfFuncName(
"MultiVector(ArrayOfPtrs)");
732 ": ArrayOfPtrs.size() must be strictly positive and as large as ArrayOfPtrs.");
734 #ifdef HAVE_XPETRA_DEBUG
737 size_t localLength = map->getNodeNumElements();
738 for(
int j=0; j<ArrayOfPtrs.size(); j++) {
740 ": ArrayOfPtrs[" << j <<
"].size() (== " << ArrayOfPtrs[j].size() <<
741 ") is not equal to getLocalLength() (== " << localLength);
749 for(
int i=0; i<ArrayOfPtrs.size(); i++) {
750 arrayOfRawPtrs[i] = ArrayOfPtrs[i].
getRawPtr();
752 double** rawArrayOfRawPtrs =
const_cast<double**
>(arrayOfRawPtrs.
getRawPtr());
795 double ** arrayOfPointers;
797 vec_->ExtractView(&arrayOfPointers);
799 double * data = arrayOfPointers[j];
800 int localLength = vec_->MyLength();
809 double ** arrayOfPointers;
811 vec_->ExtractView(&arrayOfPointers);
813 double * data = arrayOfPointers[j];
814 int localLength = vec_->MyLength();
829 vec_->Dot(*eA.getEpetra_MultiVector(), dots.
getRawPtr());
847 for (
size_t j = 0; j < numVecs; ++j) {
857 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); }
872 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); }
875 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); }
894 auto vv = toEpetra<GlobalOrdinal,Node>(vec);
895 return ( (vec_->MyLength() == vv.MyLength()) && (vec_->NumVectors() == vv.NumVectors()));
922 if (bUseXpetraImplementation)
986 if (!map.is_null()) {
1014 vec_->SetSeed(seed);
1025 const this_type* rhsPtr =
dynamic_cast<const this_type*
> (&rhs);
1027 rhsPtr == NULL, std::invalid_argument,
"Xpetra::MultiVector::operator=: "
1028 "The left-hand side (LHS) of the assignment has a different type than "
1029 "the right-hand side (RHS). The LHS has type Xpetra::EpetraMultiVectorT "
1030 "(which means it wraps an Epetra_MultiVector), but the RHS has some "
1031 "other type. This probably means that the RHS wraps a Tpetra::Multi"
1032 "Vector. Xpetra::MultiVector does not currently implement assignment "
1033 "from a Tpetra object to an Epetra object, though this could be added "
1034 "with sufficient interest.");
1040 rhsImpl.
is_null (), std::logic_error,
"Xpetra::MultiVector::operator= "
1041 "(in Xpetra::EpetraMultiVectorT::assign): *this (the right-hand side of "
1042 "the assignment) has a null RCP<Epetra_MultiVector> inside. Please "
1043 "report this bug to the Xpetra developers.");
1045 lhsImpl.
is_null (), std::logic_error,
"Xpetra::MultiVector::operator= "
1046 "(in Xpetra::EpetraMultiVectorT::assign): The left-hand side of the "
1047 "assignment has a null RCP<Epetra_MultiVector> inside. Please report "
1048 "this bug to the Xpetra developers.");
1051 *lhsImpl = *rhsImpl;
#define XPETRA_MONITOR(funcName)
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
int Scale(double ScalarValue)
static const EVerbosityLevel verbLevel_default
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
std::string description() const
A simple one-line description of this object.
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 replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace 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 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.
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 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 randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
void abs(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
virtual ~EpetraMultiVectorT()
MultiVector destructor.
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Checks to see if the local length, number of vectors and size of Scalar type match.
void setSeed(unsigned int seed)
Set seed for Random function.
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 replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
EpetraMultiVectorT(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Teuchos::DataAccess copyOrView=Teuchos::Copy)
MultiVector copy constructor.
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel=Teuchos::Describable::verbLevel_default) const
Print the object with the given verbosity level to a FancyOStream.
void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
void scale(const Scalar &alpha)
Scale in place: this = alpha*this.
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 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.
size_t getNumVectors() const
Number of columns in the multivector.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
Update: this = beta*this + alpha*A.
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 Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
RCP< Epetra_MultiVector > vec_
The Epetra_MultiVector which this class wraps.
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....
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
RCP< Epetra_MultiVector > getEpetra_MultiVector() const
Get the underlying Epetra multivector.
EpetraMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Basic MultiVector constuctor.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
EpetraMultiVectorT(const RCP< Epetra_MultiVector > &vec)
EpetraMultiVectorT constructor to wrap a Epetra_MultiVector object.
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void scale(Teuchos::ArrayView< const Scalar > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[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...
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.
EpetraMultiVectorT(const RCP< Epetra_MultiVector > &vec)
EpetraMultiVectorT constructor to wrap a Epetra_MultiVector object.
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
EpetraMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Basic MultiVector constuctor.
size_t getNumVectors() const
Number of columns in the multivector.
Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
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 describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel=Teuchos::Describable::verbLevel_default) const
Print the object with the given verbosity level to a FancyOStream.
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....
void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
void scale(const Scalar &alpha)
Scale in place: this = alpha*this.
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 scale(Teuchos::ArrayView< const Scalar > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[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: this = gamma*this + alpha*A + beta*B.
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
RCP< Epetra_MultiVector > vec_
The Epetra_MultiVector which this class wraps.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
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).
EpetraMultiVectorT(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source)
MultiVector copy constructor.
size_t getLocalLength() const
Local number of rows on the calling process.
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
global_size_t getGlobalLength() const
Global number of rows in the multivector.
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Checks to see if the local length, number of vectors and size of Scalar type match.
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 doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
std::string description() const
A simple one-line description of this object.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
void setSeed(unsigned int seed)
Set seed for Random function.
void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
RCP< Epetra_MultiVector > getEpetra_MultiVector() const
Get the underlying Epetra multivector.
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
void abs(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
void replaceMap(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
Replace the underlying Map in place.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
Update: this = beta*this + alpha*A.
virtual ~EpetraMultiVectorT()
MultiVector destructor.
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
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 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 doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Import (using an Exporter).
void norm1(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Export (using an Importer).
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 doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export.
Teuchos::RCP< const Vector< double, int, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
EpetraGlobalOrdinal GlobalOrdinal
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
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 norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) 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 setSeed(unsigned int seed)
Set seed for Random function.
EpetraMultiVectorT(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Teuchos::DataAccess copyOrView=Teuchos::Copy)
MultiVector copy constructor.
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
Teuchos::RCP< Vector< double, int, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
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 abs(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
void replaceMap(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
Replace the underlying Map in place.
std::string description() const
A simple one-line description of this object.
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.
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
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.
EpetraMultiVectorT(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Basic MultiVector constuctor.
Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
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...
EpetraMultiVectorT(const RCP< Epetra_MultiVector > &vec)
EpetraMultiVectorT constructor to wrap a Epetra_MultiVector object.
void scale(const Scalar &alpha)
Scale in place: this = alpha*this.
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,...
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....
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import.
size_t getLocalLength() const
Local number of rows on the calling process.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
Update: this = beta*this + alpha*A.
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.
virtual ~EpetraMultiVectorT()
MultiVector destructor.
void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
global_size_t getGlobalLength() const
Global number of rows in the multivector.
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace 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 sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
Exception throws when you call an unimplemented method of Xpetra.
Exception throws to report errors in the internal logical of the program.
virtual size_t getNumVectors() const =0
Number of columns in the multivector.
virtual void Xpetra_randomize()
Set multi-vector values to random numbers. XPetra implementation.
#define TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(throw_exception_test, Exception, msg)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
TypeTo as(const TypeFrom &t)
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
constexpr struct ReadWriteStruct ReadWrite
size_t global_size_t
Global size_t object.
const Epetra_CrsGraph & toEpetra(const RCP< const CrsGraph< int, GlobalOrdinal, Node > > &graph)
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)
CombineMode
Xpetra::Combine Mode enumerable type.
static void seedrandom(unsigned int s)