本文整理汇总了C++中tpetra::MultiVector::getNumVectors方法的典型用法代码示例。如果您正苦于以下问题:C++ MultiVector::getNumVectors方法的具体用法?C++ MultiVector::getNumVectors怎么用?C++ MultiVector::getNumVectors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tpetra::MultiVector
的用法示例。
在下文中一共展示了MultiVector::getNumVectors方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply
void TpetraOperatorWrapper::apply(const Tpetra::MultiVector<ST,LO,GO,NT>& X, Tpetra::MultiVector<ST,LO,GO,NT>& Y,Teuchos::ETransp mode,ST alpha, ST beta) const
{
if (!useTranspose_)
{
// allocate space for each vector
RCP<Thyra::MultiVectorBase<ST> > tX;
RCP<Thyra::MultiVectorBase<ST> > tY;
tX = Thyra::createMembers(thyraOp_->domain(),X.getNumVectors());
tY = Thyra::createMembers(thyraOp_->range(),X.getNumVectors());
Thyra::assign(tX.ptr(),0.0);
Thyra::assign(tY.ptr(),0.0);
// copy epetra X into thyra X
mapStrategy_->copyTpetraIntoThyra(X, tX.ptr());
mapStrategy_->copyTpetraIntoThyra(Y, tY.ptr()); // if this matrix isn't block square, this probably won't work!
// perform matrix vector multiplication
thyraOp_->apply(Thyra::NOTRANS,*tX,tY.ptr(),alpha,beta);
// copy thyra Y into epetra Y
mapStrategy_->copyThyraIntoTpetra(tY, Y);
}
else
{
TEUCHOS_ASSERT(false);
}
}
示例2:
void
Chebyshev<MatrixType>::
applyMat (const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& X,
Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& Y,
Teuchos::ETransp mode) const
{
TEUCHOS_TEST_FOR_EXCEPTION(X.getNumVectors() != Y.getNumVectors(), std::runtime_error,
"Ifpack2::Chebyshev::applyMat(): X.getNumVectors() != Y.getNumVectors().");
impl_.getMatrix ()->apply (X, Y, mode);
}
示例3:
void ReorderFilter<MatrixType>::permuteOriginalToReorderedTempl(const Tpetra::MultiVector<DomainScalar,local_ordinal_type,global_ordinal_type,node_type> &originalX,
Tpetra::MultiVector<RangeScalar,local_ordinal_type,global_ordinal_type,node_type> &reorderedY) const
{
TEUCHOS_TEST_FOR_EXCEPTION(originalX.getNumVectors() != reorderedY.getNumVectors(), std::runtime_error,
"Ifpack2::ReorderFilter::permuteOriginalToReordered ERROR: X.getNumVectors() != Y.getNumVectors().");
Teuchos::ArrayRCP<Teuchos::ArrayRCP<const DomainScalar> > x_ptr = originalX.get2dView();
Teuchos::ArrayRCP<Teuchos::ArrayRCP<RangeScalar> > y_ptr = reorderedY.get2dViewNonConst();
for(size_t k=0; k < originalX.getNumVectors(); k++)
for(local_ordinal_type i=0; (size_t)i< originalX.getLocalLength(); i++)
y_ptr[k][perm_[i]] = (RangeScalar)x_ptr[k][i];
}
示例4: rcp
void Hiptmair<MatrixType>::
applyHiptmairSmoother(const Tpetra::MultiVector<typename MatrixType::scalar_type,
typename MatrixType::local_ordinal_type,
typename MatrixType::global_ordinal_type,
typename MatrixType::node_type>& X,
Tpetra::MultiVector<typename MatrixType::scalar_type,
typename MatrixType::local_ordinal_type,
typename MatrixType::global_ordinal_type,
typename MatrixType::node_type>& Y) const
{
using Teuchos::RCP;
using Teuchos::rcp;
using Teuchos::rcpFromRef;
typedef Tpetra::MultiVector<scalar_type, local_ordinal_type,
global_ordinal_type, node_type> MV;
const scalar_type ZERO = STS::zero ();
const scalar_type ONE = STS::one ();
RCP<MV> res1 = rcp (new MV (A_->getRowMap (), X.getNumVectors ()));
RCP<MV> vec1 = rcp (new MV (A_->getRowMap (), X.getNumVectors ()));
RCP<MV> res2 = rcp (new MV (PtAP_->getRowMap (), X.getNumVectors ()));
RCP<MV> vec2 = rcp (new MV (PtAP_->getRowMap (), X.getNumVectors ()));
if (preOrPost_ == "pre" || preOrPost_ == "both") {
// apply initial relaxation to primary space
A_->apply (Y, *res1);
res1->update (ONE, X, -ONE);
vec1->putScalar (ZERO);
ifpack2_prec1_->apply (*res1, *vec1);
Y.update (ONE, *vec1, ONE);
}
// project to auxiliary space and smooth
A_->apply (Y, *res1);
res1->update (ONE, X, -ONE);
P_->apply (*res1, *res2, Teuchos::TRANS);
vec2->putScalar (ZERO);
ifpack2_prec2_->apply (*res2, *vec2);
P_->apply (*vec2, *vec1, Teuchos::NO_TRANS);
Y.update (ONE,*vec1,ONE);
if (preOrPost_ == "post" || preOrPost_ == "both") {
// smooth again on primary space
A_->apply (Y, *res1);
res1->update (ONE, X, -ONE);
vec1->putScalar (ZERO);
ifpack2_prec1_->apply (*res1, *vec1);
Y.update (ONE, *vec1, ONE);
}
}
示例5:
void BorderedOperator<Scalar, LocalOrdinal, GlobalOrdinal, Node >::apply(
const Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node >& X,
Tpetra::MultiVector<Scalar, LocalOrdinal, GlobalOrdinal, Node >& Y,
Teuchos::ETransp mode,
Scalar coefAx,
Scalar coefY ) const
{
//bool opHasTrans = A_->hasTransposeApply();
//TEUCHOS_TEST_FOR_EXCEPTION( mode && !opHasTrans, std::runtime_error,
//"Ifpack2::BorderedOperator::apply() ERROR: The operator does not implement transpose.");
TEUCHOS_TEST_FOR_EXCEPTION(X.getNumVectors() != Y.getNumVectors(), std::runtime_error,
"Ifpack2::BorderedOperator::apply() ERROR: X.getNumVectors() != Y.getNumVectors().");
A_->apply(X, Y, mode, coefAx, coefY );
}
示例6: if
void ReorderFilter<MatrixType>::
apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &X,
Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type> &Y,
Teuchos::ETransp mode,
scalar_type alpha,
scalar_type beta) const
{
typedef Teuchos::ScalarTraits<scalar_type> STS;
// Note: This isn't AztecOO compliant. But neither was Ifpack's version.
// Note: The localized maps mean the matvec is trivial (and has no import)
TEUCHOS_TEST_FOR_EXCEPTION(
X.getNumVectors() != Y.getNumVectors(), std::runtime_error,
"Ifpack2::ReorderFilter::apply: X.getNumVectors() != Y.getNumVectors().");
const scalar_type zero = STS::zero ();
Teuchos::ArrayRCP<Teuchos::ArrayRCP<const scalar_type> > x_ptr = X.get2dView();
Teuchos::ArrayRCP<Teuchos::ArrayRCP<scalar_type> > y_ptr = Y.get2dViewNonConst();
Y.putScalar (zero);
const size_t NumVectors = Y.getNumVectors ();
for (size_t i = 0; i < A_->getNodeNumRows (); ++i) {
size_t Nnz;
// Use this class's getrow to make the below code simpler
getLocalRowCopy (i, Indices_ (), Values_ (), Nnz);
if (mode == Teuchos::NO_TRANS) {
for (size_t j = 0; j < Nnz; ++j) {
for (size_t k = 0; k < NumVectors; ++k) {
y_ptr[k][i] += Values_[j] * x_ptr[k][Indices_[j]];
}
}
}
else if (mode == Teuchos::TRANS) {
for (size_t j = 0; j < Nnz; ++j) {
for (size_t k = 0; k < NumVectors; ++k) {
y_ptr[k][Indices_[j]] += Values_[j] * x_ptr[k][i];
}
}
}
else { //mode==Teuchos::CONJ_TRANS
for (size_t j = 0; j < Nnz; ++j) {
for (size_t k = 0; k < NumVectors; ++k) {
y_ptr[k][Indices_[j]] += STS::conjugate(Values_[j]) * x_ptr[k][i];
}
}
}
}
}
示例7:
void SingletonFilter<MatrixType>::CreateReducedRHSTempl(const Tpetra::MultiVector<DomainScalar,LocalOrdinal,GlobalOrdinal,Node>& LHS,
const Tpetra::MultiVector<RangeScalar,LocalOrdinal,GlobalOrdinal,Node>& RHS,
Tpetra::MultiVector<RangeScalar,LocalOrdinal,GlobalOrdinal,Node>& ReducedRHS)
{
Teuchos::ArrayRCP<Teuchos::ArrayRCP<const RangeScalar > > RHS_ptr = RHS.get2dView();
Teuchos::ArrayRCP<Teuchos::ArrayRCP<const DomainScalar> > LHS_ptr = LHS.get2dView();
Teuchos::ArrayRCP<Teuchos::ArrayRCP<RangeScalar> > ReducedRHS_ptr = ReducedRHS.get2dViewNonConst();
size_t NumVectors = LHS.getNumVectors();
for (size_t i = 0 ; i < NumRows_ ; ++i)
for (size_t k = 0 ; k < NumVectors ; ++k)
ReducedRHS_ptr[k][i] = RHS_ptr[k][InvReorder_[i]];
for (size_t i = 0 ; i < NumRows_ ; ++i) {
LocalOrdinal ii = InvReorder_[i];
size_t Nnz;
A_->getLocalRowCopy(ii,Indices_(),Values_(),Nnz);
for (size_t j = 0 ; j < Nnz ; ++j) {
if (Reorder_[Indices_[j]] == -1) {
for (size_t k = 0 ; k < NumVectors ; ++k)
ReducedRHS_ptr[k][i] -= (RangeScalar)Values_[j] * (RangeScalar)LHS_ptr[k][Indices_[j]];
}
}
}
}
示例8: setMatrix
void
Chebyshev<MatrixType>::
applyMat (const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& X,
Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& Y,
Teuchos::ETransp mode) const
{
TEUCHOS_TEST_FOR_EXCEPTION(
X.getNumVectors () != Y.getNumVectors (), std::invalid_argument,
"Ifpack2::Chebyshev::applyMat: X.getNumVectors() != Y.getNumVectors().");
Teuchos::RCP<const row_matrix_type> A = impl_.getMatrix ();
TEUCHOS_TEST_FOR_EXCEPTION(
A.is_null (), std::runtime_error, "Ifpack2::Chebyshev::applyMat: The input "
"matrix A is null. Please call setMatrix() with a nonnull input matrix "
"before calling this method.");
A->apply (X, Y, mode);
}
示例9: timeMon
void
Chebyshev<MatrixType>::
apply (const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& X,
Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& Y,
Teuchos::ETransp mode,
scalar_type alpha,
scalar_type beta) const
{
{
Teuchos::TimeMonitor timeMon (*Time_);
// compute() calls initialize() if it hasn't already been called.
// Thus, we only need to check isComputed().
TEUCHOS_TEST_FOR_EXCEPTION(! isComputed(), std::runtime_error,
"Ifpack2::Chebyshev::apply(): You must call the compute() method before "
"you may call apply().");
TEUCHOS_TEST_FOR_EXCEPTION(
X.getNumVectors() != Y.getNumVectors(),
std::runtime_error,
"Ifpack2::Chebyshev::apply(): X and Y must have the same number of "
"columns. X.getNumVectors() = " << X.getNumVectors() << " != "
<< "Y.getNumVectors() = " << Y.getNumVectors() << ".");
#ifdef HAVE_TEUCHOS_DEBUG
{
// The relation 'isSameAs' is transitive. It's also a collective,
// so we don't have to do a "shared" test for exception (i.e., a
// global reduction on the test value).
TEUCHOS_TEST_FOR_EXCEPTION(
! X.getMap ()->isSameAs (*getDomainMap ()),
std::runtime_error,
"Ifpack2::Chebyshev: The domain Map of the matrix must be the same as "
"the Map of the input vector(s) X.");
TEUCHOS_TEST_FOR_EXCEPTION(
! Y.getMap ()->isSameAs (*getRangeMap ()),
std::runtime_error,
"Ifpack2::Chebyshev: The range Map of the matrix must be the same as "
"the Map of the output vector(s) Y.");
}
#endif // HAVE_TEUCHOS_DEBUG
applyImpl (X, Y, mode, alpha, beta);
}
++NumApply_;
ApplyTime_ += Time_->totalElapsedTime ();
}
示例10: if
void SingletonFilter<MatrixType>::apply(const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &X,
Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> &Y,
Teuchos::ETransp mode,
Scalar alpha,
Scalar beta) const
{
// Note: This isn't AztecOO compliant. But neither was Ifpack's version.
TEUCHOS_TEST_FOR_EXCEPTION(X.getNumVectors() != Y.getNumVectors(), std::runtime_error,
"Ifpack2::SingletonFilter::apply ERROR: X.getNumVectors() != Y.getNumVectors().");
Scalar zero = Teuchos::ScalarTraits<Scalar>::zero();
Teuchos::ArrayRCP<Teuchos::ArrayRCP<const Scalar> > x_ptr = X.get2dView();
Teuchos::ArrayRCP<Teuchos::ArrayRCP<Scalar> > y_ptr = Y.get2dViewNonConst();
Y.putScalar(zero);
size_t NumVectors = Y.getNumVectors();
for (size_t i = 0 ; i < NumRows_ ; ++i) {
size_t Nnz;
// Use this class's getrow to make the below code simpler
getLocalRowCopy(i,Indices_(),Values_(),Nnz);
if (mode==Teuchos::NO_TRANS){
for (size_t j = 0 ; j < Nnz ; ++j)
for (size_t k = 0 ; k < NumVectors ; ++k)
y_ptr[k][i] += Values_[j] * x_ptr[k][Indices_[j]];
}
else if (mode==Teuchos::TRANS){
for (size_t j = 0 ; j < Nnz ; ++j)
for (size_t k = 0 ; k < NumVectors ; ++k)
y_ptr[k][Indices_[j]] += Values_[j] * x_ptr[k][i];
}
else { //mode==Teuchos::CONJ_TRANS
for (size_t j = 0 ; j < Nnz ; ++j)
for (size_t k = 0 ; k < NumVectors ; ++k)
y_ptr[k][Indices_[j]] += Teuchos::ScalarTraits<Scalar>::conjugate(Values_[j]) * x_ptr[k][i];
}
}
}
示例11: timeMon
void
Chebyshev<MatrixType>::
apply (const Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& X,
Tpetra::MultiVector<scalar_type, local_ordinal_type, global_ordinal_type, node_type>& Y,
Teuchos::ETransp mode,
scalar_type alpha,
scalar_type beta) const
{
const std::string timerName ("Ifpack2::Chebyshev::apply");
Teuchos::RCP<Teuchos::Time> timer = Teuchos::TimeMonitor::lookupCounter (timerName);
if (timer.is_null ()) {
timer = Teuchos::TimeMonitor::getNewCounter (timerName);
}
// Start timing here.
{
Teuchos::TimeMonitor timeMon (*timer);
// compute() calls initialize() if it hasn't already been called.
// Thus, we only need to check isComputed().
TEUCHOS_TEST_FOR_EXCEPTION(
! isComputed (), std::runtime_error,
"Ifpack2::Chebyshev::apply(): You must call the compute() method before "
"you may call apply().");
TEUCHOS_TEST_FOR_EXCEPTION(
X.getNumVectors () != Y.getNumVectors (), std::runtime_error,
"Ifpack2::Chebyshev::apply(): X and Y must have the same number of "
"columns. X.getNumVectors() = " << X.getNumVectors() << " != "
<< "Y.getNumVectors() = " << Y.getNumVectors() << ".");
applyImpl (X, Y, mode, alpha, beta);
}
++NumApply_;
// timer->totalElapsedTime() returns the total time over all timer
// calls. Thus, we use = instead of +=.
ApplyTime_ = timer->totalElapsedTime ();
}
示例12: apply
void
apply(
const Tpetra::MultiVector<double,int,int> & X,
Tpetra::MultiVector<double,int,int> & Y,
Teuchos::ETransp mode = Teuchos::NO_TRANS,
double alpha = Teuchos::ScalarTraits<double>::one(),
double beta = Teuchos::ScalarTraits<double>::zero()
) const
{
for (size_t k = 0; k < Y.getNumVectors(); k++) {
const auto x_data = X.getData(k);
const auto x0_data = x0_.getData();
auto y_data = Y.getDataNonConst(k);
for (size_t i = 0; i < y_data.size(); i++) {
y_data[i] = 2 * x0_data[i] * x_data[i];
}
}
return;
}
示例13: X_tmp
void IdentitySolver<MatrixType>::
apply (const Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& X,
Tpetra::MultiVector<scalar_type,local_ordinal_type,global_ordinal_type,node_type>& Y,
Teuchos::ETransp /*mode*/,
scalar_type alpha,
scalar_type beta) const
{
using Teuchos::RCP;
typedef Teuchos::ScalarTraits<scalar_type> STS;
typedef Tpetra::MultiVector<scalar_type, local_ordinal_type,
global_ordinal_type, node_type> MV;
TEUCHOS_TEST_FOR_EXCEPTION(
! isComputed (), std::runtime_error,
"Ifpack2::IdentitySolver::apply: If compute() has not yet been called, "
"or if you have changed the matrix via setMatrix(), "
"you must call compute() before you may call this method.");
// "Identity solver" does what it says: it's the identity operator.
// We have to Export if the domain and range Maps are not the same.
// Otherwise, this operator would be a permutation, not the identity.
if (export_.is_null ()) {
Y.update (alpha, X, beta);
}
else {
if (alpha == STS::one () && beta == STS::zero ()) { // the common case
Y.doExport (X, *export_, Tpetra::REPLACE);
}
else {
// We know that the domain and range Maps are compatible. First
// bring X into the range Map via Export. Then compute in place
// in Y.
MV X_tmp (Y.getMap (), Y.getNumVectors ());
X_tmp.doExport (X, *export_, Tpetra::REPLACE);
Y.update (alpha, X_tmp, beta);
}
}
++numApply_;
}
示例14: applyTempl
void PrecPrecomputed::applyTempl(
const Tpetra::MultiVector<DomainScalar, Ordinal, Ordinal, Node>& X,
Tpetra::MultiVector<RangeScalar, Ordinal, Ordinal, Node>& Z,
Teuchos::ETransp mode,
RangeScalar alpha,
RangeScalar beta) const
{
using Teuchos::RCP;
using Teuchos::rcp;
typedef Tpetra::MultiVector<DomainScalar, Ordinal, Ordinal, Node> MV;
Teuchos::Time timer ("ILUT::apply");
{ // Timer scope for timing apply()
Teuchos::TimeMonitor timeMon (timer, true);
TEUCHOS_TEST_FOR_EXCEPTION(
! isComputed (), std::runtime_error,
"Ifpack2::ILUT::apply: You must call compute() to compute the incomplete "
"factorization, before calling apply().");
TEUCHOS_TEST_FOR_EXCEPTION(
X.getNumVectors() != Z.getNumVectors(), std::runtime_error,
"Ifpack2::ILUT::apply: X and Y must have the same number of columns. "
"X has " << X.getNumVectors () << " columns, but Y has "
<< Z.getNumVectors () << " columns.");
TEUCHOS_TEST_FOR_EXCEPTION(
beta != STS::zero (), std::logic_error,
"Ifpack2::ILUT::apply: This method does not currently work when beta != 0.");
// If X and Y are pointing to the same memory location,
// we need to create an auxiliary vector, Xcopy
RCP<const MV> Xcopy;
if (X.getLocalMV ().getValues () == Z.getLocalMV ().getValues ()) {
Xcopy = rcp (new MV (X));
}
else {
Xcopy = rcpFromRef (X);
//ZACH always taken
}
//if (mode == Teuchos::NO_TRANS) { // Solve L U Y = X
/*
L_->template localSolve<RangeScalar,DomainScalar> (*Xcopy, Y, Teuchos::NO_TRANS);
U_->template localSolve<RangeScalar,RangeScalar> (Y, Y, Teuchos::NO_TRANS);
*/
//dump(X, "##X");
//dump(*Xcopy, "##Xcopy");
//ZACH the problem is here: This actually needs to be a global triangular solve
L_->template localSolve<RangeScalar,DomainScalar> (*Xcopy, *Y_, Teuchos::NO_TRANS);
//dump(*Y_, "##Y");
U_->template localSolve<RangeScalar,RangeScalar> (*Y_, Z, Teuchos::NO_TRANS);
//U_->template localSolve<RangeScalar,RangeScalar> (*Xcopy, Z, Teuchos::NO_TRANS);
//dump(Z, "##Z");
//U_->template localSolve<RangeScalar,DomainScalar> (*Xcopy, Y, Teuchos::NO_TRANS);
//U_->template localSolve<RangeScalar,RangeScalar> (Y, Y, Teuchos::TRANS);
//}
//else { // Solve U^* L^* Y = X
/*
U_->template localSolve<RangeScalar,DomainScalar> (*Xcopy, Y, mode);
L_->template localSolve<RangeScalar,RangeScalar> (Y, Y, mode);
*/
//}
if (alpha != STS::one ()) {
Z.scale (alpha);
}
}
++NumApply_;
ApplyTime_ += timer.totalElapsedTime ();
}
示例15: timer
void Hiptmair<MatrixType>::
apply (const Tpetra::MultiVector<typename MatrixType::scalar_type,
typename MatrixType::local_ordinal_type,
typename MatrixType::global_ordinal_type,
typename MatrixType::node_type>& X,
Tpetra::MultiVector<typename MatrixType::scalar_type,
typename MatrixType::local_ordinal_type,
typename MatrixType::global_ordinal_type,
typename MatrixType::node_type>& Y,
Teuchos::ETransp mode,
typename MatrixType::scalar_type alpha,
typename MatrixType::scalar_type beta) const
{
using Teuchos::RCP;
using Teuchos::rcp;
using Teuchos::rcpFromRef;
typedef Tpetra::MultiVector<scalar_type, local_ordinal_type,
global_ordinal_type, node_type> MV;
TEUCHOS_TEST_FOR_EXCEPTION(
! isComputed (), std::runtime_error,
"Ifpack2::Hiptmair::apply: You must call compute() before you may call apply().");
TEUCHOS_TEST_FOR_EXCEPTION(
X.getNumVectors () != Y.getNumVectors (), std::invalid_argument,
"Ifpack2::Hiptmair::apply: The MultiVector inputs X and Y do not have the "
"same number of columns. X.getNumVectors() = " << X.getNumVectors ()
<< " != Y.getNumVectors() = " << Y.getNumVectors () << ".");
// Catch unimplemented cases: alpha != 1, beta != 0, mode != NO_TRANS.
TEUCHOS_TEST_FOR_EXCEPTION(
alpha != STS::one (), std::logic_error,
"Ifpack2::Hiptmair::apply: alpha != 1 has not been implemented.");
TEUCHOS_TEST_FOR_EXCEPTION(
beta != STS::zero (), std::logic_error,
"Ifpack2::Hiptmair::apply: zero != 0 has not been implemented.");
TEUCHOS_TEST_FOR_EXCEPTION(
mode != Teuchos::NO_TRANS, std::logic_error,
"Ifpack2::Hiptmair::apply: mode != Teuchos::NO_TRANS has not been implemented.");
Teuchos::Time timer ("apply");
{ // The body of code to time
Teuchos::TimeMonitor timeMon (timer);
// If X and Y are pointing to the same memory location,
// we need to create an auxiliary vector, Xcopy
RCP<const MV> Xcopy;
{
auto X_lcl_host = X.template getLocalView<Kokkos::HostSpace> ();
auto Y_lcl_host = Y.template getLocalView<Kokkos::HostSpace> ();
if (X_lcl_host.ptr_on_device () == Y_lcl_host.ptr_on_device ()) {
Xcopy = rcp (new MV (X, Teuchos::Copy));
} else {
Xcopy = rcpFromRef (X);
}
}
RCP<MV> Ycopy = rcpFromRef (Y);
if (ZeroStartingSolution_) {
Ycopy->putScalar (STS::zero ());
}
// apply Hiptmair Smoothing
applyHiptmairSmoother (*Xcopy, *Ycopy);
}
++NumApply_;
ApplyTime_ += timer.totalElapsedTime ();
}