46 #ifndef XPETRA_TPETRAMULTIVECTOR_DEF_HPP
47 #define XPETRA_TPETRAMULTIVECTOR_DEF_HPP
50 #include "Xpetra_TpetraMap.hpp"
52 #include "Xpetra_TpetraImport.hpp"
53 #include "Xpetra_TpetraExport.hpp"
56 #include "Tpetra_MultiVector.hpp"
57 #include "Tpetra_Vector.hpp"
58 #include "Tpetra_Details_Random.hpp"
63 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
65 : vec_(Teuchos::rcp(new Tpetra::
MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>(
toTpetra(map), NumVectors, zeroOut))) {
67 TEUCHOS_TEST_FOR_EXCEPTION(NumVectors < 1, std::invalid_argument,
"Xpetra::TpetraMultiVector(map,numVecs,zeroOut): numVecs = " << NumVectors <<
" < 1.");
71 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
74 : vec_(Teuchos::rcp(new Tpetra::
MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>(
toTpetra(source), copyOrView))) {}
77 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
80 : vec_(Teuchos::rcp(new Tpetra::
MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>(
toTpetra(map), A, LDA, NumVectors))) {
82 TEUCHOS_TEST_FOR_EXCEPTION(NumVectors < 1, std::invalid_argument,
"Xpetra::TpetraMultiVector(map,A,LDA,numVecs): numVecs = " << NumVectors <<
" < 1.");
86 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
89 : vec_(Teuchos::rcp(new Tpetra::
MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node>(
toTpetra(map), ArrayOfPtrs, NumVectors))) {
91 TEUCHOS_TEST_FOR_EXCEPTION(NumVectors < 1, std::invalid_argument,
"Xpetra::TpetraMultiVector(map,ArrayOfPtrs,numVecs): numVecs = " << NumVectors <<
" < 1.");
95 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
100 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
104 vec_->replaceGlobalValue(globalRow, vectorIndex, value);
108 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
112 vec_->sumIntoGlobalValue(globalRow, vectorIndex, value);
116 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
120 vec_->replaceLocalValue(myRow, vectorIndex, value);
124 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
128 vec_->sumIntoLocalValue(myRow, vectorIndex, value);
132 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
136 vec_->putScalar(value);
140 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
147 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
148 Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
152 return toXpetra(vec_->getVector(j));
156 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
157 Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
161 return toXpetra(vec_->getVectorNonConst(j));
165 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
166 Teuchos::ArrayRCP<const Scalar>
170 return vec_->getData(j);
174 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
175 Teuchos::ArrayRCP<Scalar>
179 return vec_->getDataNonConst(j);
183 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
185 get1dCopy(Teuchos::ArrayView<Scalar> A,
size_t LDA)
const {
187 vec_->get1dCopy(A, LDA);
191 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
193 get2dCopy(Teuchos::ArrayView<
const Teuchos::ArrayView<Scalar> > ArrayOfPtrs)
const {
195 vec_->get2dCopy(ArrayOfPtrs);
199 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
200 Teuchos::ArrayRCP<const Scalar>
204 return vec_->get1dView();
208 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
209 Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> >
213 return vec_->get2dView();
217 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
218 Teuchos::ArrayRCP<Scalar>
222 return vec_->get1dViewNonConst();
226 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
227 Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> >
231 return vec_->get2dViewNonConst();
235 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
243 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
251 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
259 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
267 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
269 scale(Teuchos::ArrayView<const Scalar> alpha) {
275 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
283 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
287 vec_->update(alpha,
toTpetra(A), beta);
291 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
293 update(
const Scalar &alpha,
const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &A,
const Scalar &beta,
const MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> &B,
const Scalar &gamma) {
299 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
301 norm1(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {
307 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
309 norm2(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {
315 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
317 normInf(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {
319 vec_->normInf(norms);
323 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
325 meanValue(
const Teuchos::ArrayView<Scalar> &means)
const {
327 vec_->meanValue(means);
331 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
333 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) {
339 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
343 return vec_->getNumVectors();
347 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
351 return vec_->getLocalLength();
355 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
359 return vec_->getGlobalLength();
363 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
367 return vec_->isSameSize(
toTpetra(vec));
371 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
375 return vec_->description();
379 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
381 describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel)
const {
383 vec_->describe(out, verbLevel);
387 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
392 if (bUseXpetraImplementation)
399 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
401 randomize(
const Scalar &minVal,
const Scalar &maxVal,
bool bUseXpetraImplementation) {
404 if (bUseXpetraImplementation)
407 vec_->randomize(minVal, maxVal);
410 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
411 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
418 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
424 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
425 this->getTpetra_MultiVector()->doImport(*v,
toTpetra(importer),
toTpetra(CM));
428 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
434 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
435 this->getTpetra_MultiVector()->beginImport(*v,
toTpetra(importer),
toTpetra(CM));
438 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
444 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
445 this->getTpetra_MultiVector()->endImport(*v,
toTpetra(importer),
toTpetra(CM));
448 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
454 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
455 this->getTpetra_MultiVector()->doExport(*v,
toTpetra(importer),
toTpetra(CM));
458 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
464 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
465 this->getTpetra_MultiVector()->beginExport(*v,
toTpetra(importer),
toTpetra(CM));
468 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
474 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
475 this->getTpetra_MultiVector()->endExport(*v,
toTpetra(importer),
toTpetra(CM));
478 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
484 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
485 this->getTpetra_MultiVector()->doImport(*v,
toTpetra(exporter),
toTpetra(CM));
488 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
494 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
495 this->getTpetra_MultiVector()->beginImport(*v,
toTpetra(exporter),
toTpetra(CM));
498 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
504 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tSource.getTpetra_MultiVector();
505 this->getTpetra_MultiVector()->endImport(*v,
toTpetra(exporter),
toTpetra(CM));
508 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
514 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
515 this->getTpetra_MultiVector()->doExport(*v,
toTpetra(exporter),
toTpetra(CM));
518 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
524 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
525 this->getTpetra_MultiVector()->beginExport(*v,
toTpetra(exporter),
toTpetra(CM));
528 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
534 RCP<const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > v = tDest.getTpetra_MultiVector();
535 this->getTpetra_MultiVector()->endExport(*v,
toTpetra(exporter),
toTpetra(CM));
538 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
542 this->getTpetra_MultiVector()->replaceMap(
toTpetra(map));
546 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
548 TpetraMultiVector(
const Teuchos::RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > &vec)
552 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
553 RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
558 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
562 Teuchos::ScalarTraits<Scalar>::seedrandom(seed);
564 Tpetra::Details::Static_Random_XorShift64_Pool<typename Node::device_type::execution_space>::resetPool(getMap()->getComm()->getRank());
567 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
574 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
581 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
588 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
595 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
602 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
611 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
615 const this_type *rhsPtr =
dynamic_cast<const this_type *
>(&rhs);
616 TEUCHOS_TEST_FOR_EXCEPTION(
617 rhsPtr == NULL, std::invalid_argument,
618 "Xpetra::MultiVector::operator=:"
619 " The left-hand side (LHS) of the assignment has a different type than "
620 "the right-hand side (RHS). The LHS has type Xpetra::TpetraMultiVector"
621 " (which means it wraps a Tpetra::MultiVector), but the RHS has some "
622 "other type. This probably means that the RHS wraps an "
623 "Epetra_MultiVector. Xpetra::MultiVector does not currently implement "
624 "assignment from an Epetra object to a Tpetra object, though this could"
625 " be added with sufficient interest.");
627 typedef Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> TMV;
628 RCP<const TMV> rhsImpl = rhsPtr->getTpetra_MultiVector();
629 RCP<TMV> lhsImpl = this->getTpetra_MultiVector();
631 TEUCHOS_TEST_FOR_EXCEPTION(
632 rhsImpl.is_null(), std::logic_error,
633 "Xpetra::MultiVector::operator= "
634 "(in Xpetra::TpetraMultiVector::assign): *this (the right-hand side of "
635 "the assignment) has a null RCP<Tpetra::MultiVector> inside. Please "
636 "report this bug to the Xpetra developers.");
637 TEUCHOS_TEST_FOR_EXCEPTION(
638 lhsImpl.is_null(), std::logic_error,
639 "Xpetra::MultiVector::operator= "
640 "(in Xpetra::TpetraMultiVector::assign): The left-hand side of the "
641 "assignment has a null RCP<Tpetra::MultiVector> inside. Please report "
642 "this bug to the Xpetra developers.");
644 Tpetra::deep_copy(*lhsImpl, *rhsImpl);
647 #ifdef HAVE_XPETRA_EPETRA
649 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_INT))) || \
650 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_INT))))
653 template <
class Scalar>
655 :
public virtual MultiVector<Scalar, int, int, EpetraNode> {
724 Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
getVector(
size_t j)
const {
return Teuchos::null; }
727 Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
getVectorNonConst(
size_t j) {
return Teuchos::null; }
730 Teuchos::ArrayRCP<const Scalar>
getData(
size_t j)
const {
return Teuchos::ArrayRCP<const Scalar>(); }
733 Teuchos::ArrayRCP<Scalar>
getDataNonConst(
size_t j) {
return Teuchos::ArrayRCP<Scalar>(); }
736 void get1dCopy(Teuchos::ArrayView<Scalar> A,
size_t LDA)
const {}
739 void get2dCopy(Teuchos::ArrayView<
const Teuchos::ArrayView<Scalar> > ArrayOfPtrs)
const {}
742 Teuchos::ArrayRCP<const Scalar>
get1dView()
const {
return Teuchos::ArrayRCP<const Scalar>(); }
745 Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> >
get2dView()
const {
return Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> >(); }
751 Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> >
get2dViewNonConst() {
return Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> >(); }
771 void scale(Teuchos::ArrayView<const Scalar> alpha) {}
780 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) {}
783 void norm1(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {}
786 void norm2(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {}
789 void normInf(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {}
792 void meanValue(
const Teuchos::ArrayView<Scalar> &means)
const {}
795 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) {}
823 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default)
const {}
831 void randomize(
bool bUseXpetraImplementation =
false) {}
834 void randomize(
const Scalar &minVal,
const Scalar &maxVal,
bool bUseXpetraImplementation =
false) {}
839 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
getMap()
const {
return Teuchos::null; }
873 TpetraMultiVector(
const Teuchos::RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > &vec) {
878 RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
getTpetra_MultiVector()
const {
return Teuchos::null; }
893 #if ((defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_OPENMP) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))) || \
894 (!defined(EPETRA_HAVE_OMP) && (!defined(HAVE_TPETRA_INST_SERIAL) || !defined(HAVE_TPETRA_INST_INT_LONG_LONG))))
897 template <
class Scalar>
899 :
public virtual MultiVector<Scalar, int, long long, EpetraNode> {
963 Teuchos::RCP<const Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
getVector(
size_t j)
const {
return Teuchos::null; }
966 Teuchos::RCP<Vector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
getVectorNonConst(
size_t j) {
return Teuchos::null; }
969 Teuchos::ArrayRCP<const Scalar>
getData(
size_t j)
const {
return Teuchos::ArrayRCP<const Scalar>(); }
972 Teuchos::ArrayRCP<Scalar>
getDataNonConst(
size_t j) {
return Teuchos::ArrayRCP<Scalar>(); }
975 void get1dCopy(Teuchos::ArrayView<Scalar> A,
size_t LDA)
const {}
978 void get2dCopy(Teuchos::ArrayView<
const Teuchos::ArrayView<Scalar> > ArrayOfPtrs)
const {}
981 Teuchos::ArrayRCP<const Scalar>
get1dView()
const {
return Teuchos::ArrayRCP<const Scalar>(); }
984 Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> >
get2dView()
const {
return Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> >(); }
990 Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> >
get2dViewNonConst() {
return Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> >(); }
1010 void scale(Teuchos::ArrayView<const Scalar> alpha) {}
1019 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) {}
1022 void norm1(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {}
1025 void norm2(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {}
1028 void normInf(
const Teuchos::ArrayView<
typename Teuchos::ScalarTraits<Scalar>::magnitudeType> &norms)
const {}
1031 void meanValue(
const Teuchos::ArrayView<Scalar> &means)
const {}
1034 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) {}
1062 void describe(Teuchos::FancyOStream &out,
const Teuchos::EVerbosityLevel verbLevel = Teuchos::Describable::verbLevel_default)
const {}
1073 void randomize(
const Scalar &minVal,
const Scalar &maxVal,
bool bUseXpetraImplementation =
false) {}
1078 Teuchos::RCP<const Map<LocalOrdinal, GlobalOrdinal, Node> >
getMap()
const {
return Teuchos::null; }
1112 TpetraMultiVector(
const Teuchos::RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> > &vec) {
1117 RCP<Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> >
getTpetra_MultiVector()
const {
return Teuchos::null; }
1131 #endif // TpetraMultiVector class (specialization GO=long long, NO=EpetraNode)
1133 #endif // HAVE_XPETRA_EPETRA
1141 #include "Xpetra_TpetraVector.hpp"
1145 template <
class Scalar,
class LocalOrdinal,
class GlobalOrdinal,
class Node>
1150 Scalar scalarThis) {
1156 XPETRA_DYNAMIC_CAST(
const tpv, A, tA,
"Xpetra::TpetraMultiVectorMatrix->multiply() only accept Xpetra::TpetraMultiVector as input arguments.");
1158 vec_->elementWiseMultiply(scalarAB, *tA.getTpetra_Vector(), *tB.getTpetra_MultiVector(), scalarThis);
1163 #define XPETRA_TPETRAMULTIVECTOR_SHORT
1164 #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)