Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_TpetraVector_def.hpp
1 // @HEADER
2 // ***********************************************************************
3 //
4 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
5 // Copyright (2004) Sandia Corporation
6 //
7 // Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive
8 // license for use of this work by or on behalf of the U.S. Government.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are
12 // met:
13 //
14 // 1. Redistributions of source code must retain the above copyright
15 // notice, this list of conditions and the following disclaimer.
16 //
17 // 2. Redistributions in binary form must reproduce the above copyright
18 // notice, this list of conditions and the following disclaimer in the
19 // documentation and/or other materials provided with the distribution.
20 //
21 // 3. Neither the name of the Corporation nor the names of the
22 // contributors may be used to endorse or promote products derived from
23 // this software without specific prior written permission.
24 //
25 // THIS SOFTWARE IS PROVIDED BY SANDIA CORPORATION "AS IS" AND ANY
26 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL SANDIA CORPORATION OR THE
29 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
30 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
31 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
32 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
33 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
34 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
35 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36 //
37 // Questions? Contact Roscoe A. Bartlett (bartlettra@ornl.gov)
38 //
39 // ***********************************************************************
40 // @HEADER
41 
42 #ifndef THYRA_TPETRA_VECTOR_HPP
43 #define THYRA_TPETRA_VECTOR_HPP
44 
45 
46 #include "Thyra_TpetraVector_decl.hpp"
47 #include "Thyra_TpetraMultiVector.hpp"
48 
49 namespace Thyra {
50 
51 
52 // Constructors/initializers/accessors
53 
54 
55 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
57 {}
58 
59 
60 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
62  const RCP<const TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVectorSpace,
64  )
65 {
66  initializeImpl(tpetraVectorSpace, tpetraVector);
67 }
68 
69 
70 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
72  const RCP<const TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVectorSpace,
74  )
75 {
76  initializeImpl(tpetraVectorSpace, tpetraVector);
77 }
78 
79 
80 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
83 {
84  return tpetraVector_.getNonconstObj();
85 }
86 
87 
88 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
91 {
92  return tpetraVector_;
93 }
94 
95 
96 // Overridden from VectorDefaultBase
97 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
100 {
101  if (domainSpace_.is_null()) {
102  domainSpace_ = tpetraVectorSpace<Scalar>(
103  Tpetra::createLocalMapWithNode<LocalOrdinal,GlobalOrdinal,Node>(
104  1,
105  tpetraVector_.getConstObj()->getMap()->getComm()
106  )
107  );
108  }
109  return domainSpace_;
110 }
111 
112 
113 // Overridden from SpmdMultiVectorBase
114 
115 
116 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
119 {
120  return tpetraVectorSpace_;
121 }
122 
123 
124 // Overridden from SpmdVectorBase
125 
126 
127 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
129  const Ptr<ArrayRCP<Scalar> > &localValues )
130 {
131  *localValues = tpetraVector_.getNonconstObj()->get1dViewNonConst();
132 }
133 
134 
135 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
137  const Ptr<ArrayRCP<const Scalar> > &localValues ) const
138 {
139  *localValues = tpetraVector_->get1dView();
140 }
141 
142 
143 // Overridden from VectorBase
144 
145 
146 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
148  Scalar l,
149  Scalar u
150  )
151 {
152  // Tpetra randomizes with different seed for each proc, so need a global
153  // reduction to get locally-replicated random vector same on each proc.
154  if (!tpetraVector_.getNonconstObj()->isDistributed()) {
155  auto comm = tpetraVector_.getNonconstObj()->getMap()->getComm();
156  if (tpetraVector_.getConstObj()->getMap()->getComm()->getRank() == 0)
157  tpetraVector_.getNonconstObj()->randomize(l, u);
158  else
159  tpetraVector_.getNonconstObj()->putScalar(Teuchos::ScalarTraits<Scalar>::zero());
160  tpetraVector_.getNonconstObj()->reduce();
161  } else {
162  tpetraVector_.getNonconstObj()->randomize(l, u);
163  }
164 }
165 
166 
167 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
169  const VectorBase<Scalar>& x
170  )
171 {
172  auto tx = this->getConstTpetraVector(Teuchos::rcpFromRef(x));
173 
174  // If the cast succeeded, call Tpetra directly.
175  // Otherwise, fall back to the RTOp implementation.
176  if (nonnull(tx)) {
177  tpetraVector_.getNonconstObj()->abs(*tx);
178  } else {
180  }
181 }
182 
183 
184 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
186  const VectorBase<Scalar>& x
187  )
188 {
189  auto tx = this->getConstTpetraVector(Teuchos::rcpFromRef(x));
190 
191  // If the cast succeeded, call Tpetra directly.
192  // Otherwise, fall back to the RTOp implementation.
193  if (nonnull(tx)) {
194  tpetraVector_.getNonconstObj()->reciprocal(*tx);
195  } else {
197  }
198 }
199 
200 
201 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
203  const VectorBase<Scalar>& x
204  )
205 {
206  auto tx = this->getConstTpetraVector(Teuchos::rcpFromRef(x));
207 
208  // If the cast succeeded, call Tpetra directly.
209  // Otherwise, fall back to the RTOp implementation.
210  if (nonnull(tx)) {
212  tpetraVector_.getNonconstObj()->elementWiseMultiply(
213  ST::one(), *tx, *tpetraVector_.getConstObj(), ST::zero());
214  } else {
216  }
217 }
218 
219 
220 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
223  const VectorBase<Scalar>& x
224  ) const
225 {
226  auto tx = this->getConstTpetraVector(Teuchos::rcpFromRef(x));
227 
228  // If the cast succeeded, call Tpetra directly.
229  // Otherwise, fall back to the RTOp implementation.
230  if (nonnull(tx)) {
231  // Weighted 2-norm function for Tpetra vector seems to be deprecated...
234  = Tpetra::createVector<Scalar>(tx->getMap());
235  temp->elementWiseMultiply(
236  ST::one(), *tx, *tpetraVector_.getConstObj(), ST::zero());
237  return ST::magnitude(ST::squareroot(tpetraVector_.getConstObj()->dot(*temp)));
238  } else {
240  }
241 }
242 
243 
244 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
246  const RTOpPack::RTOpT<Scalar> &op,
247  const ArrayView<const Ptr<const VectorBase<Scalar> > > &vecs,
248  const ArrayView<const Ptr<VectorBase<Scalar> > > &targ_vecs,
249  const Ptr<RTOpPack::ReductTarget> &reduct_obj,
250  const Ordinal global_offset
251  ) const
252 {
253  SpmdVectorDefaultBase<Scalar>::applyOpImpl(op, vecs, targ_vecs, reduct_obj, global_offset);
254 }
255 
256 
257 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
260  const Range1D& rng,
262  ) const
263 {
265 }
266 
267 
268 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
271  const Range1D& rng,
273  )
274 {
275 
277 }
278 
279 
280 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
284  )
285 {
287 }
288 
289 
290 // Overridden protected functions from MultiVectorBase
291 
292 
293 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
295 {
296  tpetraVector_.getNonconstObj()->putScalar(alpha);
297 }
298 
299 
300 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
303 {
304  auto tmv = this->getConstTpetraMultiVector(Teuchos::rcpFromRef(mv));
305 
306  // If cast succeeded, call Tpetra directly.
307  // Otherwise, fall back to the RTOp implementation.
308  if (nonnull(tmv)) {
309  tpetraVector_.getNonconstObj()->assign(*tmv);
310  } else {
312  }
313 }
314 
315 
316 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
318 {
319  tpetraVector_.getNonconstObj()->scale(alpha);
320 }
321 
322 
323 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
325  Scalar alpha,
326  const MultiVectorBase<Scalar>& mv
327  )
328 {
329  auto tmv = this->getConstTpetraMultiVector(Teuchos::rcpFromRef(mv));
330 
331  // If cast succeeded, call Tpetra directly.
332  // Otherwise, fall back to the RTOp implementation.
334  if (nonnull(tmv)) {
335  tpetraVector_.getNonconstObj()->update(alpha, *tmv, ST::one());
336  } else {
338  }
339 }
340 
341 
342 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
344  const ArrayView<const Scalar>& alpha,
345  const ArrayView<const Ptr<const MultiVectorBase<Scalar> > >& mv,
346  const Scalar& beta
347  )
348 {
349 #ifdef TEUCHOS_DEBUG
350  TEUCHOS_ASSERT_EQUALITY(alpha.size(), mv.size());
351 #endif
352 
353  // Try to cast mv to Tpetra objects
356  bool allCastsSuccessful = true;
357  {
358  auto mvIter = mv.begin();
359  auto tmvIter = tmvs.begin();
360  for (; mvIter != mv.end(); ++mvIter, ++tmvIter) {
361  tmv = this->getConstTpetraMultiVector(Teuchos::rcpFromPtr(*mvIter));
362  if (nonnull(tmv)) {
363  *tmvIter = tmv;
364  } else {
365  allCastsSuccessful = false;
366  break;
367  }
368  }
369  }
370 
371  // If casts succeeded, or input arrays are size 0, call Tpetra directly.
372  // Otherwise, fall back to the RTOp implementation.
373  auto len = mv.size();
374  if (len == 0) {
375  tpetraVector_.getNonconstObj()->scale(beta);
376  } else if (len == 1 && allCastsSuccessful) {
377  tpetraVector_.getNonconstObj()->update(alpha[0], *tmvs[0], beta);
378  } else if (len == 2 && allCastsSuccessful) {
379  tpetraVector_.getNonconstObj()->update(alpha[0], *tmvs[0], alpha[1], *tmvs[1], beta);
380  } else if (allCastsSuccessful) {
382  auto tmvIter = tmvs.begin();
383  auto alphaIter = alpha.begin();
384 
385  // Check if any entry of tmvs aliases this object's wrapped vector.
386  // If so, replace that entry in the array with a copy.
387  tmv = Teuchos::null;
388  for (; tmvIter != tmvs.end(); ++tmvIter) {
389  if (tmvIter->getRawPtr() == tpetraVector_.getConstObj().getRawPtr()) {
390  if (tmv.is_null()) {
392  *tpetraVector_.getConstObj(), Teuchos::Copy));
393  }
394  *tmvIter = tmv;
395  }
396  }
397  tmvIter = tmvs.begin();
398 
399  // We add two MVs at a time, so only scale if even num MVs,
400  // and additionally do the first addition if odd num MVs.
401  if ((tmvs.size() % 2) == 0) {
402  tpetraVector_.getNonconstObj()->scale(beta);
403  } else {
404  tpetraVector_.getNonconstObj()->update(*alphaIter, *(*tmvIter), beta);
405  ++tmvIter;
406  ++alphaIter;
407  }
408  for (; tmvIter != tmvs.end(); tmvIter+=2, alphaIter+=2) {
409  tpetraVector_.getNonconstObj()->update(
410  *alphaIter, *(*tmvIter), *(alphaIter+1), *(*(tmvIter+1)), ST::one());
411  }
412  } else {
414  }
415 }
416 
417 
418 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
420  const MultiVectorBase<Scalar>& mv,
421  const ArrayView<Scalar>& prods
422  ) const
423 {
424  auto tmv = this->getConstTpetraMultiVector(Teuchos::rcpFromRef(mv));
425 
426  // If the cast succeeded, call Tpetra directly.
427  // Otherwise, fall back to the RTOp implementation.
428  if (nonnull(tmv)) {
429  tpetraVector_.getConstObj()->dot(*tmv, prods);
430  } else {
432  }
433 }
434 
435 
436 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
438  const ArrayView<typename ScalarTraits<Scalar>::magnitudeType>& norms
439  ) const
440 {
441  tpetraVector_.getConstObj()->norm1(norms);
442 }
443 
444 
445 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
447  const ArrayView<typename ScalarTraits<Scalar>::magnitudeType>& norms
448  ) const
449 {
450  tpetraVector_.getConstObj()->norm2(norms);
451 }
452 
453 
454 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
456  const ArrayView<typename ScalarTraits<Scalar>::magnitudeType>& norms
457  ) const
458 {
459  tpetraVector_.getConstObj()->normInf(norms);
460 }
461 
462 
463 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
465  const EOpTransp M_trans,
466  const MultiVectorBase<Scalar> &X,
467  const Ptr<MultiVectorBase<Scalar> > &Y,
468  const Scalar alpha,
469  const Scalar beta
470  ) const
471 {
472  // Try to extract Tpetra objects from X and Y
474  Teuchos::RCP<const TMV> X_tpetra = this->getConstTpetraMultiVector(Teuchos::rcpFromRef(X));
475  Teuchos::RCP<TMV> Y_tpetra = this->getTpetraMultiVector(Teuchos::rcpFromPtr(Y));
476 
477  // If the cast succeeded, call Tpetra directly.
478  // Otherwise, fall back to the default implementation.
479  if (nonnull(X_tpetra) && nonnull(Y_tpetra)) {
481  TEUCHOS_TEST_FOR_EXCEPTION(ST::isComplex && (M_trans == CONJ),
482  std::logic_error,
483  "Error, conjugation without transposition is not allowed for complex scalar types!");
484 
486  switch (M_trans) {
487  case NOTRANS:
488  trans = Teuchos::NO_TRANS;
489  break;
490  case CONJ:
491  trans = Teuchos::NO_TRANS;
492  break;
493  case TRANS:
494  trans = Teuchos::TRANS;
495  break;
496  case CONJTRANS:
497  trans = Teuchos::CONJ_TRANS;
498  break;
499  }
500 
501  Y_tpetra->multiply(trans, Teuchos::NO_TRANS, alpha, *tpetraVector_.getConstObj(), *X_tpetra, beta);
502  Kokkos::fence();
503  } else {
504  VectorDefaultBase<Scalar>::applyImpl(M_trans, X, Y, alpha, beta);
505  }
506 
507 }
508 
509 
510 // private
511 
512 
513 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
514 template<class TpetraVector_t>
516  const RCP<const TpetraVectorSpace<Scalar,LocalOrdinal,GlobalOrdinal,Node> > &tpetraVectorSpace,
517  const RCP<TpetraVector_t> &tpetraVector
518  )
519 {
520 #ifdef TEUCHOS_DEBUG
521  TEUCHOS_ASSERT(nonnull(tpetraVectorSpace));
522  TEUCHOS_ASSERT(nonnull(tpetraVector));
523 #endif
524  tpetraVectorSpace_ = tpetraVectorSpace;
525  tpetraVector_.initialize(tpetraVector);
526  this->updateSpmdSpace();
527 }
528 
529 
530 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
531 RCP<Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
532 TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::
533 getTpetraMultiVector(const RCP<MultiVectorBase<Scalar> >& mv) const
534 {
535  using Teuchos::rcp_dynamic_cast;
536  typedef TpetraMultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> TMV;
537  typedef TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> TV;
538 
539  RCP<TMV> tmv = rcp_dynamic_cast<TMV>(mv);
540  if (nonnull(tmv)) {
541  return tmv->getTpetraMultiVector();
542  }
543 
544  RCP<TV> tv = rcp_dynamic_cast<TV>(mv);
545  if (nonnull(tv)) {
546  return tv->getTpetraVector();
547  }
548 
549  return Teuchos::null;
550 }
551 
552 
553 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
554 RCP<const Tpetra::MultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
555 TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node>::
556 getConstTpetraMultiVector(const RCP<const MultiVectorBase<Scalar> >& mv) const
557 {
558  using Teuchos::rcp_dynamic_cast;
559  typedef TpetraMultiVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> TMV;
560  typedef TpetraVector<Scalar,LocalOrdinal,GlobalOrdinal,Node> TV;
561 
562  RCP<const TMV> tmv = rcp_dynamic_cast<const TMV>(mv);
563  if (nonnull(tmv)) {
564  return tmv->getConstTpetraMultiVector();
565  }
566 
567  RCP<const TV> tv = rcp_dynamic_cast<const TV>(mv);
568  if (nonnull(tv)) {
569  return tv->getConstTpetraVector();
570  }
571 
572  return Teuchos::null;
573 }
574 
575 
576 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
577 RCP<Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
579 getTpetraVector(const RCP<VectorBase<Scalar> >& v) const
580 {
581  typedef TpetraVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> TV;
582  RCP<TV> tv = Teuchos::rcp_dynamic_cast<TV>(v);
583  if (nonnull(tv)) {
584  return tv->getTpetraVector();
585  } else {
586  return Teuchos::null;
587  }
588 }
589 
590 
591 template <class Scalar, class LocalOrdinal, class GlobalOrdinal, class Node>
592 RCP<const Tpetra::Vector<Scalar,LocalOrdinal,GlobalOrdinal,Node> >
594 getConstTpetraVector(const RCP<const VectorBase<Scalar> >& v) const
595 {
596  typedef TpetraVector<Scalar, LocalOrdinal, GlobalOrdinal, Node> TV;
597  RCP<const TV> tv = Teuchos::rcp_dynamic_cast<const TV>(v);
598  if (nonnull(tv)) {
599  return tv->getConstTpetraVector();
600  } else {
601  return Teuchos::null;
602  }
603 }
604 
605 
606 } // end namespace Thyra
607 
608 
609 #endif // THYRA_TPETRA_VECTOR_HPP
void constInitialize(const RCP< const TpetraVectorSpace< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraVectorSpace, const RCP< const Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraVector)
Initialize.
void applyOpImpl(const RTOpPack::RTOpT< Scalar > &op, const ArrayView< const Ptr< const VectorBase< Scalar > > > &vecs, const ArrayView< const Ptr< VectorBase< Scalar > > > &targ_vecs, const Ptr< RTOpPack::ReductTarget > &reduct_obj, const Ordinal global_offset) const
Calls applyOpImplWithComm(null,op,...).
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
Concrete implementation of an SPMD vector space for Tpetra.
void commitNonconstDetachedVectorViewImpl(RTOpPack::SubVectorView< Scalar > *sub_vec)
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
void acquireDetachedVectorViewImpl(const Range1D &rng, RTOpPack::ConstSubVectorView< Scalar > *sub_vec) const
Implemented through this-&gt;getLocalData()
void initialize(const RCP< const TpetraVectorSpace< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraVectorSpace, const RCP< Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > &tpetraVector)
Initialize.
iterator begin() const
TpetraVector()
Construct to uninitialized.
virtual void assignMultiVecImpl(const MultiVectorBase< Scalar > &mv)
Default implementation of assign(MV) using RTOps.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
virtual void norms1Impl(const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
Use the non-transposed operator.
virtual void applyOpImpl(const RTOpPack::RTOpT< Scalar > &op, const ArrayView< const Ptr< const VectorBase< Scalar > > > &vecs, const ArrayView< const Ptr< VectorBase< Scalar > > > &targ_vecs, const Ptr< RTOpPack::ReductTarget > &reduct_obj, const Ordinal global_offset) const
size_type size() const
virtual void eleWiseScaleImpl(const VectorBase< Scalar > &x)
Default implementation of ele_wise_scale using RTOps.
virtual void reciprocalImpl(const VectorBase< Scalar > &x)
Default implementation of reciprocal using RTOps.
virtual void linearCombinationImpl(const ArrayView< const Scalar > &alpha, const ArrayView< const Ptr< const MultiVectorBase< Scalar > > > &mv, const Scalar &beta)
Default implementation of linear_combination using RTOps.
virtual void norms2Impl(const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
Use the transposed operator with complex-conjugate clements (same as TRANS for real scalar types)...
void getLocalVectorDataImpl(const Ptr< ArrayRCP< const Scalar > > &localValues) const
virtual void assignMultiVecImpl(const MultiVectorBase< Scalar > &mv)
virtual void absImpl(const VectorBase< Scalar > &x)
Default implementation of abs using RTOps.
Use the non-transposed operator with complex-conjugate elements (same as NOTRANS for real scalar type...
void acquireNonconstDetachedVectorViewImpl(const Range1D &rng, RTOpPack::SubVectorView< Scalar > *sub_vec)
Use the transposed operator.
RCP< const Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getConstTpetraVector() const
Get the embedded non-const Tpetra::Vector.
virtual void reciprocalImpl(const VectorBase< Scalar > &x)
void acquireDetachedVectorViewImpl(const Range1D &rng, RTOpPack::ConstSubVectorView< Scalar > *sub_vec) const
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm2WeightedImpl(const VectorBase< Scalar > &x) const
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
Interface for a collection of column vectors called a multi-vector.
virtual void linearCombinationImpl(const ArrayView< const Scalar > &alpha, const ArrayView< const Ptr< const MultiVectorBase< Scalar > > > &mv, const Scalar &beta)
virtual void absImpl(const VectorBase< Scalar > &x)
void getNonconstLocalVectorDataImpl(const Ptr< ArrayRCP< Scalar > > &localValues)
Abstract interface for finite-dimensional dense vectors.
RCP< const SpmdVectorSpaceBase< Scalar > > spmdSpaceImpl() const
Concrete Thyra::SpmdVectorBase using Tpetra::Vector.
virtual void dotsImpl(const MultiVectorBase< Scalar > &mv, const ArrayView< Scalar > &prods) const
RCP< Tpetra::Vector< Scalar, LocalOrdinal, GlobalOrdinal, Node > > getTpetraVector()
Get the embedded non-const Tpetra::Vector.
void applyImpl(const EOpTransp M_trans, const MultiVectorBase< Scalar > &X, const Ptr< MultiVectorBase< Scalar > > &Y, const Scalar alpha, const Scalar beta) const
. Applies vector or its adjoint (transpose) as a linear operator.
void commitNonconstDetachedVectorViewImpl(RTOpPack::SubVectorView< Scalar > *sub_vec)
Implemented through this-&gt;commitLocalData()
bool nonnull(const boost::shared_ptr< T > &p)
virtual void assignImpl(Scalar alpha)
virtual void eleWiseScaleImpl(const VectorBase< Scalar > &x)
virtual void normsInfImpl(const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
RCP< const VectorSpaceBase< Scalar > > domain() const
virtual void randomizeImpl(Scalar l, Scalar u)
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm2WeightedImpl(const VectorBase< Scalar > &x) const
Default implementation of norm_2 (weighted) using RTOps.
virtual void updateImpl(Scalar alpha, const MultiVectorBase< Scalar > &mv)
virtual void scaleImpl(Scalar alpha)
#define TEUCHOS_ASSERT(assertion_test)
#define TEUCHOS_ASSERT_EQUALITY(val1, val2)
virtual void dotsImpl(const MultiVectorBase< Scalar > &mv, const ArrayView< Scalar > &prods) const
Default implementation of dots using RTOps.
virtual void updateImpl(Scalar alpha, const MultiVectorBase< Scalar > &mv)
Default implementation of update using RTOps.
void acquireNonconstDetachedVectorViewImpl(const Range1D &rng, RTOpPack::SubVectorView< Scalar > *sub_vec)
Implemented through this-&gt;getLocalData()