Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_MultiVectorDefaultBase_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_MULTI_VECTOR_DEFAULT_BASE_DEF_HPP
11 #define THYRA_MULTI_VECTOR_DEFAULT_BASE_DEF_HPP
12 
13 
14 #include "Thyra_MultiVectorDefaultBase_decl.hpp"
15 #include "Thyra_LinearOpDefaultBase.hpp"
16 #include "Thyra_MultiVectorStdOps.hpp"
17 #include "Thyra_VectorSpaceFactoryBase.hpp"
18 #include "Thyra_VectorSpaceBase.hpp"
19 #include "Thyra_VectorBase.hpp"
20 #include "Thyra_AssertOp.hpp"
21 #include "Thyra_DefaultColumnwiseMultiVector.hpp"
22 #include "RTOpPack_TOpAssignScalar.hpp"
23 #include "RTOpPack_ROpDotProd.hpp"
24 #include "RTOpPack_ROpNorm1.hpp"
25 #include "RTOpPack_ROpNorm2.hpp"
26 #include "RTOpPack_ROpNormInf.hpp"
27 #include "RTOpPack_TOpAssignVectors.hpp"
28 #include "RTOpPack_TOpAXPY.hpp"
29 #include "RTOpPack_TOpLinearCombination.hpp"
30 #include "RTOpPack_TOpScaleVector.hpp"
31 #include "Teuchos_Workspace.hpp"
32 #include "Teuchos_Assert.hpp"
33 #include "Teuchos_as.hpp"
34 
35 
36 namespace Thyra {
37 
38 
39 // Overridden public member functions from MultiVectorBase
40 
41 
42 template<class Scalar>
43 RCP<MultiVectorBase<Scalar> >
45 {
47  &l_domain = *this->domain(),
48  &l_range = *this->range();
50  copy = createMembers(l_range,l_domain.dim());
51  ::Thyra::assign<Scalar>(copy.ptr(), *this);
52  return copy;
53 }
54 
55 
56 // protected
57 
58 
59 // Overridden protected member functions from MultiVectorBase
60 
61 template<class Scalar>
63 {
64  using Teuchos::tuple; using Teuchos::null;
65  RTOpPack::TOpAssignScalar<Scalar> assign_scalar_op(alpha);
66  Thyra::applyOp<Scalar>(assign_scalar_op,
68  tuple<Ptr<MultiVectorBase<Scalar> > >(ptr(this)), null);
69 }
70 
71 template<class Scalar>
73 {
74  using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
75  RTOpPack::TOpAssignVectors<Scalar> assign_vectors_op;
76  Thyra::applyOp<Scalar>(assign_vectors_op, tuple(ptrInArg(mv)),
77  tuple<Ptr<MultiVectorBase<Scalar> > >(ptr(this)), null);
78 }
79 
80 
81 template<class Scalar>
83 {
84  using Teuchos::tuple; using Teuchos::null;
85  typedef ScalarTraits<Scalar> ST;
86  if (alpha==ST::zero()) {
87  this->assign(ST::zero());
88  //assign(tuple<Ptr<MultiVectorBase<Scalar> > >(ptr(this)), ST::zero());
89  return;
90  }
91  if (alpha==ST::one()) {
92  return;
93  }
94  RTOpPack::TOpScaleVector<Scalar> scale_vector_op(alpha);
95  Thyra::applyOp<Scalar>(scale_vector_op,
97  tuple<Ptr<MultiVectorBase<Scalar> > >(ptr(this)), null );
98 }
99 
100 
101 template<class Scalar>
103  Scalar alpha,
104  const MultiVectorBase<Scalar>& mv
105  )
106 {
107  using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
108  RTOpPack::TOpAXPY<Scalar> axpy_op(alpha);
109  Thyra::applyOp<Scalar>( axpy_op, tuple(ptrInArg(mv)),
110  tuple<Ptr<MultiVectorBase<Scalar> > >(ptr(this)), null );
111 }
112 
113 
114 template<class Scalar>
116  const ArrayView<const Scalar>& alpha,
117  const ArrayView<const Ptr<const MultiVectorBase<Scalar> > >& mv,
118  const Scalar& beta
119  )
120 {
121  using Teuchos::tuple; using Teuchos::null;
122 #ifdef TEUCHOS_DEBUG
123  TEUCHOS_ASSERT_EQUALITY(alpha.size(), mv.size());
124 #endif
125  const int m = alpha.size();
126  if ( beta == ScalarTraits<Scalar>::one() && m == 1 ) {
127  this->update(alpha[0], *mv[0]);
128  return;
129  }
130  else if (m == 0) {
131  this->scale(beta);
132  return;
133  }
134  RTOpPack::TOpLinearCombination<Scalar> lin_comb_op(alpha, beta);
135  Thyra::applyOp<Scalar>(lin_comb_op, mv,
136  tuple<Ptr<MultiVectorBase<Scalar> > >(ptr(this)), null );
137 }
138 
139 
140 template<class Scalar>
142  const ArrayView<typename ScalarTraits<Scalar>::magnitudeType>& norms
143  ) const
144 {
145  using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
146  const int m = this->domain()->dim();
147  RTOpPack::ROpNorm1<Scalar> norm_op;
148  Array<RCP<RTOpPack::ReductTarget> > rcp_op_targs(m);
149  Array<Ptr<RTOpPack::ReductTarget> > op_targs(m);
150  for(int kc = 0; kc < m; ++kc) {
151  rcp_op_targs[kc] = norm_op.reduct_obj_create();
152  op_targs[kc] = rcp_op_targs[kc].ptr();
153  }
154  Thyra::applyOp<Scalar>(norm_op,
155  tuple<Ptr<const MultiVectorBase<Scalar> > >(ptrInArg(*this)),
157  op_targs);
158  for(int kc = 0; kc < m; ++kc) {
159  norms[kc] = norm_op(*op_targs[kc]);
160  }
161 }
162 
163 
164 template<class Scalar>
166  const ArrayView<typename ScalarTraits<Scalar>::magnitudeType>& norms
167  ) const
168 {
169  using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
170  const int m = this->domain()->dim();
172  Array<RCP<RTOpPack::ReductTarget> > rcp_op_targs(m);
173  Array<Ptr<RTOpPack::ReductTarget> > op_targs(m);
174  for(int kc = 0; kc < m; ++kc) {
175  rcp_op_targs[kc] = norm_op.reduct_obj_create();
176  op_targs[kc] = rcp_op_targs[kc].ptr();
177  }
178  Thyra::applyOp<Scalar>(norm_op,
179  tuple<Ptr<const MultiVectorBase<Scalar> > >(ptrInArg(*this)),
181  op_targs);
182  for(int kc = 0; kc < m; ++kc) {
183  norms[kc] = norm_op(*op_targs[kc]);
184  }
185 }
186 
187 
188 template<class Scalar>
190  const MultiVectorBase<Scalar>& mv,
191  const ArrayView<Scalar>& prods
192  ) const
193 {
194  using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
195  const int m = this->domain()->dim();
196  RTOpPack::ROpDotProd<Scalar> dot_op;
197  Array<RCP<RTOpPack::ReductTarget> > rcp_dot_targs(m);
198  Array<Ptr<RTOpPack::ReductTarget> > dot_targs(m);
199  for( int kc = 0; kc < m; ++kc ) {
200  rcp_dot_targs[kc] = dot_op.reduct_obj_create();
201  dot_targs[kc] = rcp_dot_targs[kc].ptr();
202  }
203  Thyra::applyOp<Scalar>( dot_op,
204  tuple<Ptr<const MultiVectorBase<Scalar> > >(ptrInArg(mv), ptrInArg(*this)),
206  dot_targs );
207  for( int kc = 0; kc < m; ++kc ) {
208  prods[kc] = dot_op(*dot_targs[kc]);
209  }
210 }
211 
212 
213 template<class Scalar>
215  const ArrayView<typename ScalarTraits<Scalar>::magnitudeType>& norms
216  ) const
217 {
218  using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
219  const int m = this->domain()->dim();
220  RTOpPack::ROpNormInf<Scalar> norm_op;
221  Array<RCP<RTOpPack::ReductTarget> > rcp_op_targs(m);
222  Array<Ptr<RTOpPack::ReductTarget> > op_targs(m);
223  for(int kc = 0; kc < m; ++kc) {
224  rcp_op_targs[kc] = norm_op.reduct_obj_create();
225  op_targs[kc] = rcp_op_targs[kc].ptr();
226  }
227  Thyra::applyOp<Scalar>(norm_op,
228  tuple<Ptr<const MultiVectorBase<Scalar> > >(ptrInArg(*this)),
230  op_targs);
231  for(int kc = 0; kc < m; ++kc) {
232  norms[kc] = norm_op(*op_targs[kc]);
233  }
234 }
235 
236 
237 template<class Scalar>
240 {
241  using Teuchos::Workspace;
242  using Teuchos::as;
244  const VectorSpaceBase<Scalar> &l_domain = *this->domain();
245  const VectorSpaceBase<Scalar> &l_range = *this->range();
246  const Ordinal dimDomain = l_domain.dim();
247  const Range1D colRng = Teuchos::full_range(colRng_in,0,dimDomain-1);
248  if( colRng.lbound() == 0 && as<Ordinal>(colRng.ubound()) == dimDomain-1 )
249  return Teuchos::rcp(this,false); // Takes all of the columns!
250  if( colRng.size() ) {
251  // We have to create a view of a subset of the columns
252  Workspace< RCP< VectorBase<Scalar> > > col_vecs(wss,colRng.size());
253  for( Ordinal j = colRng.lbound(); j <= colRng.ubound(); ++j )
254  col_vecs[j-colRng.lbound()] = Teuchos::rcp_const_cast<VectorBase<Scalar> >(this->col(j));
255  return Teuchos::rcp(
257  this->range(),l_range.smallVecSpcFcty()->createVecSpc(colRng.size()),col_vecs
258  )
259  );
260  }
261  return Teuchos::null; // There was an empty set in colRng_in!
262 }
263 
264 
265 template<class Scalar>
268 {
269  using Teuchos::Workspace;
270  using Teuchos::as;
272  const VectorSpaceBase<Scalar> &l_domain = *this->domain();
273  const VectorSpaceBase<Scalar> &l_range = *this->range();
274  const Ordinal dimDomain = l_domain.dim();
275  const Range1D colRng = Teuchos::full_range(colRng_in,0,dimDomain-1);
276  if( colRng.lbound() == 0 && as<Ordinal>(colRng.ubound()) == dimDomain-1 )
277  return Teuchos::rcp(this,false); // Takes all of the columns!
278  if( colRng.size() ) {
279  // We have to create a view of a subset of the columns
280  Workspace< RCP< VectorBase<Scalar> > > col_vecs(wss,colRng.size());
281  for( Ordinal j = colRng.lbound(); j <= colRng.ubound(); ++j )
282  col_vecs[j-colRng.lbound()] = this->col(j);
283  return Teuchos::rcp(
285  this->range(),l_range.smallVecSpcFcty()->createVecSpc(colRng.size()),col_vecs
286  )
287  );
288  }
289  return Teuchos::null; // There was an empty set in colRng_in!
290 }
291 
292 
293 template<class Scalar>
296  const ArrayView<const int> &cols
297  ) const
298 {
299  using Teuchos::Workspace;
301  const VectorSpaceBase<Scalar> &l_range = *this->range();
302  const int numCols = cols.size();
303 #ifdef TEUCHOS_DEBUG
304  const VectorSpaceBase<Scalar> &l_domain = *this->domain();
305  const Ordinal dimDomain = l_domain.dim();
306  const char msg_err[] = "MultiVectorDefaultBase<Scalar>::subView(numCols,cols[]): Error!";
307  TEUCHOS_TEST_FOR_EXCEPTION( numCols < 1 || dimDomain < numCols, std::invalid_argument, msg_err );
308 #endif
309  // We have to create a view of a subset of the columns
310  Workspace< RCP< VectorBase<Scalar> > > col_vecs(wss,numCols);
311  for( int k = 0; k < numCols; ++k ) {
312  const int col_k = cols[k];
313 #ifdef TEUCHOS_DEBUG
315  !( 0 <= col_k && col_k < dimDomain ), std::invalid_argument
316  ,msg_err << " col["<<k<<"] = " << col_k << " is not in the range [0,"<<(dimDomain-1)<<"]!"
317  );
318 #endif
319  col_vecs[k] = Teuchos::rcp_const_cast<VectorBase<Scalar> >(this->col(col_k));
320  }
321  return Teuchos::rcp(
323  this->range(), l_range.smallVecSpcFcty()->createVecSpc(numCols), col_vecs
324  )
325  );
326 }
327 
328 
329 template<class Scalar>
332  const ArrayView<const int> &cols
333  )
334 {
335  using Teuchos::Workspace;
337  const VectorSpaceBase<Scalar> &l_range = *this->range();
338  const int numCols = cols.size();
339 #ifdef TEUCHOS_DEBUG
340  const VectorSpaceBase<Scalar> &l_domain = *this->domain();
341  const Ordinal dimDomain = l_domain.dim();
342  const char msg_err[] = "MultiVectorDefaultBase<Scalar>::subView(numCols,cols[]): Error!";
343  TEUCHOS_TEST_FOR_EXCEPTION( numCols < 1 || dimDomain < numCols, std::invalid_argument, msg_err );
344 #endif
345  // We have to create a view of a subset of the columns
346  Workspace< RCP< VectorBase<Scalar> > > col_vecs(wss,numCols);
347  for( int k = 0; k < numCols; ++k ) {
348  const int col_k = cols[k];
349 #ifdef TEUCHOS_DEBUG
351  !( 0 <= col_k && col_k < dimDomain ), std::invalid_argument
352  ,msg_err << " col["<<k<<"] = " << col_k << " is not in the range [0,"<<(dimDomain-1)<<"]!"
353  );
354 #endif
355  col_vecs[k] = this->col(col_k);
356  }
357  return Teuchos::rcp(
359  this->range(), l_range.smallVecSpcFcty()->createVecSpc(numCols), col_vecs
360  )
361  );
362 }
363 
364 
365 template<class Scalar>
367  const RTOpPack::RTOpT<Scalar> &prim_op,
368  const ArrayView<const Ptr<const MultiVectorBase<Scalar> > > &multi_vecs,
369  const ArrayView<const Ptr<MultiVectorBase<Scalar> > > &targ_multi_vecs,
370  const ArrayView<const Ptr<RTOpPack::ReductTarget> > &reduct_objs,
371  const Ordinal prim_global_offset_in
372  ) const
373 {
374 
375  using Teuchos::Workspace;
376  using Teuchos::as;
378 
379  const int num_multi_vecs = multi_vecs.size();
380  const int num_targ_multi_vecs = targ_multi_vecs.size();
381 
382  // ToDo: Validate the input!
383 
384  const VectorSpaceBase<Scalar> &l_domain = *this->domain();
385 
386  // Get the primary and secondary dimensions.
387 
388  const Ordinal sec_dim = l_domain.dim();
389 
390  //
391  // Apply the reduction/transformation operator and transform the
392  // target vectors and reduce each of the reduction objects.
393  //
394 
395  Workspace<RCP<const VectorBase<Scalar> > > vecs_s(wss, num_multi_vecs);
396  Workspace<Ptr<const VectorBase<Scalar> > > vecs(wss, num_multi_vecs);
397  Workspace<RCP<VectorBase<Scalar> > > targ_vecs_s(wss, num_targ_multi_vecs);
398  Workspace<Ptr<VectorBase<Scalar> > > targ_vecs(wss, num_targ_multi_vecs);
399 
400  for(Ordinal j = 0; j < sec_dim; ++j) {
401  // Fill the arrays of vector arguments
402  {for(Ordinal k = 0; k < as<Ordinal>(num_multi_vecs); ++k) {
403  vecs_s[k] = multi_vecs[k]->col(j);
404  vecs[k] = vecs_s[k].ptr();
405  }}
406  {for(Ordinal k = 0; k < as<Ordinal>(num_targ_multi_vecs); ++k) {
407  targ_vecs_s[k] = targ_multi_vecs[k]->col(j);
408  targ_vecs[k] = targ_vecs_s[k].ptr();
409  }}
410  // Apply the reduction/transformation operator
411  Thyra::applyOp(
412  prim_op,
413  vecs().getConst(),
414  targ_vecs().getConst(),
415  reduct_objs.size() ? reduct_objs[j] : Ptr<RTOpPack::ReductTarget>(),
416  prim_global_offset_in);
417  }
418  // At this point all of the designated targ vectors in the target multi-vectors have
419  // been transformed and all the reduction objects in reduct_obj[] have accumulated
420  // the reductions.
421 }
422 
423 
424 template<class Scalar>
426  const RTOpPack::RTOpT<Scalar> &prim_op,
427  const RTOpPack::RTOpT<Scalar> &sec_op,
428  const ArrayView<const Ptr<const MultiVectorBase<Scalar> > > &multi_vecs,
429  const ArrayView<const Ptr<MultiVectorBase<Scalar> > > &targ_multi_vecs,
430  const Ptr<RTOpPack::ReductTarget> &reduct_obj,
431  const Ordinal prim_global_offset_in
432  ) const
433 {
434 
435  using Teuchos::Workspace;
437 
438  // ToDo: Validate the input!
439 
440  const VectorSpaceBase<Scalar> &l_domain = *this->domain();
441 
442  // Get the primary and secondary dimensions.
443  const Ordinal sec_dim = l_domain.dim();
444 
445  // Create a temporary buffer for the reduction objects of the primary reduction
446  // so that we can call the companion version of this method.
447  const int reduct_objs_size = (!is_null(reduct_obj) ? sec_dim : 0);
448  Workspace<RCP<RTOpPack::ReductTarget> > rcp_reduct_objs(wss, reduct_objs_size);
449  Workspace<Ptr<RTOpPack::ReductTarget> > reduct_objs(wss, reduct_objs_size);
450  if (!is_null(reduct_obj)) {
451  for(Ordinal k = 0; k < sec_dim; ++k) {
452  rcp_reduct_objs[k] = prim_op.reduct_obj_create();
453  reduct_objs[k] = rcp_reduct_objs[k].ptr();
454  }
455  }
456 
457  // Call the companion version that accepts an array of reduction objects
458  this->applyOp(
459  prim_op, multi_vecs, targ_multi_vecs, reduct_objs,
460  prim_global_offset_in);
461 
462  // Reduce all the reduction objects using the secondary reduction operator
463  // into one reduction object and free the intermediate reduction objects.
464  if (!is_null(reduct_obj)) {
465  for (Ordinal k = 0; k < sec_dim; ++k) {
466  sec_op.reduce_reduct_objs( *reduct_objs[k], reduct_obj );
467  }
468  }
469 }
470 
471 
472 template<class Scalar>
474  const Range1D &rowRng_in,
475  const Range1D &colRng_in,
477  ) const
478 {
479  const Ordinal
480  rangeDim = this->range()->dim(),
481  domainDim = this->domain()->dim();
482  const Range1D
483  rowRng = rowRng_in.full_range() ? Range1D(0,rangeDim-1) : rowRng_in,
484  colRng = colRng_in.full_range() ? Range1D(0,domainDim-1) : colRng_in;
485 #ifdef TEUCHOS_DEBUG
487  !(rowRng.ubound() < rangeDim), std::out_of_range
488  ,"MultiVectorDefaultBase<Scalar>::acquireDetachedMultiVectorViewImpl(...): Error, rowRng = ["
489  <<rowRng.lbound()<<","<<rowRng.ubound()<<"] is not in the range = [0,"
490  <<(rangeDim-1)<<"]!"
491  );
493  !(colRng.ubound() < domainDim), std::out_of_range
494  ,"MultiVectorDefaultBase<Scalar>::acquireDetachedMultiVectorViewImpl(...): Error, colRng = ["
495  <<colRng.lbound()<<","<<colRng.ubound()<<"] is not in the range = [0,"
496  <<(domainDim-1)<<"]!"
497  );
498 #endif
499  // Allocate storage for the multi-vector (stored column-major)
500  const ArrayRCP<Scalar> values = Teuchos::arcp<Scalar>(rowRng.size() * colRng.size());
501  // Extract multi-vector values column by column
502  RTOpPack::ConstSubVectorView<Scalar> sv; // uninitialized by default
503  for( int k = colRng.lbound(); k <= colRng.ubound(); ++k ) {
504  RCP<const VectorBase<Scalar> > col_k = this->col(k);
505  col_k->acquireDetachedView( rowRng, &sv );
506  for( int i = 0; i < rowRng.size(); ++i )
507  values[ i + k*rowRng.size() ] = sv[i];
508  col_k->releaseDetachedView( &sv );
509  }
510  // Initialize the multi-vector view object
511  sub_mv->initialize(
512  rowRng.lbound(), // globalOffset
513  rowRng.size(), // subDim
514  colRng.lbound(), // colOffset
515  colRng.size(), // numSubCols
516  values, // values
517  rowRng.size() // leadingDim
518  );
519 }
520 
521 
522 template<class Scalar>
525  ) const
526 {
527  // Here we just need to free the view and that is it!
528  sub_mv->uninitialize();
529 }
530 
531 
532 template<class Scalar>
534  const Range1D &rowRng,
535  const Range1D &colRng,
537  )
538 {
539  using Teuchos::as;
540  // Use the non-const implementation since it does exactly the
541  // correct thing in this case also!
543  rowRng, colRng,
545  // This cast will work as long as SubMultiVectorView
546  // maintains no extra state over ConstSubMultiVectorView (which it
547  // currently does not) but this is something that I should
548  // technically check for some how.
549  );
550 }
551 
552 
553 template<class Scalar>
556  )
557 {
558 #ifdef TEUCHOS_DEBUG
560  sub_mv==NULL, std::logic_error,
561  "MultiVectorDefaultBase<Scalar>::commitNonconstDetachedMultiVectorViewImpl(...): Error!"
562  );
563 #endif
564  // Set back the multi-vector values column by column
565  const Range1D rowRng(sub_mv->globalOffset(),sub_mv->globalOffset()+sub_mv->subDim()-1);
566  RTOpPack::SubVectorView<Scalar> msv; // uninitialized by default
567  for( int k = sub_mv->colOffset(); k < sub_mv->numSubCols(); ++k ) {
568  RCP<VectorBase<Scalar> > col_k = this->col(k);
569  col_k->acquireDetachedView( rowRng, &msv );
570  for( int i = 0; i < rowRng.size(); ++i )
571  msv[i] = sub_mv->values()[ i + k*rowRng.size() ];
572  col_k->commitDetachedView( &msv );
573  }
574  // Zero out the view
575  sub_mv->uninitialize();
576 }
577 
578 
579 } // end namespace Thyra
580 
581 
582 #endif // THYRA_MULTI_VECTOR_DEFAULT_BASE_DEF_HPP
virtual RCP< MultiVectorBase< Scalar > > clone_mv() const
RCP< MultiVectorBase< Scalar > > nonconstContigSubViewImpl(const Range1D &colRng)
bool is_null(const boost::shared_ptr< T > &p)
virtual void releaseDetachedMultiVectorViewImpl(RTOpPack::ConstSubMultiVectorView< Scalar > *sub_mv) const
virtual void acquireNonconstDetachedMultiVectorViewImpl(const Range1D &rowRng, const Range1D &colRng, RTOpPack::SubMultiVectorView< Scalar > *sub_mv)
virtual void assignMultiVecImpl(const MultiVectorBase< Scalar > &mv)
Default implementation of assign(MV) using RTOps.
#define TEUCHOS_TEST_FOR_EXCEPTION(throw_exception_test, Exception, msg)
RCP< const MultiVectorBase< Scalar > > contigSubViewImpl(const Range1D &colRng) const
size_type size() const
virtual void mvMultiReductApplyOpImpl(const RTOpPack::RTOpT< Scalar > &primary_op, const ArrayView< const Ptr< const MultiVectorBase< Scalar > > > &multi_vecs, const ArrayView< const Ptr< MultiVectorBase< Scalar > > > &targ_multi_vecs, const ArrayView< const Ptr< RTOpPack::ReductTarget > > &reduct_objs, const Ordinal primary_global_offset) const
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.
const ArrayRCP< Scalar > values() const
Abstract interface for objects that represent a space for vectors.
virtual void assignImpl(Scalar alpha)
Default implementation of assign(scalar) using RTOps.
Ordinal ubound() const
bool full_range() const
RCP< const MultiVectorBase< Scalar > > nonContigSubViewImpl(const ArrayView< const int > &cols) const
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.
virtual void mvSingleReductApplyOpImpl(const RTOpPack::RTOpT< Scalar > &primary_op, const RTOpPack::RTOpT< Scalar > &secondary_op, const ArrayView< const Ptr< const MultiVectorBase< Scalar > > > &multi_vecs, const ArrayView< const Ptr< MultiVectorBase< Scalar > > > &targ_multi_vecs, const Ptr< RTOpPack::ReductTarget > &reduct_obj, const Ordinal primary_global_offset) const
Ptr< T > ptr() const
virtual RCP< const VectorSpaceFactoryBase< Scalar > > smallVecSpcFcty() const =0
Return a VectorSpaceFactoryBase object for the creation of (usually serial) vector spaces with a smal...
Abstract interface for finite-dimensional dense vectors.
Default subclass for MultiVectorBase implemented using columns of separate abstract vectors...
virtual void commitNonconstDetachedMultiVectorViewImpl(RTOpPack::SubMultiVectorView< Scalar > *sub_mv)
virtual void norms1Impl(const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
Default implementation of norms_1 using RTOps.
void reduce_reduct_objs(const ReductTarget &in_reduct_obj, const Ptr< ReductTarget > &inout_reduct_obj) const
RCP< MultiVectorBase< Scalar > > nonconstNonContigSubViewImpl(const ArrayView< const int > &cols)
Teuchos::RCP< ReductTarget > reduct_obj_create() const
Ordinal lbound() const
virtual void scaleImpl(Scalar alpha)
Default implementation of scale using RTOps.
Ordinal size() const
TypeTo as(const TypeFrom &t)
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 acquireDetachedMultiVectorViewImpl(const Range1D &rowRng, const Range1D &colRng, RTOpPack::ConstSubMultiVectorView< Scalar > *sub_mv) const
#define TEUCHOS_ASSERT_EQUALITY(val1, val2)
const T & getConst(T &t)
virtual void norms2Impl(const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
Default implementation of norms_2 using RTOps.
virtual Ordinal dim() const =0
Return the dimension of the vector space.
virtual void dotsImpl(const MultiVectorBase< Scalar > &mv, const ArrayView< Scalar > &prods) const
Default implementation of dots using RTOps.
TEUCHOSCORE_LIB_DLL_EXPORT Teuchos::RCP< WorkspaceStore > get_default_workspace_store()
virtual void normsInfImpl(const ArrayView< typename ScalarTraits< Scalar >::magnitudeType > &norms) const
Default implementation of norms_inf using RTOps.
virtual void updateImpl(Scalar alpha, const MultiVectorBase< Scalar > &mv)
Default implementation of update using RTOps.
Teuchos::Range1D Range1D