10#ifndef XPETRA_EPETRAMULTIVECTOR_HPP
11#define XPETRA_EPETRAMULTIVECTOR_HPP
15#include <Kokkos_Core.hpp>
16#include <Kokkos_DualView.hpp>
20#include "Xpetra_MultiVector.hpp"
29#include "Epetra_SerialComm.h"
31#include <Epetra_MultiVector.h>
32#include <Epetra_Vector.h>
34#if defined(XPETRA_ENABLE_DEPRECATED_CODE)
36#if defined(Xpetra_SHOW_DEPRECATED_WARNINGS)
37#warning "The header file Trilinos/packages/xpetra/src/MultiVector/Xpetra_EpetraMultiVector.hpp is deprecated."
41#error "The header file Trilinos/packages/xpetra/src/MultiVector/Xpetra_EpetraMultiVector.hpp is deprecated."
47template <
class GlobalOrdinal,
class Node>
49template <
class GlobalOrdinal,
class Node>
51template <
class GlobalOrdinal,
class Node>
52XPETRA_DEPRECATED RCP<MultiVector<double, int, GlobalOrdinal, Node> >
toXpetra(RCP<Epetra_MultiVector> vec);
55#ifndef DOXYGEN_SHOULD_SKIP_THIS
56template <
class GlobalOrdinal,
class Node>
60template <
class EpetraGlobalOrdinal,
class Node>
62 :
public virtual MultiVector<double, int, EpetraGlobalOrdinal, Node> {
74 "Xpetra::EpetraMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
80 "Xpetra::EpetraMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
86 "Xpetra::EpetraMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
119 return Teuchos::null;
124 return Teuchos::null;
161 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) {}
176 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) {}
212 void randomize(
bool bUseXpetraImplementation =
false) {}
246 "Xpetra::EpetraMultiVector only available for GO=int or GO=long long with EpetraNode (Serial or OpenMP depending on configuration)");
266#ifndef XPETRA_EPETRA_NO_32BIT_GLOBAL_INDICES
269 :
public virtual MultiVector<double, int, int, EpetraNode> {
300 const std::string tfecfFuncName(
"MultiVector(ArrayOfPtrs)");
302 ": ArrayOfPtrs.size() must be strictly positive and as large as ArrayOfPtrs.");
304#ifdef HAVE_XPETRA_DEBUG
307 size_t localLength = map->getLocalNumElements();
308 for (
int j = 0; j < ArrayOfPtrs.size(); j++) {
310 ": ArrayOfPtrs[" << j <<
"].size() (== " << ArrayOfPtrs[j].size() <<
") is not equal to getLocalLength() (== " << localLength);
317 for (
int i = 0; i < ArrayOfPtrs.size(); i++) {
318 arrayOfRawPtrs[i] = ArrayOfPtrs[i].
getRawPtr();
320 double **rawArrayOfRawPtrs =
const_cast<double **
>(arrayOfRawPtrs.
getRawPtr());
336 vec_->ReplaceGlobalValue(globalRow, Teuchos::as<int>(vectorIndex), value);
342 vec_->SumIntoGlobalValue(globalRow, Teuchos::as<int>(vectorIndex), value);
348 vec_->ReplaceMyValue(myRow, Teuchos::as<int>(vectorIndex), value);
354 vec_->SumIntoMyValue(myRow, Teuchos::as<int>(vectorIndex), value);
360 vec_->PutScalar(value);
378 double **arrayOfPointers;
380 vec_->ExtractView(&arrayOfPointers);
382 double *data = arrayOfPointers[j];
383 int localLength = vec_->MyLength();
392 double **arrayOfPointers;
394 vec_->ExtractView(&arrayOfPointers);
396 double *data = arrayOfPointers[j];
397 int localLength = vec_->MyLength();
412 vec_->Dot(*eA.getEpetra_MultiVector(), dots.
getRawPtr());
418 vec_->Abs(toEpetra<GlobalOrdinal, Node>(A));
424 vec_->Reciprocal(toEpetra<GlobalOrdinal, Node>(A));
439 for (
size_t j = 0; j < numVecs; ++j) {
448 vec_->Update(alpha, toEpetra<GlobalOrdinal, Node>(A), beta);
452 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) {
454 vec_->Update(alpha, toEpetra<GlobalOrdinal, Node>(A), beta, toEpetra<GlobalOrdinal, Node>(B), gamma);
460 vec_->Norm1(norms.getRawPtr());
466 vec_->Norm2(norms.getRawPtr());
472 vec_->NormInf(norms.getRawPtr());
482 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) {
490 vec_->Multiply(scalarAB, toEpetra<GlobalOrdinal, Node>(A), toEpetra<GlobalOrdinal, Node>(B), scalarThis);
501 return vec_->NumVectors();
507 return vec_->MyLength();
513 return vec_->GlobalLength64();
519 auto vv = toEpetra<GlobalOrdinal, Node>(vec);
520 return ((vec_->MyLength() == vv.MyLength()) && (vec_->NumVectors() == vv.NumVectors()));
547 if (bUseXpetraImplementation)
557 if (bUseXpetraImplementation)
562 for (
size_t i = 0; i < numVectors; i++) {
566 for (
size_t j = 0; j < myLength; j++) {
567 datai[j] = 0.5 * (maxVal - minVal) * datai[j] + 0.5 * (maxVal + minVal);
579 return toXpetra<GlobalOrdinal, Node>(vec_->Map());
634 if (!map.is_null()) {
677 typedef Kokkos::View<
typename dual_view_type::t_host::data_type,
679 typename dual_view_type::t_host::device_type,
680 Kokkos::MemoryUnmanaged>
686 vec_->ExtractView(&data, &myLDA);
687 int localLength = vec_->MyLength();
691 epetra_view_type test = epetra_view_type(data, localLength, numVectors);
692 typename dual_view_type::t_host_um ret = subview(test, Kokkos::ALL(), Kokkos::ALL());
707 const this_type *rhsPtr =
dynamic_cast<const this_type *
>(&rhs);
709 rhsPtr == NULL, std::invalid_argument,
710 "Xpetra::MultiVector::operator=: "
711 "The left-hand side (LHS) of the assignment has a different type than "
712 "the right-hand side (RHS). The LHS has type Xpetra::EpetraMultiVectorT "
713 "(which means it wraps an Epetra_MultiVector), but the RHS has some "
714 "other type. This probably means that the RHS wraps a Tpetra::Multi"
715 "Vector. Xpetra::MultiVector does not currently implement assignment "
716 "from a Tpetra object to an Epetra object, though this could be added "
717 "with sufficient interest.");
723 rhsImpl.
is_null(), std::logic_error,
724 "Xpetra::MultiVector::operator= "
725 "(in Xpetra::EpetraMultiVectorT::assign): *this (the right-hand side of "
726 "the assignment) has a null RCP<Epetra_MultiVector> inside. Please "
727 "report this bug to the Xpetra developers.");
729 lhsImpl.
is_null(), std::logic_error,
730 "Xpetra::MultiVector::operator= "
731 "(in Xpetra::EpetraMultiVectorT::assign): The left-hand side of the "
732 "assignment has a null RCP<Epetra_MultiVector> inside. Please report "
733 "this bug to the Xpetra developers.");
747#ifndef XPETRA_EPETRA_NO_64BIT_GLOBAL_INDICES
750 :
public virtual MultiVector<double, int, long long, EpetraNode> {
772 const std::string tfecfFuncName(
"MultiVector(ArrayOfPtrs)");
774 ": ArrayOfPtrs.size() must be strictly positive and as large as ArrayOfPtrs.");
776#ifdef HAVE_XPETRA_DEBUG
779 size_t localLength = map->getLocalNumElements();
780 for (
int j = 0; j < ArrayOfPtrs.size(); j++) {
782 ": ArrayOfPtrs[" << j <<
"].size() (== " << ArrayOfPtrs[j].size() <<
") is not equal to getLocalLength() (== " << localLength);
789 for (
int i = 0; i < ArrayOfPtrs.size(); i++) {
790 arrayOfRawPtrs[i] = ArrayOfPtrs[i].
getRawPtr();
792 double **rawArrayOfRawPtrs =
const_cast<double **
>(arrayOfRawPtrs.
getRawPtr());
808 vec_->ReplaceGlobalValue(globalRow, Teuchos::as<int>(vectorIndex), value);
814 vec_->SumIntoGlobalValue(globalRow, Teuchos::as<int>(vectorIndex), value);
820 vec_->ReplaceMyValue(myRow, Teuchos::as<int>(vectorIndex), value);
826 vec_->SumIntoMyValue(myRow, Teuchos::as<int>(vectorIndex), value);
832 vec_->PutScalar(value);
850 double **arrayOfPointers;
852 vec_->ExtractView(&arrayOfPointers);
854 double *data = arrayOfPointers[j];
855 int localLength = vec_->MyLength();
864 double **arrayOfPointers;
866 vec_->ExtractView(&arrayOfPointers);
868 double *data = arrayOfPointers[j];
869 int localLength = vec_->MyLength();
884 vec_->Dot(*eA.getEpetra_MultiVector(), dots.
getRawPtr());
890 vec_->Abs(toEpetra<GlobalOrdinal, Node>(A));
896 vec_->Reciprocal(toEpetra<GlobalOrdinal, Node>(A));
911 for (
size_t j = 0; j < numVecs; ++j) {
920 vec_->Update(alpha, toEpetra<GlobalOrdinal, Node>(A), beta);
924 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) {
926 vec_->Update(alpha, toEpetra<GlobalOrdinal, Node>(A), beta, toEpetra<GlobalOrdinal, Node>(B), gamma);
932 vec_->Norm1(norms.getRawPtr());
938 vec_->Norm2(norms.getRawPtr());
944 vec_->NormInf(norms.getRawPtr());
954 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) {
962 vec_->Multiply(scalarAB, toEpetra<GlobalOrdinal, Node>(A), toEpetra<GlobalOrdinal, Node>(B), scalarThis);
973 return vec_->NumVectors();
979 return vec_->MyLength();
985 return vec_->GlobalLength64();
991 auto vv = toEpetra<GlobalOrdinal, Node>(vec);
992 return ((vec_->MyLength() == vv.MyLength()) && (vec_->NumVectors() == vv.NumVectors()));
1019 if (bUseXpetraImplementation)
1029 if (bUseXpetraImplementation)
1034 for (
size_t i = 0; i < numVectors; i++) {
1038 for (
size_t j = 0; j < myLength; j++) {
1039 datai[j] = 0.5 * (maxVal - minVal) * datai[j] + 0.5 * (maxVal + minVal);
1051 return toXpetra<GlobalOrdinal, Node>(vec_->Map());
1106 if (!map.is_null()) {
1135 vec_->SetSeed(seed);
1146 const this_type *rhsPtr =
dynamic_cast<const this_type *
>(&rhs);
1148 rhsPtr == NULL, std::invalid_argument,
1149 "Xpetra::MultiVector::operator=: "
1150 "The left-hand side (LHS) of the assignment has a different type than "
1151 "the right-hand side (RHS). The LHS has type Xpetra::EpetraMultiVectorT "
1152 "(which means it wraps an Epetra_MultiVector), but the RHS has some "
1153 "other type. This probably means that the RHS wraps a Tpetra::Multi"
1154 "Vector. Xpetra::MultiVector does not currently implement assignment "
1155 "from a Tpetra object to an Epetra object, though this could be added "
1156 "with sufficient interest.");
1162 rhsImpl.
is_null(), std::logic_error,
1163 "Xpetra::MultiVector::operator= "
1164 "(in Xpetra::EpetraMultiVectorT::assign): *this (the right-hand side of "
1165 "the assignment) has a null RCP<Epetra_MultiVector> inside. Please "
1166 "report this bug to the Xpetra developers.");
1168 lhsImpl.
is_null(), std::logic_error,
1169 "Xpetra::MultiVector::operator= "
1170 "(in Xpetra::EpetraMultiVectorT::assign): The left-hand side of the "
1171 "assignment has a null RCP<Epetra_MultiVector> inside. Please report "
1172 "this bug to the Xpetra developers.");
1175 *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.
RCP< Epetra_MultiVector > getEpetra_MultiVector() const
Get the underlying Epetra 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.
dual_view_type::t_dev_const_um getLocalViewDevice(Access::ReadOnlyStruct) const override
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.
dual_view_type::t_dev_um getLocalViewDevice(Access::OverwriteAllStruct) const override
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.
Xpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node >::dual_view_type dual_view_type
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 randomize(const Scalar &minVal, const Scalar &maxVal, 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 scale(const Scalar &alpha)
Scale in place: this = alpha*this.
RCP< Epetra_MultiVector > vec_
The Epetra_MultiVector which this class wraps.
dual_view_type::t_host_um getLocalViewHost(Access::OverwriteAllStruct) const override
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.
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....
dual_view_type::t_host_um getLocalViewHost(Access::ReadWriteStruct) const override
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
Implements DistObject interface.
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.
dual_view_type::t_host_const_um getLocalViewHost(Access::ReadOnlyStruct) const override
void scale(Teuchos::ArrayView< const Scalar > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
dual_view_type::t_dev_um getLocalViewDevice(Access::ReadWriteStruct) const override
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.
Teuchos::RCP< const Vector< double, int, long long, EpetraNode > > getVector(size_t j) const
Return a Vector which is a const view of column j.
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.
void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
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.
Teuchos::RCP< Vector< double, int, long long, EpetraNode > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
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.
void norm2(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
RCP< Epetra_MultiVector > getEpetra_MultiVector() const
Get the underlying Epetra multivector.
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.
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.
Teuchos::RCP< Vector< double, int, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
EpetraMultiVectorT(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Teuchos::DataAccess copyOrView=Teuchos::Copy)
MultiVector copy constructor.
Teuchos::RCP< const Vector< double, int, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
void normInf(const Teuchos::ArrayView< Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
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 randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
void scale(Teuchos::ArrayView< const Scalar > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
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.
RCP< Epetra_MultiVector > getEpetra_MultiVector() const
Get the underlying Epetra multivector.
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 dual_view_type::t_host_const_um getLocalViewHost(Access::ReadOnlyStruct) const
virtual void Xpetra_randomize()
Set multi-vector values to random numbers. XPetra implementation.
Kokkos::DualView< impl_scalar_type **, Kokkos::LayoutStride, typename node_type::device_type, Kokkos::MemoryUnmanaged > dual_view_type
#define TEUCHOS_TEST_FOR_EXCEPTION_CLASS_FUNC(throw_exception_test, Exception, msg)
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
#define TEUCHOS_UNREACHABLE_RETURN(dummyReturnVal)
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
constexpr struct ReadWriteStruct ReadWrite
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
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)