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