Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_VectorDefaultBase_def.hpp
1 // @HEADER
2 // *****************************************************************************
3 // Thyra: Interfaces and Support for Abstract Numerical Algorithms
4 //
5 // Copyright 2004 NTESS and the Thyra contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef THYRA_VECTOR_DEFAULT_BASE_DEF_HPP
11 #define THYRA_VECTOR_DEFAULT_BASE_DEF_HPP
12 
13 
14 // Define to make some verbose output
15 //#define THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
16 
17 
18 #include "Thyra_VectorDefaultBase_decl.hpp"
19 #include "Thyra_VectorSpaceFactoryBase.hpp"
20 #include "Thyra_VectorBase.hpp"
21 #include "Thyra_VectorStdOps.hpp"
22 #include "Thyra_MultiVectorDefaultBase.hpp"
23 #include "Thyra_AssertOp.hpp"
24 #include "Thyra_MultiVectorBase.hpp"
25 #include "Thyra_DetachedVectorView.hpp"
26 #include "RTOpPack_ROpGetSubVector.hpp"
27 #include "RTOpPack_TOpSetSubVector.hpp"
28 #include "RTOpPack_ROpNorm1.hpp"
29 #include "RTOpPack_ROpNorm2.hpp"
30 #include "RTOpPack_ROpWeightedNorm2.hpp"
31 #include "RTOpPack_ROpNormInf.hpp"
32 #include "RTOpPack_TOpAbs.hpp"
33 #include "RTOpPack_TOpAssignVectors.hpp"
34 #include "RTOpPack_TOpAXPY.hpp"
35 #include "RTOpPack_TOpEleWiseScale.hpp"
36 #include "RTOpPack_TOpLinearCombination.hpp"
37 #include "RTOpPack_TOpScaleVector.hpp"
38 #include "RTOpPack_TOpReciprocal.hpp"
39 #include "RTOpPack_TOpRandomize.hpp"
40 #include "Teuchos_Assert.hpp"
41 
42 
43 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
44 # include "Teuchos_VerboseObject.hpp"
45 # define THYRA_VECTOR_VERBOSE_OUT_STATEMENT \
46  RCP<Teuchos::FancyOStream> dbgout = Teuchos::VerboseObjectBase::getDefaultOStream()
47 #endif // THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
48 
49 
50 
51 namespace Thyra {
52 
53 
54 // Overridden from Teuchos::Describable
55 
56 
57 template<class Scalar>
59 {
60  std::ostringstream oss;
61  const RCP<const VectorSpaceBase<Scalar> > vs = this->space();
63  if(is_null(vs)) {
64  oss << "{space=NULL}";
65  }
66  else {
67  const Ordinal dim = vs->dim();
68  oss << "{dim=" << dim << "}";
69  }
70  return oss.str();
71 }
72 
73 
74 template<class Scalar>
76  Teuchos::FancyOStream &out_arg,
77  const Teuchos::EVerbosityLevel verbLevel
78  ) const
79 {
81  using Teuchos::OSTab;
82  RCP<FancyOStream> out = Teuchos::rcpFromRef(out_arg);
83  OSTab tab(out);
84  *out << this->description() << "\n";
85  if (this->space()->dim()) {
86  tab.incrTab();
87  if (verbLevel >= Teuchos::VERB_HIGH) {
88  const ConstDetachedVectorView<Scalar> dvv(*this);
89  for( Ordinal i = 0; i < dvv.subDim(); ++i )
90  *out << i << ":" << dvv[i] << std::endl;
91  }
92  }
93 }
94 
95 
96 // Overridden from LinearOpBase
97 
98 
99 template<class Scalar>
102 {
103 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
104  THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
105  *dbgout << "\nThyra::VectorDefaultBase<"
107  <<">::range() called!\n";
108 #endif
109  return this->space();
110 }
111 
112 
113 template<class Scalar>
116 {
117 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
118  THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
119  *dbgout << "\nThyra::VectorDefaultBase<"
121  <<">::domain() called!\n";
122 #endif
123  if(!domain_.get()) {
124  domain_ = range()->smallVecSpcFcty()->createVecSpc(1);
125  }
126  return domain_;
127 }
128 
129 
130 // Overridden from MultiVectorBase
131 
132 
133 template<class Scalar>
136 {
137 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
138  THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
139  *dbgout << "\nThyra::VectorDefaultBase<"
141  <<">::clone_mv() called!\n";
142 #endif
143  return this->clone_v();
144 }
145 
146 
147 // Overridden from VectorBase
148 
149 
150 template<class Scalar>
153 {
154 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
155  THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
156  *dbgout << "\nThyra::VectorDefaultBase<"
158  <<">::clone_v() called!\n";
159 #endif
160  const RCP<VectorBase<Scalar> > copy = createMember(this->space());
161  ::Thyra::assign<Scalar>(copy.ptr(), *this);
162  return copy;
163 }
164 
165 
166 // protected
167 
168 
169 template<class Scalar>
171 {
172  this->assign(static_cast<const MultiVectorBase<Scalar>& >(x));
173 }
174 
175 
176 template<class Scalar>
178 {
179  using Teuchos::tuple; using Teuchos::null;
180  RTOpPack::TOpRandomize<Scalar> random_vector_op(l,u);
181  Thyra::applyOp<Scalar>(random_vector_op,
183  tuple<Ptr<VectorBase<Scalar> > >(ptr(this)),
184  null);
185 }
186 
187 
188 template<class Scalar>
190 {
191  using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
192  RTOpPack::TOpAbs<Scalar> abs_op;
193  Thyra::applyOp<Scalar>(abs_op, tuple(ptrInArg(x)),
194  tuple<Ptr<VectorBase<Scalar> > >(ptr(this)), null);
195 }
196 
197 
198 template<class Scalar>
200 {
201  using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
202  RTOpPack::TOpReciprocal<Scalar> recip_op;
203  Thyra::applyOp<Scalar>(recip_op, tuple(ptrInArg(x)),
204  tuple<Ptr<VectorBase<Scalar> > >(ptr(this)), null);
205 }
206 
207 
208 template<class Scalar>
210 {
211  using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
213  Thyra::applyOp<Scalar>(scale_op, tuple(ptrInArg(x)),
214  tuple<Ptr<VectorBase<Scalar> > >(ptr(this)), null);
215 }
216 
217 
218 template<class Scalar>
220  Scalar alpha,
221  const VectorBase<Scalar>& x)
222 {
223  this->update(alpha, static_cast<const MultiVectorBase<Scalar>& >(x));
224 }
225 
226 
227 template<class Scalar>
229  const ArrayView<const Scalar>& alpha,
230  const ArrayView<const Ptr<const VectorBase<Scalar> > >& x,
231  const Scalar& beta
232  )
233 {
235  for (Ordinal i = 0; i < x.size(); ++i)
236  mv[i] = Teuchos::ptr_static_cast<const MultiVectorBase<Scalar> >(x[i]);
237  this->linear_combination(alpha, mv(), beta);
238 }
239 
240 
241 template<class Scalar>
243 {
244  Scalar prod;
245  this->dots(x, Teuchos::arrayView(&prod, 1));
246  return prod;
247 }
248 
249 
250 template<class Scalar>
253 {
255  this->norms_1(Teuchos::arrayView(&norm, 1));
256  return norm;
257 }
258 
259 
260 template<class Scalar>
263 {
265  this->norms_2(Teuchos::arrayView(&norm, 1));
266  return norm;
267 }
268 
269 
270 template<class Scalar>
273 {
274  using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
277  Thyra::applyOp<Scalar>(norm_op,
278  tuple(ptrInArg(x), ptrInArg<const VectorBase<Scalar> >(*this)),
280  norm_targ.ptr());
281  return norm_op(*norm_targ);
282 }
283 
284 template<class Scalar>
287 {
289  this->norms_inf(Teuchos::arrayView(&norm, 1));
290  return norm;
291 }
292 
293 
294 // Overridden protected functions from MultiVectorVectorBase
295 
296 
297 template<class Scalar>
300 {
301 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
302  THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
303  *dbgout << "\nThyra::VectorDefaultBase<"
304  <<Teuchos::ScalarTraits<Scalar>::name()<<">::nonconstColImpl(j) called!\n";
305 #endif
306 #ifdef TEUCHOS_DEBUG
307  TEUCHOS_TEST_FOR_EXCEPT( j != 0 );
308 #else
309  (void)j;
310 #endif
311  return Teuchos::rcp(this,false);
312 }
313 
314 
315 template<class Scalar>
318 {
319 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
320  THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
321  *dbgout << "\nThyra::VectorDefaultBase<"
323  <<">::contigSubViewImpl(col_rng) const called!\n";
324 #endif
325  validateColRng(col_rng);
326  return Teuchos::rcp(this,false);
327 }
328 
329 
330 template<class Scalar>
333 {
334 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
335  THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
336  *dbgout << "\nThyra::VectorDefaultBase<"
338  <<">::nonconstContigSubViewImpl(col_rng) called!\n";
339 #endif
340  validateColRng(col_rng);
341  return Teuchos::rcp(this,false);
342 }
343 
344 
345 template<class Scalar>
348  const ArrayView<const int> &cols ) const
349 {
350 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
351  THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
352  *dbgout << "\nThyra::VectorDefaultBase<"
354  <<">::nonContigSubViewImpl(cols) called!\n";
355 #endif
356  validateColIndexes(cols);
357  return Teuchos::rcp(this,false);
358 }
359 
360 
361 template<class Scalar>
364  const ArrayView<const int> &cols )
365 {
366 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
367  THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
368  *dbgout << "\nThyra::VectorDefaultBase<"
370  <<">::nonconstNonContigSubViewImpl(cols) called!\n";
371 #endif
372  validateColIndexes(cols);
373  return Teuchos::rcp(this,false);
374 }
375 
376 
377 template<class Scalar>
379  const Range1D &rowRng,
380  const Range1D &colRng,
382  ) const
383 {
384 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
385  THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
386  *dbgout << "\nThyra::VectorDefaultBase<"
388  <<">::acquireDetachedMultiVectorViewImpl() const called!\n";
389 #endif
390 #ifdef TEUCHOS_DEBUG
391  TEUCHOS_TEST_FOR_EXCEPT(sub_mv==NULL);
392 #endif
393  validateColRng(colRng);
395  this->acquireDetachedView(rowRng,&sv);
396 #ifdef TEUCHOS_DEBUG
397  TEUCHOS_TEST_FOR_EXCEPT( sv.stride() != 1 ); // Can't handle non-unit stride yet but we could
398 #endif
399  sub_mv->initialize( sv.globalOffset(), sv.subDim(), 0, 1, sv.values(), sv.subDim() );
400 }
401 
402 
403 template<class Scalar>
406  ) const
407 {
408  TEUCHOS_TEST_FOR_EXCEPT(sub_mv == 0);
409  sub_mv->uninitialize();
410 }
411 
412 
413 template<class Scalar>
415  const Range1D &rowRng,
416  const Range1D &colRng,
418  )
419 {
420 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
421  THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
422  *dbgout << "\nThyra::VectorDefaultBase<"
424  <<">::acquireNonconstDetachedMultiVectorViewImpl() called!\n";
425 #endif
426 #ifdef TEUCHOS_DEBUG
427  TEUCHOS_TEST_FOR_EXCEPT(sub_mv==NULL);
428 #endif
429  validateColRng(colRng);
431  this->acquireDetachedView(rowRng,&sv);
432 #ifdef TEUCHOS_DEBUG
433  TEUCHOS_TEST_FOR_EXCEPT( sv.stride() != 1 ); // Can't handle non-unit stride yet but we could
434 #endif
435  sub_mv->initialize( sv.globalOffset(), sv.subDim(), 0, 1, sv.values(), sv.subDim() );
436 }
437 
438 
439 template<class Scalar>
442  )
443 {
444 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
445  THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
446  *dbgout << "\nThyra::VectorDefaultBase<"
448  <<">::commitNonconstDetachedMultiVectorViewImpl() called!\n";
449 #endif
450 #ifdef TEUCHOS_DEBUG
451  TEUCHOS_TEST_FOR_EXCEPT(sub_mv==NULL);
452 #endif
454  sub_mv->globalOffset(),sub_mv->subDim(),sub_mv->values(),1);
455  this->commitDetachedView(&sv);
456  sub_mv->uninitialize();
457 }
458 
459 
460 // Overridden protected functions from VectorBase
461 
462 
463 template<class Scalar>
465  const Range1D& rng_in, RTOpPack::ConstSubVectorView<Scalar>* sub_vec_inout
466  ) const
467 {
468  using Teuchos::dyn_cast;
469  using Teuchos::tuple;
470  const Range1D rng = rng_in.full_range() ? Range1D(0,this->space()->dim()-1) : rng_in;
471 #ifdef TEUCHOS_DEBUG
473  !(rng.ubound() < this->space()->dim()), std::out_of_range
474  ,"VectorDefaultBase<Scalar>::acquireDetachedVectorViewImpl(rng,...):"
475  " Error, rng = ["<<rng.lbound()<<","<<rng.ubound()
476  <<"] is not in range = [0,"<<(this->space()->dim()-1)<<"]" );
477 #endif
478  // Initialize the operator
479  RTOpPack::ROpGetSubVector<Scalar> get_sub_vector_op(rng.lbound(),rng.ubound());
480  // Create the reduction object (another sub_vec)
482  reduct_obj = get_sub_vector_op.reduct_obj_create(); // This is really of type RTOpPack::ConstSubVectorView<Scalar>!
483  // Perform the reduction (get the sub-vector requested)
484  ::Thyra::applyOp<Scalar>(get_sub_vector_op, tuple(Teuchos::ptr<const VectorBase<Scalar> >(this))(),
485  Teuchos::null, reduct_obj.ptr());
486  // Get the sub-vector.
487  *sub_vec_inout = get_sub_vector_op(*reduct_obj);
488 }
489 
490 
491 template<class Scalar>
494  ) const
495 {
496  TEUCHOS_TEST_FOR_EXCEPT(sub_vec == 0);
497  sub_vec->uninitialize();
498 }
499 
500 
501 template<class Scalar>
503  const Range1D& rng, RTOpPack::SubVectorView<Scalar>* sub_vec_inout
504  )
505 {
506  //
507  // Here we get a copy of the data for the sub-vector that the
508  // client will modify. We must later commit these changes to the
509  // actual vector when the client calls commitDetachedView(...).
510  // Note, this implementation is very dependent on the behavior of
511  // the default implementation of constant version of
512  // VectorDefaultBase<Scalar>::acquireDetachedView(...) and the implementation of
513  // VectorDefaultBase<Scalar>::setSubVector(...)!
514  //
517  sub_vec_inout->initialize(
518  sub_vec.globalOffset(), sub_vec.subDim(),
519  Teuchos::arcp_const_cast<Scalar>(sub_vec.values()), sub_vec.stride()
520  );
521 }
522 
523 
524 template<class Scalar>
526  RTOpPack::SubVectorView<Scalar>* sub_vec_inout
527  )
528 {
529  TEUCHOS_TEST_FOR_EXCEPT(sub_vec_inout == 0);
531  sub_vec_inout->globalOffset(), sub_vec_inout->subDim()
532  ,sub_vec_inout->values(), sub_vec_inout->stride()
533  );
534  VectorDefaultBase<Scalar>::setSubVectorImpl(spc_sub_vec); // Commit the changes!
535  sub_vec_inout->uninitialize(); // Make null as promised!
536 }
537 
538 
539 template<class Scalar>
541 {
542  RTOpPack::TOpSetSubVector<Scalar> set_sub_vector_op(sub_vec);
543  ::Thyra::applyOp<Scalar>(set_sub_vector_op, Teuchos::null,
544  Teuchos::tuple(Teuchos::ptr<VectorBase<Scalar> >(this))(), Teuchos::null);
545 }
546 
547 
548 // Overridden protected functions from LinearOpBase
549 
550 
551 template<class Scalar>
553 {
555  return ( ST::isComplex ? ( M_trans==NOTRANS || M_trans==CONJTRANS ) : true );
556 }
557 
558 
559 template<class Scalar>
561  const EOpTransp M_trans,
562  const MultiVectorBase<Scalar> &X,
563  const Ptr<MultiVectorBase<Scalar> > &Y,
564  const Scalar alpha,
565  const Scalar beta
566  ) const
567 {
568 
570 
571  // Validate input
572 #ifdef TEUCHOS_DEBUG
574  "VectorDefaultBase<Scalar>::apply()", *this, M_trans, X, &*Y);
575 #endif
576 
577  const Ordinal numCols = X.domain()->dim();
578 
579  for (Ordinal col_j = 0; col_j < numCols; ++col_j) {
580 
581  // Get single column vectors
582  const RCP<const VectorBase<Scalar> > x = X.col(col_j);
583  const RCP<VectorBase<Scalar> > y = Y->col(col_j);
584 
585  // Here M = m (where m is a column vector)
586  if( M_trans == NOTRANS || (M_trans == CONJ && !ST::isComplex) ) {
587  // y = beta*y + alpha*m*x (x is a scalar!)
588 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
589  THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
590  *dbgout << "\nThyra::VectorDefaultBase<"
592  <<">::apply(...) : y = beta*y + alpha*m*x (x is a scalar!)\n";
593 #endif
594  Vt_S( y.ptr(), beta );
595  Vp_StV( y.ptr(), Scalar(alpha*get_ele(*x,0)), *this );
596  }
597  else if( M_trans == CONJTRANS || (M_trans == TRANS && !ST::isComplex) ) {
598  // y = beta*y + alpha*m'*x (y is a scalar!)
599 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
600  THYRA_VECTOR_VERBOSE_OUT_STATEMENT;
601  *dbgout << "\nThyra::VectorDefaultBase<"
603  <<">::apply(...) : y = beta*y + alpha*m'*x (y is a scalar!)\n";
604 #endif
605  Scalar y_inout;
606  if( beta == ST::zero() ) {
607  y_inout = ST::zero();
608  }
609  else {
610  y_inout = beta*get_ele(*y,0);
611  }
612 #if defined(THYRA_VECTOR_VERBOSE_TO_ERROR_OUT) && defined(RTOPPACK_SPMD_APPLY_OP_DUMP)
613  RTOpPack::show_spmd_apply_op_dump = true;
614 #endif
615 #if defined(THYRA_VECTOR_VERBOSE_TO_ERROR_OUT) && defined(RTOPPACK_RTOPT_HELPER_DUMP_OUTPUT)
616  RTOpPack::rtop_helpers_dump_all = true;
617 #endif
618  y_inout += alpha * this->space()->scalarProd(*this, *x);
619 #if defined(THYRA_VECTOR_VERBOSE_TO_ERROR_OUT) && defined(RTOPPACK_SPMD_APPLY_OP_DUMP)
620  RTOpPack::show_spmd_apply_op_dump = false;
621 #endif
622 #if defined(THYRA_VECTOR_VERBOSE_TO_ERROR_OUT) && defined(RTOPPACK_RTOPT_HELPER_DUMP_OUTPUT)
623  RTOpPack::rtop_helpers_dump_all = false;
624 #endif
625  set_ele(0, y_inout, y.ptr());
626 #ifdef THYRA_VECTOR_VERBOSE_TO_ERROR_OUT
627  *dbgout
628  << "\nThyra::VectorDefaultBase<"<<ST::name()<<">::apply(...) : y_inout = "
629  << y_inout << "\n";
630 #endif
631  }
632  else {
633  TEUCHOS_TEST_FOR_EXCEPTION(true, std::logic_error,
634  "VectorBase<"<<ST::name()<<">::apply(M_trans,...): Error, M_trans="
635  <<toString(M_trans)<<" not supported!" );
636  }
637 
638  }
639 
640 }
641 
642 
643 // private
644 
645 
646 template<class Scalar>
647 inline
648 void VectorDefaultBase<Scalar>::validateColRng( const Range1D &col_rng ) const
649 {
650 #ifdef TEUCHOS_DEBUG
652  !( col_rng.full_range() || ( col_rng.lbound() == 0 && col_rng.ubound() == 0) ) );
653 #else
654  (void)col_rng;
655 #endif
656 }
657 
658 
659 template<class Scalar>
660 inline
661 void VectorDefaultBase<Scalar>::validateColIndexes(
662  const ArrayView<const int>&cols ) const
663 {
664 #ifdef TEUCHOS_DEBUG
665  TEUCHOS_TEST_FOR_EXCEPT( cols.size() != 1 || cols[0] != 0 );
666 #else
667  (void)cols;
668 #endif
669 }
670 
671 
672 } // end namespace Thyra
673 
674 
675 #endif // THYRA_VECTOR_DEFAULT_BASE_DEF_HPP
ptrdiff_t stride() const
virtual Scalar dotImpl(const VectorBase< Scalar > &x) const
Default implementation of dot using RTOps.
RCP< MultiVectorBase< Scalar > > clone_mv() const
Returns this-&gt;clone_v().
virtual RCP< MultiVectorBase< Scalar > > nonconstContigSubViewImpl(const Range1D &col_rng)
Returns Teuchos::rcp(this,false).
bool is_null(const boost::shared_ptr< T > &p)
EOpTransp
Enumeration for determining how a linear operator is applied. `*.
basic_OSTab< char > OSTab
virtual void acquireDetachedMultiVectorViewImpl(const Range1D &rowRng, const Range1D &colRng, RTOpPack::ConstSubMultiVectorView< Scalar > *sub_mv) const
Implemented in terms of this-&gt;acquireDetachedView().
#define THYRA_ASSERT_LINEAR_OP_MULTIVEC_APPLY_SPACES(FUNC_NAME, M, M_T, X, Y)
This is a very useful macro that should be used to validate that the spaces for the multi-vector vers...
virtual std::string description() const
Default description that gives the label, type, and dimenstion .
virtual void describe(Teuchos::FancyOStream &out, const Teuchos::EVerbosityLevel verbLevel) const
Generates a default outputting for all vectors.
virtual void releaseDetachedVectorViewImpl(RTOpPack::ConstSubVectorView< Scalar > *sub_vec) const
basic_FancyOStream< char > FancyOStream
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
Use the non-transposed operator.
T_To & dyn_cast(T_From &from)
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm1Impl() const
Default implementation of norm_1 using RTOps.
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.
Create an explicit non-mutable (const) view of a VectorBase object.
Use the transposed operator with complex-conjugate clements (same as TRANS for real scalar types)...
const ArrayRCP< Scalar > values() const
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm2Impl() const
Default implementation of norm_2 using RTOps.
virtual void absImpl(const VectorBase< Scalar > &x)
Default implementation of abs using RTOps.
RCP< VectorBase< Scalar > > clone_v() const
Simply creates a new vector and copies the contents from *this.
static std::string name()
Use the non-transposed operator with complex-conjugate elements (same as NOTRANS for real scalar type...
Ordinal ubound() const
Use the transposed operator.
bool full_range() const
virtual RCP< const VectorSpaceBase< Scalar > > range() const
Returns this-&gt;space().
virtual RCP< const MultiVectorBase< Scalar > > nonContigSubViewImpl(const ArrayView< const int > &cols) const
Returns Teuchos::rcp(this,false).
const ArrayRCP< Scalar > values() const
virtual void releaseDetachedMultiVectorViewImpl(RTOpPack::ConstSubMultiVectorView< Scalar > *sub_mv) const
Implemented in terms of this-&gt;releaseDetachedView().
virtual void acquireNonconstDetachedMultiVectorViewImpl(const Range1D &rowRng, const Range1D &colRng, RTOpPack::SubMultiVectorView< Scalar > *sub_mv)
Implemented in terms of this-&gt;acquireDetachedView().
Convenient node subclass for concrete VectorBase subclasses that relies on a default MultiVectorBase ...
TEUCHOS_DEPRECATED RCP< T > rcp(T *p, Dealloc_T dealloc, bool owns_mem)
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
Interface for a collection of column vectors called a multi-vector.
Teuchos_Ordinal subDim() const
Returns the dimension of the explicit view.
Ptr< T > ptr() const
virtual RCP< VectorBase< Scalar > > nonconstColImpl(Ordinal j)
Returns Teuchos::rcp(this,false).
void initialize(Ordinal globalOffset_in, Ordinal subDim_in, Ordinal colOffset_in, Ordinal numSubCols_in, const ArrayRCP< Scalar > &values_in, Ordinal leadingDim_in)
void initialize(Ordinal globalOffset_in, Ordinal subDim_in, const ArrayRCP< Scalar > &values_in, ptrdiff_t stride_in)
RCP< const VectorBase< Scalar > > col(Ordinal j) const
Calls colImpl().
virtual std::string description() const
Abstract interface for finite-dimensional dense vectors.
TEUCHOSCORE_LIB_DLL_EXPORT std::string toString(const EVerbosityLevel verbLevel)
bool opSupportedImpl(EOpTransp M_trans) const
For complex Scalar types returns true for NOTRANS and CONJTRANS and for real types returns true for a...
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.
virtual RCP< const MultiVectorBase< Scalar > > contigSubViewImpl(const Range1D &col_rng) const
Returns Teuchos::rcp(this,false).
Ordinal globalOffset() const
virtual void assignVecImpl(const VectorBase< Scalar > &x)
Default implementation of assign(vector) using RTOps.
Teuchos::RCP< ReductTarget > reduct_obj_create() const
Ordinal lbound() const
virtual void updateVecImpl(Scalar alpha, const VectorBase< Scalar > &x)
Default implementation of update using RTOps.
virtual RCP< const VectorSpaceBase< Scalar > > domain() const =0
Return a smart pointer for the domain space for this operator.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType normInfImpl() const
Default implementation of norm_inf using RTOps.
virtual RCP< const VectorSpaceBase< Scalar > > domain() const
Returns a DefaultSerialVectorSpace object with dimension 1.
virtual Teuchos::ScalarTraits< Scalar >::magnitudeType norm2WeightedImpl(const VectorBase< Scalar > &x) const
Default implementation of norm_2 (weighted) using RTOps.
virtual void acquireDetachedVectorViewImpl(const Range1D &rng, RTOpPack::ConstSubVectorView< Scalar > *sub_vec) const
void initialize(Ordinal globalOffset_in, Ordinal subDim_in, Ordinal colOffset_in, Ordinal numSubCols_in, const ArrayRCP< const Scalar > &values_in, Ordinal leadingDim_in)
virtual void setSubVectorImpl(const RTOpPack::SparseSubVectorT< Scalar > &sub_vec)
virtual void commitNonconstDetachedMultiVectorViewImpl(RTOpPack::SubMultiVectorView< Scalar > *sub_mv)
Implemented in terms of this-&gt;commitDetachedView().
virtual void acquireNonconstDetachedVectorViewImpl(const Range1D &rng, RTOpPack::SubVectorView< Scalar > *sub_vec)
virtual void randomizeImpl(Scalar l, Scalar u)
Default implementation of randomize using RTOps.
virtual RCP< MultiVectorBase< Scalar > > nonconstNonContigSubViewImpl(const ArrayView< const int > &cols)
Returns Teuchos::rcp(this,false).
#define TEUCHOS_TEST_FOR_EXCEPT(throw_exception_test)
const ArrayRCP< const Scalar > values() const
virtual void linearCombinationVecImpl(const ArrayView< const Scalar > &alpha, const ArrayView< const Ptr< const VectorBase< Scalar > > > &x, const Scalar &beta)
Default implementation of linear_combination using RTOps.
Teuchos::Range1D Range1D
virtual void commitNonconstDetachedVectorViewImpl(RTOpPack::SubVectorView< Scalar > *sub_vec)