10 #ifndef XPETRA_TPETRAMULTIVECTOR_DEF_HPP
11 #define XPETRA_TPETRAMULTIVECTOR_DEF_HPP
14 #include "Xpetra_TpetraMap.hpp"
16 #include "Xpetra_TpetraImport.hpp"
17 #include "Xpetra_TpetraExport.hpp"
20 #include "Tpetra_MultiVector.hpp"
21 #include "Tpetra_Vector.hpp"
22 #include "Tpetra_Details_Random.hpp"
27 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
29 : vec_(Teuchos::rcp(new Tpetra::
MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>(
toTpetra(map), NumVectors, zeroOut))) {
31 TEUCHOS_TEST_FOR_EXCEPTION(NumVectors < 1, std::invalid_argument,
"Xpetra::TpetraMultiVector(map,numVecs,zeroOut): numVecs = " << NumVectors <<
" < 1.");
35 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
38 : vec_(Teuchos::rcp(new Tpetra::
MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>(
toTpetra(source), copyOrView))) {}
41 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
44 : vec_(Teuchos::rcp(new Tpetra::
MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>(
toTpetra(map), A, LDA, NumVectors))) {
46 TEUCHOS_TEST_FOR_EXCEPTION(NumVectors < 1, std::invalid_argument,
"Xpetra::TpetraMultiVector(map,A,LDA,numVecs): numVecs = " << NumVectors <<
" < 1.");
50 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
53 : vec_(Teuchos::rcp(new Tpetra::
MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>(
toTpetra(map), ArrayOfPtrs, NumVectors))) {
55 TEUCHOS_TEST_FOR_EXCEPTION(NumVectors < 1, std::invalid_argument,
"Xpetra::TpetraMultiVector(map,ArrayOfPtrs,numVecs): numVecs = " << NumVectors <<
" < 1.");
59 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
64 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
68 vec_->replaceGlobalValue(globalRow, vectorIndex, value);
72 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
76 vec_->sumIntoGlobalValue(globalRow, vectorIndex, value);
80 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
84 vec_->replaceLocalValue(myRow, vectorIndex, value);
88 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
92 vec_->sumIntoLocalValue(myRow, vectorIndex, value);
96 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
100 vec_->putScalar(value);
104 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
111 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
112 Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
116 return toXpetra(vec_->getVector(j));
120 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
121 Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
125 return toXpetra(vec_->getVectorNonConst(j));
129 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
130 Teuchos::ArrayRCP<const Scalar>
134 return vec_->getData(j);
138 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
139 Teuchos::ArrayRCP<Scalar>
143 return vec_->getDataNonConst(j);
147 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
149 get1dCopy(Teuchos::ArrayView<Scalar> A,
size_t LDA)
const {
151 vec_->get1dCopy(A, LDA);
155 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
157 get2dCopy(Teuchos::ArrayView<
const Teuchos::ArrayView<Scalar> > ArrayOfPtrs)
const {
159 vec_->get2dCopy(ArrayOfPtrs);
163 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
164 Teuchos::ArrayRCP<const Scalar>
168 return vec_->get1dView();
172 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
173 Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> >
177 return vec_->get2dView();
181 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
182 Teuchos::ArrayRCP<Scalar>
186 return vec_->get1dViewNonConst();
190 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
191 Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> >
195 return vec_->get2dViewNonConst();
199 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
207 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
215 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
223 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
231 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
233 scale(Teuchos::ArrayView<const Scalar> alpha) {
239 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
247 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
251 vec_->update(alpha,
toTpetra(A), beta);
255 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
257 update(
const Scalar &alpha,
const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &A,
const Scalar &beta,
const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &B,
const Scalar &gamma) {
263 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
265 norm1(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {
271 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
273 norm2(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {
279 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
281 normInf(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {
283 vec_->normInf(norms);
287 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
289 meanValue(
const Teuchos::ArrayView<Scalar> &means)
const {
291 vec_->meanValue(means);
295 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
297 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) {
303 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
307 return vec_->getNumVectors();
311 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
315 return vec_->getLocalLength();
319 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
323 return vec_->getGlobalLength();
327 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
331 return vec_->isSameSize(
toTpetra(vec));
335 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
339 return vec_->description();
343 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
345 describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel)
const {
347 vec_->describe(out, verbLevel);
351 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
356 if (bUseXpetraImplementation)
363 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
365 randomize(
const Scalar &minVal,
const Scalar &maxVal,
bool bUseXpetraImplementation) {
368 if (bUseXpetraImplementation)
371 vec_->randomize(minVal, maxVal);
374 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
375 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
382 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
388 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
389 this->getTpetra_MultiVector()->doImport(*v,
toTpetra(importer),
toTpetra(CM));
392 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
398 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
399 this->getTpetra_MultiVector()->beginImport(*v,
toTpetra(importer),
toTpetra(CM));
402 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
408 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
409 this->getTpetra_MultiVector()->endImport(*v,
toTpetra(importer),
toTpetra(CM));
412 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
418 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
419 this->getTpetra_MultiVector()->doExport(*v,
toTpetra(importer),
toTpetra(CM));
422 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
428 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
429 this->getTpetra_MultiVector()->beginExport(*v,
toTpetra(importer),
toTpetra(CM));
432 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
438 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
439 this->getTpetra_MultiVector()->endExport(*v,
toTpetra(importer),
toTpetra(CM));
442 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
448 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
449 this->getTpetra_MultiVector()->doImport(*v,
toTpetra(exporter),
toTpetra(CM));
452 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
458 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
459 this->getTpetra_MultiVector()->beginImport(*v,
toTpetra(exporter),
toTpetra(CM));
462 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
468 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
469 this->getTpetra_MultiVector()->endImport(*v,
toTpetra(exporter),
toTpetra(CM));
472 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
478 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
479 this->getTpetra_MultiVector()->doExport(*v,
toTpetra(exporter),
toTpetra(CM));
482 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
488 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
489 this->getTpetra_MultiVector()->beginExport(*v,
toTpetra(exporter),
toTpetra(CM));
492 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
498 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
499 this->getTpetra_MultiVector()->endExport(*v,
toTpetra(exporter),
toTpetra(CM));
502 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
506 this->getTpetra_MultiVector()->replaceMap(
toTpetra(map));
510 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
512 TpetraMultiVector(
const Teuchos::RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > &vec)
516 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
517 RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
522 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
526 Teuchos::ScalarTraits<Scalar>::seedrandom(seed);
528 Tpetra::Details::Static_Random_XorShift64_Pool<typename Node::device_type::execution_space>::resetPool(getMap()->getComm()->getRank());
531 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
538 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
545 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
552 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
559 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
566 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
575 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
579 const this_type *rhsPtr =
dynamic_cast<const this_type *
>(&rhs);
580 TEUCHOS_TEST_FOR_EXCEPTION(
581 rhsPtr == NULL, std::invalid_argument,
582 "Xpetra::MultiVector::operator=:"
583 " The left-hand side (LHS) of the assignment has a different type than "
584 "the right-hand side (RHS). The LHS has type Xpetra::TpetraMultiVector"
585 " (which means it wraps a Tpetra::MultiVector), but the RHS has some "
586 "other type. This probably means that the RHS wraps an "
587 "Epetra_MultiVector. Xpetra::MultiVector does not currently implement "
588 "assignment from an Epetra object to a Tpetra object, though this could"
589 " be added with sufficient interest.");
591 typedef Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> TMV;
592 RCP<const TMV> rhsImpl = rhsPtr->getTpetra_MultiVector();
593 RCP<TMV> lhsImpl = this->getTpetra_MultiVector();
595 TEUCHOS_TEST_FOR_EXCEPTION(
596 rhsImpl.is_null(), std::logic_error,
597 "Xpetra::MultiVector::operator= "
598 "(in Xpetra::TpetraMultiVector::assign): *this (the right-hand side of "
599 "the assignment) has a null RCP<Tpetra::MultiVector> inside. Please "
600 "report this bug to the Xpetra developers.");
601 TEUCHOS_TEST_FOR_EXCEPTION(
602 lhsImpl.is_null(), std::logic_error,
603 "Xpetra::MultiVector::operator= "
604 "(in Xpetra::TpetraMultiVector::assign): The left-hand side of the "
605 "assignment has a null RCP<Tpetra::MultiVector> inside. Please report "
606 "this bug to the Xpetra developers.");
608 Tpetra::deep_copy(*lhsImpl, *rhsImpl);
611 #ifdef HAVE_XPETRA_EPETRA
613 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
614 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
617 template <
class Scalar>
619 :
public virtual MultiVector<Scalar, int, int, EpetraNode> {
688 Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
getVector(
size_t j)
const {
return Teuchos::null; }
691 Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
getVectorNonConst(
size_t j) {
return Teuchos::null; }
694 Teuchos::ArrayRCP<const Scalar>
getData(
size_t j)
const {
return Teuchos::ArrayRCP<const Scalar>(); }
697 Teuchos::ArrayRCP<Scalar>
getDataNonConst(
size_t j) {
return Teuchos::ArrayRCP<Scalar>(); }
700 void get1dCopy(Teuchos::ArrayView<Scalar> A,
size_t LDA)
const {}
703 void get2dCopy(Teuchos::ArrayView<
const Teuchos::ArrayView<Scalar> > ArrayOfPtrs)
const {}
706 Teuchos::ArrayRCP<const Scalar>
get1dView()
const {
return Teuchos::ArrayRCP<const Scalar>(); }
709 Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> >
get2dView()
const {
return Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> >(); }
715 Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> >
get2dViewNonConst() {
return Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> >(); }
735 void scale(Teuchos::ArrayView<const Scalar> alpha) {}
744 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) {}
747 void norm1(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {}
750 void norm2(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {}
753 void normInf(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {}
756 void meanValue(
const Teuchos::ArrayView<Scalar> &means)
const {}
759 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) {}
787 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default)
const {}
795 void randomize(
bool bUseXpetraImplementation =
false) {}
798 void randomize(
const Scalar &minVal,
const Scalar &maxVal,
bool bUseXpetraImplementation =
false) {}
803 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
getMap()
const {
return Teuchos::null; }
837 TpetraMultiVector(
const Teuchos::RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > &vec) {
842 RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
getTpetra_MultiVector()
const {
return Teuchos::null; }
857 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
858 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
861 template <
class Scalar>
863 :
public virtual MultiVector<Scalar, int, long long, EpetraNode> {
927 Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
getVector(
size_t j)
const {
return Teuchos::null; }
930 Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
getVectorNonConst(
size_t j) {
return Teuchos::null; }
933 Teuchos::ArrayRCP<const Scalar>
getData(
size_t j)
const {
return Teuchos::ArrayRCP<const Scalar>(); }
936 Teuchos::ArrayRCP<Scalar>
getDataNonConst(
size_t j) {
return Teuchos::ArrayRCP<Scalar>(); }
939 void get1dCopy(Teuchos::ArrayView<Scalar> A,
size_t LDA)
const {}
942 void get2dCopy(Teuchos::ArrayView<
const Teuchos::ArrayView<Scalar> > ArrayOfPtrs)
const {}
945 Teuchos::ArrayRCP<const Scalar>
get1dView()
const {
return Teuchos::ArrayRCP<const Scalar>(); }
948 Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> >
get2dView()
const {
return Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> >(); }
954 Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> >
get2dViewNonConst() {
return Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> >(); }
974 void scale(Teuchos::ArrayView<const Scalar> alpha) {}
983 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) {}
986 void norm1(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {}
989 void norm2(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {}
992 void normInf(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {}
995 void meanValue(
const Teuchos::ArrayView<Scalar> &means)
const {}
998 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) {}
1026 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default)
const {}
1037 void randomize(
const Scalar &minVal,
const Scalar &maxVal,
bool bUseXpetraImplementation =
false) {}
1042 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
getMap()
const {
return Teuchos::null; }
1076 TpetraMultiVector(
const Teuchos::RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > &vec) {
1081 RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
getTpetra_MultiVector()
const {
return Teuchos::null; }
1095 #endif // TpetraMultiVector class (specialization GO=long long, NO=EpetraNode)
1097 #endif // HAVE_XPETRA_EPETRA
1105 #include "Xpetra_TpetraVector.hpp"
1109 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1114 Scalar scalarThis) {
1120 XPETRA_DYNAMIC_CAST(
const tpv, A, tA,
"Xpetra::TpetraMultiVectorMatrix->multiply() only accept Xpetra::TpetraMultiVector as input arguments.");
1122 vec_->elementWiseMultiply(scalarAB, *tA.getTpetra_Vector(), *tB.getTpetra_MultiVector(), scalarThis);
1127 #define XPETRA_TPETRAMULTIVECTOR_SHORT
1128 #endif // XPETRA_TPETRAMULTIVECTOR_HPP
void replaceMap(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
size_t getLocalLength() const
Local number of rows on the calling process.
Teuchos::ArrayRCP< Teuchos::ArrayRCP< const Scalar > > get2dView() const
Return const persisting pointers to values.
RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_MultiVector() const
Get the underlying Tpetra multivector.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
Teuchos::ArrayRCP< const Scalar > get1dView() const
Const persisting (1-D) view of this multivector's local values.
Teuchos::ArrayRCP< Teuchos::ArrayRCP< const Scalar > > get2dView() const
Return const persisting pointers to values.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void beginImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void dot(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< Scalar > &dots) const
Compute dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i]).
void endExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void scale(const Scalar &alpha)
Scale the current values of a multi-vector, this = alpha*this.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Basic constuctor.
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
void setSeed(unsigned int seed)
Set seed for Random function.
void beginExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with the given verbosity level to a FancyOStream.
Teuchos::ArrayRCP< Teuchos::ArrayRCP< Scalar > > get2dViewNonConst()
Return non-const persisting pointers to values.
void reduce()
Sum values of a locally replicated multivector across all processes.
void dot(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< Scalar > &dots) const
Compute dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i]).
void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
Teuchos::ArrayRCP< Teuchos::ArrayRCP< Scalar > > get2dViewNonConst()
Return non-const persisting pointers to values.
std::string description() const
A simple one-line description of this object.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &ArrayOfPtrs, size_t NumVectors)
Create multivector by copying array of views of local data.
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).
Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
constexpr struct ReadOnlyStruct ReadOnly
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
virtual ~TpetraMultiVector()
Destructor (virtual for memory safety of derived classes).
void setSeed(unsigned int seed)
Set seed for Random function.
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)
Element-wise multiply of a Vector A with a TpetraMultiVector B.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Basic constuctor.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
size_t getNumVectors() const
Number of columns in the multivector.
Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
void elementWiseMultiply(Scalar scalarAB, const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarThis)
Element-wise multiply of a Vector A with a TpetraMultiVector B.
TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraMultiVectorClass
std::string description() const
A simple one-line description of this object.
void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
size_t getNumVectors() const
Number of columns in the multivector.
void setSeed(unsigned int seed)
Set seed for Random function.
void scale(const Scalar &alpha)
Scale the current values of a multi-vector, this = alpha*this.
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void endImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
void scale(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Replace multi-vector values with scaled values of A, this = alpha*A.
void replaceMap(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
virtual void Xpetra_randomize()
Set multi-vector values to random numbers. XPetra implementation.
void reduce()
Sum values of a locally replicated multivector across all processes.
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
void beginImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import data into this object using an Import object ("forward mode").
void beginExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export data into this object using an Import object ("reverse mode").
void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
void beginImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Teuchos::ArrayRCP< Scalar > get1dViewNonConst()
Nonconst persisting (1-D) view of this multivector's local values.
TpetraMultiVector()
Default constructor.
void randomize(const Scalar &minVal, const Scalar &maxVal, bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
#define XPETRA_TPETRA_ETI_EXCEPTION(cl, obj, go, node)
void endImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
void get2dCopy(Teuchos::ArrayView< const Teuchos::ArrayView< Scalar > > ArrayOfPtrs) const
Fill the given array with a copy of this multivector's local values.
void replaceGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Replace value, using global (row) index.
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import data into this object using an Import object ("forward mode").
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...
TpetraMultiVector(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Teuchos::DataAccess copyOrView)
Copy constructor (performs a deep copy).
Teuchos::ArrayRCP< Teuchos::ArrayRCP< Scalar > > get2dViewNonConst()
Return non-const persisting pointers to values.
TpetraMultiVector(const Teuchos::RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &vec)
TpetraMultiVector constructor to wrap a Tpetra::MultiVector object.
void endImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Import data into this object using an Import object ("forward mode").
void get1dCopy(Teuchos::ArrayView< Scalar > A, size_t LDA) const
Fill the given array with a copy of this multivector's local values.
void elementWiseMultiply(Scalar scalarAB, const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, Scalar scalarThis)
Element-wise multiply of a Vector A with a TpetraMultiVector B.
void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
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).
TpetraMultiVector(const Teuchos::RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &vec)
TpetraMultiVector constructor to wrap a Tpetra::MultiVector object.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Scalar &gamma)
Update multi-vector with scaled values of A and B, this = gamma*this + alpha*A + beta*B.
void abs(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
size_t getLocalLength() const
Local number of rows on the calling process.
void 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 putScalar(const Scalar &value)
Set all values in the multivector with the given value.
void endExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export data into this object using an Import object ("reverse mode").
void beginImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
void get2dCopy(Teuchos::ArrayView< const Teuchos::ArrayView< Scalar > > ArrayOfPtrs) const
Fill the given array with a copy of this multivector's local values.
Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
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 norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
std::string description() const
A simple one-line description of this object.
Teuchos::ArrayRCP< Scalar > get1dViewNonConst()
Nonconst persisting (1-D) view of this multivector's local values.
void scale(Teuchos::ArrayView< const Scalar > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
void dot(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Teuchos::ArrayView< Scalar > &dots) const
Compute dot product of each corresponding pair of vectors, dots[i] = this[i].dot(A[i]).
size_t getNumVectors() const
Number of columns in the multivector.
Teuchos::ArrayRCP< Scalar > get1dViewNonConst()
Nonconst persisting (1-D) view of this multivector's local values.
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
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 multi-vector values with scaled values of A, this = beta*this + alpha*A.
void reduce()
Sum values of a locally replicated multivector across all processes.
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
void get2dCopy(Teuchos::ArrayView< const Teuchos::ArrayView< Scalar > > ArrayOfPtrs) const
Fill the given array with a copy of this multivector's local values.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void beginExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
RCP< const Tpetra::CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > toTpetra(const RCP< const CrsGraph< LocalOrdinal, GlobalOrdinal, Node > > &graph)
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
TpetraMultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > TpetraMultiVectorClass
void scale(const Scalar &alpha)
Scale the current values of a multi-vector, this = alpha*this.
void endExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
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 beginImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
virtual ~TpetraMultiVector()
Destructor (virtual for memory safety of derived classes).
Teuchos::ArrayRCP< const Scalar > get1dView() const
Const persisting (1-D) view of this multivector's local values.
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
Teuchos::ArrayRCP< Scalar > getDataNonConst(size_t j)
View of the local values in a particular vector of this multivector.
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
#define XPETRA_DYNAMIC_CAST(type, obj, newObj, exceptionMsg)
size_t global_size_t
Global size_t object.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, size_t NumVectors, bool zeroOut=true)
Basic constuctor.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &B, const Scalar &gamma)
Update multi-vector with scaled values of A and B, this = gamma*this + alpha*A + beta*B.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void abs(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
TpetraMultiVector(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Teuchos::DataAccess copyOrView)
Copy constructor (performs a deep copy).
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, 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
The Map describing the parallel distribution of this object.
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
virtual dual_view_type::t_dev_const_um getDeviceLocalView(Access::ReadOnlyStruct) const
void get1dCopy(Teuchos::ArrayView< Scalar > A, size_t LDA) const
Fill the given array with a copy of this multivector's local values.
void get1dCopy(Teuchos::ArrayView< Scalar > A, size_t LDA) const
Fill the given array with a copy of this multivector's local values.
void 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).
global_size_t getGlobalLength() const
Global number of rows in the multivector.
virtual ~TpetraMultiVector()
Destructor (virtual for memory safety of derived classes).
constexpr struct OverwriteAllStruct OverwriteAll
void norm2(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_MultiVector() const
Get the underlying Tpetra multivector.
Teuchos::ArrayRCP< Teuchos::ArrayRCP< const Scalar > > get2dView() const
Return const persisting pointers to values.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const Teuchos::ArrayView< const Teuchos::ArrayView< const Scalar > > &ArrayOfPtrs, size_t NumVectors)
Create multivector by copying array of views of local data.
Teuchos::RCP< Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVectorNonConst(size_t j)
Return a Vector which is a nonconst view of column j.
Tpetra::KokkosCompat::KokkosSerialWrapperNode EpetraNode
void putScalar(const Scalar &value)
Set all values in the multivector with the given value.
bool isSameSize(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &vec) const
size_t getLocalLength() const
Local number of rows on the calling process.
void scale(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Replace multi-vector values with scaled values of A, this = alpha*A.
Teuchos::RCP< const Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getVector(size_t j) const
Return a Vector which is a const view of column j.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const Teuchos::ArrayView< const Scalar > &A, size_t LDA, size_t NumVectors)
Create multivector by copying two-dimensional array of local data.
void sumIntoGlobalValue(GlobalOrdinal globalRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using global (row) index.
TpetraMultiVector(const Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map, const Teuchos::ArrayView< const Scalar > &A, size_t LDA, size_t NumVectors)
Create multivector by copying two-dimensional array of local data.
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 endExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void normInf(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute Inf-norm of each vector in multi-vector.
virtual void assign(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &rhs)
Implementation of the assignment operator (operator=); does a deep copy.
void endImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void scale(Teuchos::ArrayView< const Scalar > alpha)
Scale the current values of a multi-vector, this[j] = alpha[j]*this[j].
Teuchos::ArrayRCP< const Scalar > get1dView() const
Const persisting (1-D) view of this multivector's local values.
void doExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
Export data into this object using an Import object ("reverse mode").
CombineMode
Xpetra::Combine Mode enumerable type.
void doImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
RCP< Tpetra::MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetra_MultiVector() const
Get the underlying Tpetra multivector.
void beginExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
constexpr struct ReadWriteStruct ReadWrite
#define XPETRA_MONITOR(funcName)
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 beginExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel=Teuchos::Describable::verbLevel_default) const
Print the object with the given verbosity level to a FancyOStream.
void abs(const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A)
Put element-wise absolute values of input Multi-vector in target: A = abs(this).
void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
void endExport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &dest, const Import< LocalOrdinal, GlobalOrdinal, Node > &importer, CombineMode CM)
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
void norm1(const Teuchos::ArrayView< typename Teuchos::ScalarTraits< Scalar >::magnitudeType > &norms) const
Compute 1-norm of each vector in multi-vector.
virtual dual_view_type::t_host_const_um getHostLocalView(Access::ReadOnlyStruct) const
void endImport(const DistObject< Scalar, LocalOrdinal, GlobalOrdinal, Node > &source, const Export< LocalOrdinal, GlobalOrdinal, Node > &exporter, CombineMode CM)
Teuchos::RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > getMap() const
The Map describing the parallel distribution of this object.
void randomize(bool bUseXpetraImplementation=false)
Set multi-vector values to random numbers.
Teuchos::ArrayRCP< const Scalar > getData(size_t j) const
Const view of the local values in a particular vector of this multivector.
void update(const Scalar &alpha, const MultiVector< Scalar, LocalOrdinal, GlobalOrdinal, Node > &A, const Scalar &beta)
Update multi-vector values with scaled values of A, this = beta*this + alpha*A.
void replaceLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Replace value, using local (row) index.
void sumIntoLocalValue(LocalOrdinal myRow, size_t vectorIndex, const Scalar &value)
Add value to existing value, using local (row) index.
global_size_t getGlobalLength() const
Global number of rows in the multivector.
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 replaceMap(const RCP< const Map< LocalOrdinal, GlobalOrdinal, Node > > &map)
RCP< const CrsGraph< int, GlobalOrdinal, Node > > toXpetra(const Epetra_CrsGraph &g)