42 #ifndef THYRA_VECTOR_STD_OPS_HPP 43 #define THYRA_VECTOR_STD_OPS_HPP 45 #include "Thyra_VectorStdOps_decl.hpp" 46 #include "Thyra_VectorSpaceBase.hpp" 47 #include "Thyra_VectorBase.hpp" 48 #include "RTOpPack_ROpDotProd.hpp" 49 #include "RTOpPack_ROpGetElement.hpp" 50 #include "RTOpPack_TOpSetElement.hpp" 51 #include "RTOpPack_ROpMin.hpp" 52 #include "RTOpPack_ROpMinIndex.hpp" 53 #include "RTOpPack_ROpMinIndexGreaterThanBound.hpp" 54 #include "RTOpPack_ROpMax.hpp" 55 #include "RTOpPack_ROpMaxIndex.hpp" 56 #include "RTOpPack_ROpMaxIndexLessThanBound.hpp" 57 #include "RTOpPack_ROpNorm1.hpp" 58 #include "RTOpPack_ROpNorm2.hpp" 59 #include "RTOpPack_ROpNormInf.hpp" 60 #include "RTOpPack_ROpSum.hpp" 61 #include "RTOpPack_ROpWeightedNorm2.hpp" 62 #include "RTOpPack_TOpAbs.hpp" 63 #include "RTOpPack_TOpAddScalar.hpp" 64 #include "RTOpPack_TOpAssignVectors.hpp" 65 #include "RTOpPack_TOpAXPY.hpp" 66 #include "RTOpPack_TOpEleWiseDivide.hpp" 67 #include "RTOpPack_TOpEleWiseProd.hpp" 68 #include "RTOpPack_TOpEleWiseConjProd.hpp" 69 #include "RTOpPack_TOpEleWiseProdUpdate.hpp" 70 #include "RTOpPack_TOpEleWiseScale.hpp" 71 #include "RTOpPack_TOpLinearCombination.hpp" 72 #include "RTOpPack_TOpScaleVector.hpp" 73 #include "RTOpPack_TOpReciprocal.hpp" 74 #include "RTOpPack_TOpRandomize.hpp" 75 #include "Teuchos_Assert.hpp" 76 #include "Teuchos_Assert.hpp" 90 template<
class Scalar>
91 Scalar Thyra::sum(
const VectorBase<Scalar>& v_rhs )
93 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
94 RTOpPack::ROpSum<Scalar> sum_op;
95 Teuchos::RCP<RTOpPack::ReductTarget> sum_targ = sum_op.reduct_obj_create();
96 applyOp<Scalar>(sum_op,
97 tuple(ptrInArg(v_rhs)),
98 ArrayView<Ptr<VectorBase<Scalar> > >(null),
100 return sum_op(*sum_targ);
104 template<
class Scalar>
105 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
106 Thyra::norm_1(
const VectorBase<Scalar>& v_rhs )
108 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
109 RTOpPack::ROpNorm1<Scalar> norm_1_op;
110 Teuchos::RCP<RTOpPack::ReductTarget> norm_1_targ = norm_1_op.reduct_obj_create();
111 applyOp<Scalar>(norm_1_op, tuple(ptrInArg(v_rhs)),
112 ArrayView<Ptr<VectorBase<Scalar> > >(null),
114 return norm_1_op(*norm_1_targ);
118 template<
class Scalar>
119 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
120 Thyra::norm_2(
const VectorBase<Scalar>& v_rhs )
122 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
124 Teuchos::RCP<RTOpPack::ReductTarget> norm_2_targ = norm_2_op.
reduct_obj_create();
125 applyOp<Scalar>(norm_2_op, tuple(ptrInArg(v_rhs)),
126 ArrayView<Ptr<VectorBase<Scalar> > >(null),
128 return norm_2_op(*norm_2_targ);
132 template<
class Scalar>
133 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
134 Thyra::norm_2(
const VectorBase<Scalar>& w,
const VectorBase<Scalar>& v )
136 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
138 Teuchos::RCP<RTOpPack::ReductTarget> wght_norm_2_targ = wght_norm_2_op.
reduct_obj_create();
139 applyOp<Scalar>(wght_norm_2_op, tuple(ptrInArg(w), ptrInArg(v)),
140 ArrayView<const Ptr<VectorBase<Scalar> > >(null),
141 wght_norm_2_targ.ptr());
142 return wght_norm_2_op(*wght_norm_2_targ);
146 template<
class Scalar>
147 typename Teuchos::ScalarTraits<Scalar>::magnitudeType
148 Thyra::norm_inf(
const VectorBase<Scalar>& v_rhs )
150 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
151 RTOpPack::ROpNormInf<Scalar> norm_inf_op;
152 Teuchos::RCP<RTOpPack::ReductTarget> norm_inf_targ = norm_inf_op.reduct_obj_create();
153 applyOp<Scalar>(norm_inf_op, tuple(ptrInArg(v_rhs)),
154 ArrayView<Ptr<VectorBase<Scalar> > >(null),
155 norm_inf_targ.ptr() );
156 return norm_inf_op(*norm_inf_targ);
160 template<
class Scalar>
161 Scalar Thyra::dot(
const VectorBase<Scalar>& v_rhs1,
const VectorBase<Scalar>& v_rhs2 )
163 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
164 RTOpPack::ROpDotProd<Scalar> dot_prod_op;
165 Teuchos::RCP<RTOpPack::ReductTarget>
166 dot_prod_targ = dot_prod_op.reduct_obj_create();
167 applyOp<Scalar>(dot_prod_op,
168 tuple(ptrInArg(v_rhs1), ptrInArg(v_rhs2))(),
169 ArrayView<Ptr<VectorBase<Scalar> > >(null),
172 return dot_prod_op(*dot_prod_targ);
176 template<
class Scalar>
177 Scalar Thyra::get_ele(
const VectorBase<Scalar>& v,
Ordinal i )
179 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
181 TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE(i, 0, v.space()->dim());
184 Teuchos::RCP<RTOpPack::ReductTarget> get_ele_targ = get_ele_op.reduct_obj_create();
185 applyOp<Scalar>(get_ele_op, tuple(ptrInArg(v)),
186 ArrayView<Ptr<VectorBase<Scalar> > >(null),
187 get_ele_targ.ptr() );
188 return get_ele_op(*get_ele_targ);
195 template<
class Scalar>
196 void Thyra::set_ele(
Ordinal i, Scalar alpha,
const Ptr<VectorBase<Scalar> > &v )
198 using Teuchos::tuple;
using Teuchos::null;
200 TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE(i, 0, v->space()->dim());
203 applyOp<Scalar>(set_ele_op,
204 ArrayView<Ptr<const VectorBase<Scalar> > >(null),
210 template<
class Scalar>
211 void Thyra::put_scalar(
const Scalar& alpha,
const Ptr<VectorBase<Scalar> > &v_lhs )
213 v_lhs->assign(alpha);
217 template<
class Scalar>
218 void Thyra::copy(
const VectorBase<Scalar>& v_rhs,
219 const Ptr<VectorBase<Scalar> > &v_lhs )
221 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
222 RTOpPack::TOpAssignVectors<Scalar> assign_vectors_op;
223 applyOp<Scalar>( assign_vectors_op, tuple(ptrInArg(v_rhs)), tuple(v_lhs), null );
227 template<
class Scalar>
228 void Thyra::add_scalar(
const Scalar& alpha,
const Ptr<VectorBase<Scalar> > &v_lhs )
230 using Teuchos::tuple;
using Teuchos::null;
232 applyOp<Scalar>(add_scalar_op,
233 ArrayView<Ptr<const VectorBase<Scalar> > >(null),
234 tuple(v_lhs), null );
238 template<
class Scalar>
239 void Thyra::scale(
const Scalar& alpha,
const Ptr<VectorBase<Scalar> > &v_lhs )
241 using Teuchos::tuple;
using Teuchos::null;
242 if( alpha == ScalarTraits<Scalar>::zero() ) {
243 assign(v_lhs, ScalarTraits<Scalar>::zero());
245 else if( alpha != ScalarTraits<Scalar>::one() ) {
247 applyOp<Scalar>(scale_vector_op,
248 ArrayView<Ptr<const VectorBase<Scalar> > >(null),
249 tuple(v_lhs), null );
254 template<
class Scalar>
255 void Thyra::abs(
const VectorBase<Scalar>& x,
const Ptr<VectorBase<Scalar> > &y )
257 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
258 RTOpPack::TOpAbs<Scalar> abs_op;
259 applyOp<Scalar>( abs_op, tuple(ptrInArg(x)), tuple(y), null );
263 template<
class Scalar>
264 void Thyra::reciprocal(
const VectorBase<Scalar>& x,
const Ptr<VectorBase<Scalar> > &y )
266 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
267 RTOpPack::TOpReciprocal<Scalar> recip_op;
268 applyOp<Scalar>( recip_op, tuple(ptrInArg(x)), tuple(y), null );
272 template<
class Scalar>
273 void Thyra::ele_wise_prod(
274 const Scalar& alpha,
const VectorBase<Scalar>& v_rhs1,
275 const VectorBase<Scalar>& v_rhs2,
const Ptr<VectorBase<Scalar> > &v_lhs
278 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
280 applyOp<Scalar>( ele_wise_prod_op, tuple(ptrInArg(v_rhs1),ptrInArg(v_rhs2)),
281 tuple(v_lhs), null );
285 template<
class Scalar>
286 void Thyra::ele_wise_conj_prod(
287 const Scalar& alpha,
const VectorBase<Scalar>& v_rhs1,
288 const VectorBase<Scalar>& v_rhs2,
const Ptr<VectorBase<Scalar> > &v_lhs
291 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
293 applyOp<Scalar>( ele_wise_conj_prod_op, tuple(ptrInArg(v_rhs1),ptrInArg(v_rhs2)),
294 tuple(v_lhs), null );
298 template<
class Scalar>
299 void Thyra::ele_wise_scale(
const VectorBase<Scalar>& x,
300 const Ptr<VectorBase<Scalar> > &y )
302 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
304 applyOp<Scalar>(
ele_wise_scale, tuple(ptrInArg(x)), tuple(y), null );
308 template<
class Scalar>
309 void Thyra::Vp_StVtV(
310 const Ptr<VectorBase<Scalar> > &v_lhs,
311 const Scalar& alpha,
const VectorBase<Scalar>& v_rhs1,
312 const VectorBase<Scalar>& v_rhs2
319 template<
class Scalar>
320 void Thyra::ele_wise_prod_update(
321 const Scalar& alpha,
const VectorBase<Scalar>& v_rhs1,
322 const Ptr<VectorBase<Scalar> > &v_lhs
325 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
327 applyOp<Scalar>( ele_wise_prod_update_op, tuple(ptrInArg(v_rhs1)),
328 tuple(v_lhs), null );
332 template<
class Scalar>
334 const Ptr<VectorBase<Scalar> > &v_lhs,
335 const Scalar& alpha,
const VectorBase<Scalar>& x )
341 template<
class Scalar>
342 void Thyra::ele_wise_divide(
343 const Scalar& alpha,
const VectorBase<Scalar>& v_rhs1,
344 const VectorBase<Scalar>& v_rhs2,
345 const Ptr<VectorBase<Scalar> > &v_lhs
348 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
350 applyOp<Scalar>( ele_wise_divide_op, tuple(ptrInArg(v_rhs1),ptrInArg(v_rhs2)),
351 tuple(v_lhs), null );
355 template<
class Scalar>
356 void Thyra::linear_combination(
357 const ArrayView<const Scalar> &alpha,
358 const ArrayView<
const Ptr<
const VectorBase<Scalar> > > &x,
360 const Ptr<VectorBase<Scalar> > &y
363 using Teuchos::tuple;
using Teuchos::ptr;
using Teuchos::ptrInArg;
365 const int m = x.size();
366 if( beta == Teuchos::ScalarTraits<Scalar>::one() && m == 1 ) {
367 Vp_StV( y, alpha[0], *x[0] );
375 applyOp<Scalar>( lin_comb_op, x, tuple(y), null );
379 template<
class Scalar>
380 void Thyra::seed_randomize(
unsigned int s )
386 template<
class Scalar>
387 void Thyra::randomize( Scalar l, Scalar u,
const Ptr<VectorBase<Scalar> > &v )
389 using Teuchos::tuple;
using Teuchos::null;
391 applyOp<Scalar>( random_vector_op,
392 ArrayView<Ptr<const VectorBase<Scalar> > >(null),
406 template<
class Scalar>
407 void Thyra::assign(
const Ptr<VectorBase<Scalar> > &v_lhs,
const Scalar& alpha )
413 template<
class Scalar>
414 void Thyra::assign(
const Ptr<VectorBase<Scalar> > &v_lhs,
const VectorBase<Scalar>& v_rhs )
420 template<
class Scalar>
421 void Thyra::Vp_S(
const Ptr<VectorBase<Scalar> > &v_lhs,
const Scalar& alpha )
427 template<
class Scalar>
428 void Thyra::Vt_S(
const Ptr<VectorBase<Scalar> > &v_lhs,
const Scalar& alpha )
434 template<
class Scalar>
435 void Thyra::V_StV(
const Ptr<VectorBase<Scalar> > &y,
const Scalar& alpha,
436 const VectorBase<Scalar> &x
439 using Teuchos::tuple;
using Teuchos::ptrInArg;
440 linear_combination<Scalar>( tuple<Scalar>(alpha), tuple(ptrInArg(x)),
441 ScalarTraits<Scalar>::zero(), y );
445 template<
class Scalar>
446 void Thyra::Vp_StV(
const Ptr<VectorBase<Scalar> > &v_lhs,
const Scalar& alpha,
447 const VectorBase<Scalar>& v_rhs
450 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
452 applyOp<Scalar>( axpy_op, tuple(ptrInArg(v_rhs)), tuple(v_lhs), null );
456 template<
class Scalar>
457 void Thyra::Vp_V(
const Ptr<VectorBase<Scalar> > &y,
const VectorBase<Scalar>& x,
461 using Teuchos::tuple;
using Teuchos::ptrInArg;
462 linear_combination<Scalar>(
463 tuple<Scalar>(Teuchos::ScalarTraits<Scalar>::one()),
469 template<
class Scalar>
470 void Thyra::V_V(
const Ptr<VectorBase<Scalar> > &y,
const VectorBase<Scalar>& x )
476 template<
class Scalar>
477 void Thyra::V_S(
const Ptr<VectorBase<Scalar> > &y,
const Scalar& alpha )
483 template<
class Scalar>
484 void Thyra::V_VpV(
const Ptr<VectorBase<Scalar> > &z,
const VectorBase<Scalar>& x,
485 const VectorBase<Scalar>& y
488 using Teuchos::tuple;
using Teuchos::ptrInArg;
489 typedef Teuchos::ScalarTraits<Scalar> ST;
490 linear_combination<Scalar>(
491 tuple(ST::one(),ST::one()),
492 tuple(ptrInArg(x),ptrInArg(y)),
498 template<
class Scalar>
499 void Thyra::V_VmV(
const Ptr<VectorBase<Scalar> > &z,
const VectorBase<Scalar>& x,
500 const VectorBase<Scalar>& y
503 using Teuchos::tuple;
using Teuchos::ptrInArg;
504 typedef Teuchos::ScalarTraits<Scalar> ST;
505 linear_combination<Scalar>(
506 tuple(ST::one(),Scalar(-ST::one())),
507 tuple(ptrInArg(x),ptrInArg(y)),
513 template<
class Scalar>
514 void Thyra::V_StVpV(
const Ptr<VectorBase<Scalar> > &z,
const Scalar &alpha,
515 const VectorBase<Scalar>& x,
const VectorBase<Scalar>& y
518 using Teuchos::tuple;
using Teuchos::ptrInArg;
519 typedef Teuchos::ScalarTraits<Scalar> ST;
520 linear_combination<Scalar>(
521 tuple(alpha, ST::one()), tuple(ptrInArg(x),ptrInArg(y)),
527 template<
class Scalar>
528 void Thyra::V_VpStV(
const Ptr<VectorBase<Scalar> > &z,
529 const VectorBase<Scalar>& x,
530 const Scalar &alpha,
const VectorBase<Scalar>& y )
532 using Teuchos::tuple;
using Teuchos::ptrInArg;
533 typedef Teuchos::ScalarTraits<Scalar> ST;
534 linear_combination<Scalar>(
535 tuple(ST::one(), alpha), tuple(ptrInArg(x),ptrInArg(y)),
541 template<
class Scalar>
542 void Thyra::V_StVpStV(
const Ptr<VectorBase<Scalar> > &z,
const Scalar &alpha,
543 const VectorBase<Scalar>& x,
const Scalar &beta,
const VectorBase<Scalar>& y
546 using Teuchos::tuple;
using Teuchos::ptrInArg;
547 typedef Teuchos::ScalarTraits<Scalar> ST;
548 linear_combination<Scalar>(
549 tuple(alpha, beta), tuple(ptrInArg(x),ptrInArg(y)),
560 template<
class Scalar>
561 Scalar Thyra::min(
const VectorBase<Scalar>& x ) {
562 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
563 RTOpPack::ROpMin<Scalar> min_op;
564 Teuchos::RCP<RTOpPack::ReductTarget> min_targ = min_op.reduct_obj_create();
565 applyOp<Scalar>( min_op, tuple(ptrInArg(x)),
566 ArrayView<const Ptr<VectorBase<Scalar> > >(null),
568 return min_op(*min_targ);
572 template<
class Scalar>
573 void Thyra::min(
const VectorBase<Scalar>& x,
574 const Ptr<Scalar> &minEle,
const Ptr<Ordinal> &minIndex
577 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
580 applyOp<Scalar>( min_op, tuple(ptrInArg(x)),
581 ArrayView<const Ptr<VectorBase<Scalar> > >(null),
584 *minEle = scalarIndex.scalar;
585 *minIndex = scalarIndex.index;
589 template<
class Scalar>
590 void Thyra::minGreaterThanBound(
const VectorBase<Scalar>& x,
591 const Scalar &bound,
const Ptr<Scalar> &minEle,
const Ptr<Ordinal> &minIndex
594 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
596 Teuchos::RCP<RTOpPack::ReductTarget> min_targ = min_op.reduct_obj_create();
597 applyOp<Scalar>( min_op, tuple(ptrInArg(x)),
598 ArrayView<const Ptr<VectorBase<Scalar> > >(null),
601 *minEle = scalarIndex.scalar;
602 *minIndex = scalarIndex.index;
606 template<
class Scalar>
607 Scalar Thyra::max(
const VectorBase<Scalar>& x )
609 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
610 RTOpPack::ROpMax<Scalar> max_op;
611 Teuchos::RCP<RTOpPack::ReductTarget> max_targ = max_op.reduct_obj_create();
612 applyOp<Scalar>( max_op, tuple(ptrInArg(x)),
613 ArrayView<const Ptr<VectorBase<Scalar> > >(null),
615 return max_op(*max_targ);
619 template<
class Scalar>
620 void Thyra::max(
const VectorBase<Scalar>& x,
621 const Ptr<Scalar> &maxEle,
const Ptr<Ordinal> &maxIndex
624 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
627 applyOp<Scalar>( max_op, tuple(ptrInArg(x)),
628 ArrayView<const Ptr<VectorBase<Scalar> > >(null),
631 *maxEle = scalarIndex.scalar;
632 *maxIndex = scalarIndex.index;
636 template<
class Scalar>
637 void Thyra::maxLessThanBound(
const VectorBase<Scalar>& x,
638 const Scalar &bound,
const Ptr<Scalar> &maxEle,
const Ptr<Ordinal> &maxIndex
641 using Teuchos::tuple;
using Teuchos::ptrInArg;
using Teuchos::null;
643 Teuchos::RCP<RTOpPack::ReductTarget> max_targ = max_op.reduct_obj_create();
644 applyOp<Scalar>( max_op, tuple(ptrInArg(x)),
645 ArrayView<const Ptr<VectorBase<Scalar> > >(null),
648 *maxEle = scalarIndex.scalar;
649 *maxIndex = scalarIndex.index;
658 #define THYRA_VECTOR_STD_OPS_INSTANT(SCALAR) \ 660 template SCALAR sum( const VectorBase<SCALAR >& v_rhs ); \ 662 template ScalarTraits<SCALAR >::magnitudeType \ 663 norm_1( const VectorBase<SCALAR >& v_rhs ); \ 665 template ScalarTraits<SCALAR >::magnitudeType \ 666 norm_2( const VectorBase<SCALAR >& v_rhs ); \ 668 template ScalarTraits<SCALAR >::magnitudeType \ 669 norm_2( const VectorBase<SCALAR >& w, const VectorBase<SCALAR >& v ); \ 671 template ScalarTraits<SCALAR >::magnitudeType \ 672 norm_inf( const VectorBase<SCALAR >& v_rhs ); \ 674 template SCALAR dot( const VectorBase<SCALAR >& v_rhs1, const VectorBase<SCALAR >& v_rhs2 ); \ 676 template SCALAR get_ele( const VectorBase<SCALAR >& v, Ordinal i ); \ 678 template void set_ele( Ordinal i, SCALAR alpha, const Ptr<VectorBase<SCALAR > > &v ); \ 680 template void put_scalar( const SCALAR& alpha, const Ptr<VectorBase<SCALAR > > &v_lhs ); \ 682 template void copy( const VectorBase<SCALAR >& v_rhs, \ 683 const Ptr<VectorBase<SCALAR > > &v_lhs ); \ 685 template void add_scalar( const SCALAR& alpha, const Ptr<VectorBase<SCALAR > > &v_lhs ); \ 687 template void scale( const SCALAR& alpha, const Ptr<VectorBase<SCALAR > > &v_lhs ); \ 689 template void abs( const VectorBase< SCALAR > &x, const Ptr<VectorBase< SCALAR > > &y ); \ 691 template void reciprocal( const VectorBase< SCALAR > &x, const Ptr<VectorBase< SCALAR > > &y ); \ 693 template void ele_wise_prod( \ 694 const SCALAR& alpha, const VectorBase<SCALAR >& v_rhs1, \ 695 const VectorBase<SCALAR >& v_rhs2, const Ptr<VectorBase<SCALAR > > &v_lhs \ 698 template void ele_wise_conj_prod( \ 699 const SCALAR& alpha, const VectorBase<SCALAR >& v_rhs1, \ 700 const VectorBase<SCALAR >& v_rhs2, const Ptr<VectorBase<SCALAR > > &v_lhs \ 703 template void ele_wise_scale( const VectorBase<SCALAR>& x, \ 704 const Ptr<VectorBase<SCALAR> > &y ); \ 706 template void Vp_StVtV( \ 707 const Ptr<VectorBase<SCALAR > > &v_lhs, \ 708 const SCALAR& alpha, const VectorBase<SCALAR >& v_rhs1, \ 709 const VectorBase<SCALAR >& v_rhs2 \ 712 template void ele_wise_prod_update( \ 713 const SCALAR& alpha, const VectorBase<SCALAR >& v_rhs1, \ 714 const Ptr<VectorBase<SCALAR > > &v_lhs \ 717 template void Vt_StV( \ 718 const Ptr<VectorBase<SCALAR > > &v_lhs, \ 719 const SCALAR& alpha, const VectorBase<SCALAR >& x ); \ 721 template void ele_wise_divide( \ 722 const SCALAR& alpha, const VectorBase<SCALAR >& v_rhs1, \ 723 const VectorBase<SCALAR >& v_rhs2, \ 724 const Ptr<VectorBase<SCALAR > > &v_lhs \ 727 template void linear_combination( \ 728 const ArrayView<const SCALAR > &alpha, \ 729 const ArrayView<const Ptr<const VectorBase<SCALAR > > > &x, \ 730 const SCALAR &beta, \ 731 const Ptr<VectorBase<SCALAR > > &y \ 734 template void seed_randomize<SCALAR >( unsigned int s ); \ 736 template void randomize( SCALAR l, SCALAR u, const Ptr<VectorBase<SCALAR > > &v ); \ 738 template void assign( const Ptr<VectorBase<SCALAR > > &v_lhs, const SCALAR& alpha ); \ 740 template void assign( const Ptr<VectorBase<SCALAR > > &v_lhs, const VectorBase<SCALAR >& v_rhs ); \ 742 template void Vp_S( const Ptr<VectorBase<SCALAR > > &v_lhs, const SCALAR& alpha ); \ 744 template void Vt_S( const Ptr<VectorBase<SCALAR > > &v_lhs, const SCALAR& alpha ); \ 746 template void V_StV( const Ptr<VectorBase<SCALAR > > &y, const SCALAR& alpha, \ 747 const VectorBase<SCALAR > &x \ 750 template void Vp_StV( const Ptr<VectorBase<SCALAR > > &v_lhs, const SCALAR& alpha, \ 751 const VectorBase<SCALAR >& v_rhs \ 754 template void Vp_V( const Ptr<VectorBase<SCALAR > > &y, const VectorBase<SCALAR >& x, \ 758 template void V_V( const Ptr<VectorBase<SCALAR > > &y, const VectorBase<SCALAR >& x ); \ 760 template void V_S( const Ptr<VectorBase<SCALAR > > &y, const SCALAR& alpha ); \ 762 template void V_VpV( const Ptr<VectorBase<SCALAR > > &z, const VectorBase<SCALAR >& x, \ 763 const VectorBase<SCALAR >& y \ 766 template void V_VmV( const Ptr<VectorBase<SCALAR > > &z, const VectorBase<SCALAR >& x, \ 767 const VectorBase<SCALAR >& y \ 770 template void V_StVpV( const Ptr<VectorBase<SCALAR > > &z, const SCALAR &alpha, \ 771 const VectorBase<SCALAR >& x, const VectorBase<SCALAR >& y \ 774 template void V_VpStV( const Ptr<VectorBase<SCALAR > > &z, \ 775 const VectorBase<SCALAR >& x, \ 776 const SCALAR &alpha, const VectorBase<SCALAR >& y ); \ 778 template void V_StVpStV( const Ptr<VectorBase<SCALAR > > &z, const SCALAR &alpha, \ 779 const VectorBase<SCALAR >& x, const SCALAR &beta, const VectorBase<SCALAR >& y \ 784 #define THYRA_VECTOR_STD_OPS_REAL_INSTANT(SCALAR) \ 786 template SCALAR min( const VectorBase<SCALAR >& x ); \ 788 template void min( const VectorBase<SCALAR >& x, \ 789 const Ptr<SCALAR > &minEle, const Ptr<Ordinal> &minIndex \ 792 template void minGreaterThanBound( const VectorBase<SCALAR >& x, \ 793 const SCALAR &bound, const Ptr<SCALAR > &minEle, const Ptr<Ordinal> &minIndex \ 796 template SCALAR max( const VectorBase<SCALAR >& x ); \ 798 template void max( const VectorBase<SCALAR >& x, \ 799 const Ptr<SCALAR > &maxEle, const Ptr<Ordinal> &maxIndex \ 802 template void maxLessThanBound( const VectorBase<SCALAR >& x, \ 803 const SCALAR &bound, const Ptr<SCALAR > &maxEle, const Ptr<Ordinal> &maxIndex \ 807 #endif // THYRA_VECTOR_STD_OPS_HPP
void put_scalar(const Scalar &alpha, const Ptr< VectorBase< Scalar > > &y)
Assign all elements to a scalar: y(i) = alpha, i = 0...y->space()->dim()-1.
void ele_wise_prod_update(const Scalar &alpha, const VectorBase< Scalar > &x, const Ptr< VectorBase< Scalar > > &y)
Element-wise product update: y(i) *= alpha * x(i), i = 0...y->space()->dim()-1.
void assign(const Ptr< MultiVectorBase< Scalar > > &V, Scalar alpha)
V = alpha.
void copy(const VectorBase< Scalar > &x, const Ptr< VectorBase< Scalar > > &y)
Vector assignment: y(i) = x(i), i = 0...y->space()->dim()-1.
RCP< const LinearOpBase< Scalar > > scale(const Scalar &scalar, const RCP< const LinearOpBase< Scalar > > &Op, const std::string &label="")
Build an implicit const scaled linear operator.
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.
Teuchos::RCP< ReductTarget > reduct_obj_create() const
void ele_wise_scale(const VectorBase< Scalar > &x, const Ptr< VectorBase< Scalar > > &y)
Element-wise scaling: y(i) *= x(i), i = 0...y->space()->dim()-1.
void add_scalar(const Scalar &alpha, const Ptr< VectorBase< Scalar > > &y)
Add a scalar to all elements: y(i) += alpha, i = 0...y->space()->dim()-1.
static void set_static_seed(const unsigned int static_seed)
void ele_wise_prod(const Scalar &alpha, const VectorBase< Scalar > &x, const VectorBase< Scalar > &v, const Ptr< VectorBase< Scalar > > &y)
Element-wise product update: y(i) += alpha * x(i) * v(i), i = 0...y->space()->dim()-1.
void Vp_StV(const Ptr< VectorBase< Scalar > > &y, const Scalar &alpha, const VectorBase< Scalar > &x)
AXPY: y(i) = alpha * x(i) + y(i), i = 0...y->space()->dim()-1.
void Vt_S(const Ptr< MultiVectorBase< Scalar > > &Z, const Scalar &alpha)
Z(i,j) *= alpha, i = 0...Z->range()->dim()-1, j = 0...Z->domain()->dim()-1.