Thyra Version of the Day
Loading...
Searching...
No Matches
Thyra_VectorStdOps_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_STD_OPS_HPP
11#define THYRA_VECTOR_STD_OPS_HPP
12
13#include "Thyra_VectorStdOps_decl.hpp"
14#include "Thyra_VectorSpaceBase.hpp"
15#include "Thyra_VectorBase.hpp"
16#include "RTOpPack_ROpGetElement.hpp"
17#include "RTOpPack_TOpSetElement.hpp"
18#include "RTOpPack_ROpMin.hpp"
19#include "RTOpPack_ROpMinIndex.hpp"
20#include "RTOpPack_ROpMinIndexGreaterThanBound.hpp"
21#include "RTOpPack_ROpMax.hpp"
22#include "RTOpPack_ROpMaxIndex.hpp"
23#include "RTOpPack_ROpMaxIndexLessThanBound.hpp"
24#include "RTOpPack_ROpSum.hpp"
25#include "RTOpPack_TOpAddScalar.hpp"
26#include "RTOpPack_TOpEleWiseDivide.hpp"
27#include "RTOpPack_TOpEleWiseProd.hpp"
28#include "RTOpPack_TOpPairWiseMax.hpp"
29#include "RTOpPack_TOpEleWiseConjProd.hpp"
30#include "RTOpPack_TOpEleWiseProdUpdate.hpp"
31#include "RTOpPack_TOpPairWiseMaxUpdate.hpp"
32#include "RTOpPack_TOpRandomize.hpp"
33#include "Teuchos_Assert.hpp"
34#include "Teuchos_Assert.hpp"
35
36
37//
38// All scalar types
39//
40
41
42// Standard text names
43
44
45// Reduction operations
46
47
48template<class Scalar>
49Scalar Thyra::sum( const VectorBase<Scalar>& v_rhs )
50{
51 using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
52 RTOpPack::ROpSum<Scalar> sum_op;
53 Teuchos::RCP<RTOpPack::ReductTarget> sum_targ = sum_op.reduct_obj_create();
54 applyOp<Scalar>(sum_op,
55 tuple(ptrInArg(v_rhs)),
56 ArrayView<Ptr<VectorBase<Scalar> > >(null),
57 sum_targ.ptr() );
58 return sum_op(*sum_targ);
59}
60
61
62template<class Scalar>
64Thyra::norm_1( const VectorBase<Scalar>& v_rhs )
65{
66 return v_rhs.norm_1();
67}
68
69
70template<class Scalar>
72Thyra::norm_2( const VectorBase<Scalar>& v_rhs )
73{
74 return v_rhs.norm_2();
75}
76
77
78template<class Scalar>
80Thyra::norm_2( const VectorBase<Scalar>& w, const VectorBase<Scalar>& v )
81{
82 return v.norm_2(w);
83}
84
85
86template<class Scalar>
88Thyra::norm_inf( const VectorBase<Scalar>& v_rhs )
89{
90 return v_rhs.norm_inf();
91}
92
93
94template<class Scalar>
95Scalar Thyra::dot( const VectorBase<Scalar>& v_rhs1, const VectorBase<Scalar>& v_rhs2 )
96{
97 return v_rhs2.dot(v_rhs1);
98}
99
100
101template<class Scalar>
102Scalar Thyra::get_ele( const VectorBase<Scalar>& v, Ordinal i )
103{
104 using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
105#ifdef THYRA_DEBUG
106 TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE(i, 0, v.space()->dim());
107#endif
109 Teuchos::RCP<RTOpPack::ReductTarget> get_ele_targ = get_ele_op.reduct_obj_create();
110 applyOp<Scalar>(get_ele_op, tuple(ptrInArg(v)),
111 ArrayView<Ptr<VectorBase<Scalar> > >(null),
112 get_ele_targ.ptr() );
113 return get_ele_op(*get_ele_targ);
114}
115
116
117// Transformation operations
118
119
120template<class Scalar>
121void Thyra::set_ele( Ordinal i, Scalar alpha, const Ptr<VectorBase<Scalar> > &v )
122{
123 using Teuchos::tuple; using Teuchos::null;
124#ifdef THYRA_DEBUG
125 TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE(i, 0, v->space()->dim());
126#endif
127 RTOpPack::TOpSetElement<Scalar> set_ele_op(i, alpha);
128 applyOp<Scalar>(set_ele_op,
129 ArrayView<Ptr<const VectorBase<Scalar> > >(null),
130 tuple(v),
131 null);
132}
133
134
135template<class Scalar>
136void Thyra::put_scalar( const Scalar& alpha, const Ptr<VectorBase<Scalar> > &v_lhs )
137{
138 v_lhs->assign(alpha);
139}
140
141
142template<class Scalar>
143void Thyra::copy( const VectorBase<Scalar>& v_rhs,
144 const Ptr<VectorBase<Scalar> > &v_lhs )
145{
146 v_lhs->assign(v_rhs);
147}
148
149
150template<class Scalar>
151void Thyra::add_scalar( const Scalar& alpha, const Ptr<VectorBase<Scalar> > &v_lhs )
152{
153 using Teuchos::tuple; using Teuchos::null;
154 RTOpPack::TOpAddScalar<Scalar> add_scalar_op(alpha);
155 applyOp<Scalar>(add_scalar_op,
156 ArrayView<Ptr<const VectorBase<Scalar> > >(null),
157 tuple(v_lhs), null );
158}
159
160
161template<class Scalar>
162void Thyra::scale( const Scalar& alpha, const Ptr<VectorBase<Scalar> > &v_lhs )
163{
164 v_lhs->scale(alpha);
165}
166
167
168template<class Scalar>
169void Thyra::abs( const VectorBase<Scalar>& x, const Ptr<VectorBase<Scalar> > &y )
170{
171 y->abs(x);
172}
173
174
175template<class Scalar>
176void Thyra::reciprocal( const VectorBase<Scalar>& x, const Ptr<VectorBase<Scalar> > &y )
177{
178 y->reciprocal(x);
179}
180
181
182template<class Scalar>
183void Thyra::ele_wise_prod(
184 const Scalar& alpha, const VectorBase<Scalar>& v_rhs1,
185 const VectorBase<Scalar>& v_rhs2, const Ptr<VectorBase<Scalar> > &v_lhs
186 )
187{
188 using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
189 RTOpPack::TOpEleWiseProd<Scalar> ele_wise_prod_op(alpha);
190 applyOp<Scalar>( ele_wise_prod_op, tuple(ptrInArg(v_rhs1),ptrInArg(v_rhs2)),
191 tuple(v_lhs), null );
192}
193
194template<class Scalar>
195void Thyra::pair_wise_max(
196 const Scalar &alpha, const VectorBase<Scalar>& v_rhs1,
197 const VectorBase<Scalar>& v_rhs2, const Ptr<VectorBase<Scalar> > &v_lhs
198 )
199{
200 using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
201 RTOpPack::TOpPairWiseMax<Scalar> pair_wise_max_op(alpha);
202 applyOp<Scalar>( pair_wise_max_op, tuple(ptrInArg(v_rhs1),ptrInArg(v_rhs2)),
203 tuple(v_lhs), null );
204}
205
206
207template<class Scalar>
208void Thyra::ele_wise_conj_prod(
209 const Scalar& alpha, const VectorBase<Scalar>& v_rhs1,
210 const VectorBase<Scalar>& v_rhs2, const Ptr<VectorBase<Scalar> > &v_lhs
211 )
212{
213 using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
214 RTOpPack::TOpEleWiseConjProd<Scalar> ele_wise_conj_prod_op(alpha);
215 applyOp<Scalar>( ele_wise_conj_prod_op, tuple(ptrInArg(v_rhs1),ptrInArg(v_rhs2)),
216 tuple(v_lhs), null );
217}
218
219
220template<class Scalar>
221void Thyra::ele_wise_scale( const VectorBase<Scalar>& x,
222 const Ptr<VectorBase<Scalar> > &y )
223{
224 y->ele_wise_scale(x);
225}
226
227
228template<class Scalar>
229void Thyra::Vp_StVtV(
230 const Ptr<VectorBase<Scalar> > &v_lhs,
231 const Scalar& alpha, const VectorBase<Scalar>& v_rhs1,
232 const VectorBase<Scalar>& v_rhs2
233 )
234{
235 ele_wise_prod(alpha,v_rhs1,v_rhs2,v_lhs);
236}
237
238
239template<class Scalar>
240void Thyra::ele_wise_prod_update(
241 const Scalar& alpha, const VectorBase<Scalar>& v_rhs1,
242 const Ptr<VectorBase<Scalar> > &v_lhs
243 )
244{
245 using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
246 RTOpPack::TOpEleWiseProdUpdate<Scalar> ele_wise_prod_update_op(alpha);
247 applyOp<Scalar>( ele_wise_prod_update_op, tuple(ptrInArg(v_rhs1)),
248 tuple(v_lhs), null );
249}
250
251
252template<class Scalar>
253void Thyra::pair_wise_max_update(
254 const Scalar& alpha, const VectorBase<Scalar>& v_rhs1,
255 const Ptr<VectorBase<Scalar> > &v_lhs
256 )
257{
258 using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
259 RTOpPack::TOpPairWiseMaxUpdate<Scalar> pair_wise_max_update_op(alpha);
260 applyOp<Scalar>( pair_wise_max_update_op, tuple(ptrInArg(v_rhs1)),
261 tuple(v_lhs), null );
262}
263
264
265
266template<class Scalar>
267void Thyra::Vt_StV(
268 const Ptr<VectorBase<Scalar> > &v_lhs,
269 const Scalar& alpha, const VectorBase<Scalar>& x )
270{
271 ele_wise_prod_update(alpha,x,v_lhs);
272}
273
274
275template<class Scalar>
276void Thyra::ele_wise_divide(
277 const Scalar& alpha, const VectorBase<Scalar>& v_rhs1,
278 const VectorBase<Scalar>& v_rhs2,
279 const Ptr<VectorBase<Scalar> > &v_lhs
280 )
281{
282 using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
283 RTOpPack::TOpEleWiseDivide<Scalar> ele_wise_divide_op(alpha);
284 applyOp<Scalar>( ele_wise_divide_op, tuple(ptrInArg(v_rhs1),ptrInArg(v_rhs2)),
285 tuple(v_lhs), null );
286}
287
288
289template<class Scalar>
290void Thyra::linear_combination(
291 const ArrayView<const Scalar> &alpha,
292 const ArrayView<const Ptr<const VectorBase<Scalar> > > &x,
293 const Scalar &beta,
294 const Ptr<VectorBase<Scalar> > &y
295 )
296{
297 y->linear_combination(alpha, x, beta);
298}
299
300
301template<class Scalar>
302void Thyra::seed_randomize( unsigned int s )
303{
305}
306
307
308template<class Scalar>
309void Thyra::randomize( Scalar l, Scalar u, const Ptr<VectorBase<Scalar> > &v )
310{
311 v->randomize(l, u);
312 // Warning! If the RTOpPack::TOpRandomize<Scalar> object is ever made
313 // static, the one must be careful to change the seed in between calls.
314 // Right now the seed is being incremented by the constructor automatically.
315 // It is important to generate different random vectors on each call
316 // (i.e. to generate different columns in a multi-vector).
317}
318
319
320// Linear algebra names
321
322
323template<class Scalar>
324void Thyra::assign( const Ptr<VectorBase<Scalar> > &v_lhs, const Scalar& alpha )
325{
326 put_scalar(alpha,v_lhs);
327}
328
329
330template<class Scalar>
331void Thyra::assign( const Ptr<VectorBase<Scalar> > &v_lhs, const VectorBase<Scalar>& v_rhs )
332{
333 copy(v_rhs,v_lhs);
334}
335
336
337template<class Scalar>
338void Thyra::Vp_S( const Ptr<VectorBase<Scalar> > &v_lhs, const Scalar& alpha )
339{
340 add_scalar(alpha,v_lhs);
341}
342
343
344template<class Scalar>
345void Thyra::Vt_S( const Ptr<VectorBase<Scalar> > &v_lhs, const Scalar& alpha )
346{
347 scale(alpha,v_lhs);
348}
349
350
351template<class Scalar>
352void Thyra::V_StV( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha,
353 const VectorBase<Scalar> &x
354 )
355{
356 using Teuchos::tuple; using Teuchos::ptrInArg;
357 linear_combination<Scalar>( tuple<Scalar>(alpha), tuple(ptrInArg(x)),
358 ScalarTraits<Scalar>::zero(), y );
359}
360
361
362template<class Scalar>
363void Thyra::Vp_StV( const Ptr<VectorBase<Scalar> > &v_lhs, const Scalar& alpha,
364 const VectorBase<Scalar>& v_rhs
365 )
366{
367 v_lhs->update(alpha, v_rhs);
368}
369
370
371template<class Scalar>
372void Thyra::Vp_V( const Ptr<VectorBase<Scalar> > &y, const VectorBase<Scalar>& x,
373 const Scalar& beta
374 )
375{
376 using Teuchos::tuple; using Teuchos::ptrInArg;
377 linear_combination<Scalar>(
378 tuple<Scalar>(Teuchos::ScalarTraits<Scalar>::one()),
379 tuple(ptrInArg(x)),
380 beta, y );
381}
382
383
384template<class Scalar>
385void Thyra::V_V( const Ptr<VectorBase<Scalar> > &y, const VectorBase<Scalar>& x )
386{
387 assign(y,x);
388}
389
390
391template<class Scalar>
392void Thyra::V_S( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha )
393{
394 assign(y,alpha);
395}
396
397
398template<class Scalar>
399void Thyra::V_VpV( const Ptr<VectorBase<Scalar> > &z, const VectorBase<Scalar>& x,
400 const VectorBase<Scalar>& y
401 )
402{
403 using Teuchos::tuple; using Teuchos::ptrInArg;
405 linear_combination<Scalar>(
406 tuple(ST::one(),ST::one()),
407 tuple(ptrInArg(x),ptrInArg(y)),
408 ST::zero(), z
409 );
410}
411
412
413template<class Scalar>
414void Thyra::V_VmV( const Ptr<VectorBase<Scalar> > &z, const VectorBase<Scalar>& x,
415 const VectorBase<Scalar>& y
416 )
417{
418 using Teuchos::tuple; using Teuchos::ptrInArg;
420 linear_combination<Scalar>(
421 tuple(ST::one(),Scalar(-ST::one())),
422 tuple(ptrInArg(x),ptrInArg(y)),
423 ST::zero(), z
424 );
425}
426
427
428template<class Scalar>
429void Thyra::V_StVpV( const Ptr<VectorBase<Scalar> > &z, const Scalar &alpha,
430 const VectorBase<Scalar>& x, const VectorBase<Scalar>& y
431 )
432{
433 using Teuchos::tuple; using Teuchos::ptrInArg;
435 linear_combination<Scalar>(
436 tuple(alpha, ST::one()), tuple(ptrInArg(x),ptrInArg(y)),
437 ST::zero(), z
438 );
439}
440
441
442template<class Scalar>
443void Thyra::V_VpStV( const Ptr<VectorBase<Scalar> > &z,
444 const VectorBase<Scalar>& x,
445 const Scalar &alpha, const VectorBase<Scalar>& y )
446{
447 using Teuchos::tuple; using Teuchos::ptrInArg;
449 linear_combination<Scalar>(
450 tuple(ST::one(), alpha), tuple(ptrInArg(x),ptrInArg(y)),
451 ST::zero(), z
452 );
453}
454
455
456template<class Scalar>
457void Thyra::V_StVpStV( const Ptr<VectorBase<Scalar> > &z, const Scalar &alpha,
458 const VectorBase<Scalar>& x, const Scalar &beta, const VectorBase<Scalar>& y
459 )
460{
461 using Teuchos::tuple; using Teuchos::ptrInArg;
463 linear_combination<Scalar>(
464 tuple(alpha, beta), tuple(ptrInArg(x),ptrInArg(y)),
465 ST::zero(), z
466 );
467}
468
469
470//
471// For real types only
472//
473
474
475template<class Scalar>
476Scalar Thyra::min( const VectorBase<Scalar>& x ) {
477 using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
478 RTOpPack::ROpMin<Scalar> min_op;
479 Teuchos::RCP<RTOpPack::ReductTarget> min_targ = min_op.reduct_obj_create();
480 applyOp<Scalar>( min_op, tuple(ptrInArg(x)),
481 ArrayView<const Ptr<VectorBase<Scalar> > >(null),
482 min_targ.ptr() );
483 return min_op(*min_targ);
484}
485
486
487template<class Scalar>
488void Thyra::min( const VectorBase<Scalar>& x,
489 const Ptr<Scalar> &minEle, const Ptr<Ordinal> &minIndex
490 )
491{
492 using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
495 applyOp<Scalar>( min_op, tuple(ptrInArg(x)),
496 ArrayView<const Ptr<VectorBase<Scalar> > >(null),
497 min_targ.ptr() );
498 RTOpPack::ScalarIndex<Scalar> scalarIndex = min_op(*min_targ);
499 *minEle = scalarIndex.scalar;
500 *minIndex = scalarIndex.index;
501}
502
503
504template<class Scalar>
505void Thyra::minGreaterThanBound( const VectorBase<Scalar>& x,
506 const Scalar &bound, const Ptr<Scalar> &minEle, const Ptr<Ordinal> &minIndex
507 )
508{
509 using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
512 applyOp<Scalar>( min_op, tuple(ptrInArg(x)),
513 ArrayView<const Ptr<VectorBase<Scalar> > >(null),
514 min_targ.ptr() );
515 RTOpPack::ScalarIndex<Scalar> scalarIndex = min_op(*min_targ);
516 *minEle = scalarIndex.scalar;
517 *minIndex = scalarIndex.index;
518}
519
520
521template<class Scalar>
522Scalar Thyra::max( const VectorBase<Scalar>& x )
523{
524 using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
525 RTOpPack::ROpMax<Scalar> max_op;
526 Teuchos::RCP<RTOpPack::ReductTarget> max_targ = max_op.reduct_obj_create();
527 applyOp<Scalar>( max_op, tuple(ptrInArg(x)),
528 ArrayView<const Ptr<VectorBase<Scalar> > >(null),
529 max_targ.ptr() );
530 return max_op(*max_targ);
531}
532
533
534template<class Scalar>
535void Thyra::max( const VectorBase<Scalar>& x,
536 const Ptr<Scalar> &maxEle, const Ptr<Ordinal> &maxIndex
537 )
538{
539 using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
542 applyOp<Scalar>( max_op, tuple(ptrInArg(x)),
543 ArrayView<const Ptr<VectorBase<Scalar> > >(null),
544 max_targ.ptr() );
545 RTOpPack::ScalarIndex<Scalar> scalarIndex = max_op(*max_targ);
546 *maxEle = scalarIndex.scalar;
547 *maxIndex = scalarIndex.index;
548}
549
550
551template<class Scalar>
552void Thyra::maxLessThanBound( const VectorBase<Scalar>& x,
553 const Scalar &bound, const Ptr<Scalar> &maxEle, const Ptr<Ordinal> &maxIndex
554 )
555{
556 using Teuchos::tuple; using Teuchos::ptrInArg; using Teuchos::null;
559 applyOp<Scalar>( max_op, tuple(ptrInArg(x)),
560 ArrayView<const Ptr<VectorBase<Scalar> > >(null),
561 max_targ.ptr() );
562 RTOpPack::ScalarIndex<Scalar> scalarIndex = max_op(*max_targ);
563 *maxEle = scalarIndex.scalar;
564 *maxIndex = scalarIndex.index;
565}
566
567
568//
569// Explicit instantiation macro
570//
571
572
573#define THYRA_VECTOR_STD_OPS_INSTANT(SCALAR) \
574 \
575 template SCALAR sum( const VectorBase<SCALAR >& v_rhs ); \
576 \
577 template ScalarTraits<SCALAR >::magnitudeType \
578 norm_1( const VectorBase<SCALAR >& v_rhs ); \
579 \
580 template ScalarTraits<SCALAR >::magnitudeType \
581 norm_2( const VectorBase<SCALAR >& v_rhs ); \
582 \
583 template ScalarTraits<SCALAR >::magnitudeType \
584 norm_2( const VectorBase<SCALAR >& w, const VectorBase<SCALAR >& v ); \
585 \
586 template ScalarTraits<SCALAR >::magnitudeType \
587 norm_inf( const VectorBase<SCALAR >& v_rhs ); \
588 \
589 template SCALAR dot( const VectorBase<SCALAR >& v_rhs1, const VectorBase<SCALAR >& v_rhs2 ); \
590 \
591 template SCALAR get_ele( const VectorBase<SCALAR >& v, Ordinal i ); \
592 \
593 template void set_ele( Ordinal i, SCALAR alpha, const Ptr<VectorBase<SCALAR > > &v ); \
594 \
595 template void put_scalar( const SCALAR& alpha, const Ptr<VectorBase<SCALAR > > &v_lhs ); \
596 \
597 template void copy( const VectorBase<SCALAR >& v_rhs, \
598 const Ptr<VectorBase<SCALAR > > &v_lhs ); \
599 \
600 template void add_scalar( const SCALAR& alpha, const Ptr<VectorBase<SCALAR > > &v_lhs ); \
601 \
602 template void scale( const SCALAR& alpha, const Ptr<VectorBase<SCALAR > > &v_lhs ); \
603 \
604 template void abs( const VectorBase< SCALAR > &x, const Ptr<VectorBase< SCALAR > > &y ); \
605 \
606 template void reciprocal( const VectorBase< SCALAR > &x, const Ptr<VectorBase< SCALAR > > &y ); \
607 \
608 template void ele_wise_prod( \
609 const SCALAR& alpha, const VectorBase<SCALAR >& v_rhs1, \
610 const VectorBase<SCALAR >& v_rhs2, const Ptr<VectorBase<SCALAR > > &v_lhs \
611 ); \
612 \
613 template void ele_wise_conj_prod( \
614 const SCALAR& alpha, const VectorBase<SCALAR >& v_rhs1, \
615 const VectorBase<SCALAR >& v_rhs2, const Ptr<VectorBase<SCALAR > > &v_lhs \
616 ); \
617 \
618 template void ele_wise_scale( const VectorBase<SCALAR>& x, \
619 const Ptr<VectorBase<SCALAR> > &y ); \
620 \
621 template void Vp_StVtV( \
622 const Ptr<VectorBase<SCALAR > > &v_lhs, \
623 const SCALAR& alpha, const VectorBase<SCALAR >& v_rhs1, \
624 const VectorBase<SCALAR >& v_rhs2 \
625 ); \
626 \
627 template void ele_wise_prod_update( \
628 const SCALAR& alpha, const VectorBase<SCALAR >& v_rhs1, \
629 const Ptr<VectorBase<SCALAR > > &v_lhs \
630 ); \
631 \
632 template void Vt_StV( \
633 const Ptr<VectorBase<SCALAR > > &v_lhs, \
634 const SCALAR& alpha, const VectorBase<SCALAR >& x ); \
635 \
636 template void ele_wise_divide( \
637 const SCALAR& alpha, const VectorBase<SCALAR >& v_rhs1, \
638 const VectorBase<SCALAR >& v_rhs2, \
639 const Ptr<VectorBase<SCALAR > > &v_lhs \
640 ); \
641 \
642 template void linear_combination( \
643 const ArrayView<const SCALAR > &alpha, \
644 const ArrayView<const Ptr<const VectorBase<SCALAR > > > &x, \
645 const SCALAR &beta, \
646 const Ptr<VectorBase<SCALAR > > &y \
647 ); \
648 \
649 template void seed_randomize<SCALAR >( unsigned int s ); \
650 \
651 template void randomize( SCALAR l, SCALAR u, const Ptr<VectorBase<SCALAR > > &v ); \
652 \
653 template void assign( const Ptr<VectorBase<SCALAR > > &v_lhs, const SCALAR& alpha ); \
654 \
655 template void assign( const Ptr<VectorBase<SCALAR > > &v_lhs, const VectorBase<SCALAR >& v_rhs ); \
656 \
657 template void Vp_S( const Ptr<VectorBase<SCALAR > > &v_lhs, const SCALAR& alpha ); \
658 \
659 template void Vt_S( const Ptr<VectorBase<SCALAR > > &v_lhs, const SCALAR& alpha ); \
660 \
661 template void V_StV( const Ptr<VectorBase<SCALAR > > &y, const SCALAR& alpha, \
662 const VectorBase<SCALAR > &x \
663 ); \
664 \
665 template void Vp_StV( const Ptr<VectorBase<SCALAR > > &v_lhs, const SCALAR& alpha, \
666 const VectorBase<SCALAR >& v_rhs \
667 ); \
668 \
669 template void Vp_V( const Ptr<VectorBase<SCALAR > > &y, const VectorBase<SCALAR >& x, \
670 const SCALAR& beta \
671 ); \
672 \
673 template void V_V( const Ptr<VectorBase<SCALAR > > &y, const VectorBase<SCALAR >& x ); \
674 \
675 template void V_S( const Ptr<VectorBase<SCALAR > > &y, const SCALAR& alpha ); \
676 \
677 template void V_VpV( const Ptr<VectorBase<SCALAR > > &z, const VectorBase<SCALAR >& x, \
678 const VectorBase<SCALAR >& y \
679 ); \
680 \
681 template void V_VmV( const Ptr<VectorBase<SCALAR > > &z, const VectorBase<SCALAR >& x, \
682 const VectorBase<SCALAR >& y \
683 ); \
684 \
685 template void V_StVpV( const Ptr<VectorBase<SCALAR > > &z, const SCALAR &alpha, \
686 const VectorBase<SCALAR >& x, const VectorBase<SCALAR >& y \
687 ); \
688 \
689 template void V_VpStV( const Ptr<VectorBase<SCALAR > > &z, \
690 const VectorBase<SCALAR >& x, \
691 const SCALAR &alpha, const VectorBase<SCALAR >& y ); \
692 \
693 template void V_StVpStV( const Ptr<VectorBase<SCALAR > > &z, const SCALAR &alpha, \
694 const VectorBase<SCALAR >& x, const SCALAR &beta, const VectorBase<SCALAR >& y \
695 ); \
696
697
698
699#define THYRA_VECTOR_STD_OPS_REAL_INSTANT(SCALAR) \
700 \
701 template SCALAR min( const VectorBase<SCALAR >& x ); \
702 \
703 template void pair_wise_max( \
704 const SCALAR& alpha, const VectorBase<SCALAR >& v_rhs1, \
705 const VectorBase<SCALAR >& v_rhs2, const Ptr<VectorBase<SCALAR > > &v_lhs \
706 ); \
707 \
708 template void pair_wise_max_update( \
709 const SCALAR& alpha, const VectorBase<SCALAR >& v_rhs1, \
710 const Ptr<VectorBase<SCALAR > > &v_lhs \
711 ); \
712 \
713 template void min( const VectorBase<SCALAR >& x, \
714 const Ptr<SCALAR > &minEle, const Ptr<Ordinal> &minIndex \
715 ); \
716 \
717 template void minGreaterThanBound( const VectorBase<SCALAR >& x, \
718 const SCALAR &bound, const Ptr<SCALAR > &minEle, const Ptr<Ordinal> &minIndex \
719 ); \
720 \
721 template SCALAR max( const VectorBase<SCALAR >& x ); \
722 \
723 template void max( const VectorBase<SCALAR >& x, \
724 const Ptr<SCALAR > &maxEle, const Ptr<Ordinal> &maxIndex \
725 ); \
726 \
727 template void maxLessThanBound( const VectorBase<SCALAR >& x, \
728 const SCALAR &bound, const Ptr<SCALAR > &maxEle, const Ptr<Ordinal> &maxIndex \
729 ); \
730
731
732#endif // THYRA_VECTOR_STD_OPS_HPP
Teuchos::RCP< ReductTarget > reduct_obj_create() const
static void set_static_seed(const unsigned int static_seed)
Ptr< T > ptr() const
#define TEUCHOS_ASSERT_IN_RANGE_UPPER_EXCLUSIVE(index, lower_inclusive, upper_exclusive)
T_To & dyn_cast(T_From &from)