Thyra  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Thyra_VectorStdOps_decl.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_DECL_HPP
11 #define THYRA_VECTOR_STD_OPS_DECL_HPP
12 
13 
14 #include "Thyra_OperatorVectorTypes.hpp"
15 
16 
17 namespace Thyra {
18 
19 
25 template<class Scalar>
26 Scalar sum( const VectorBase<Scalar>& v );
27 
28 
35 template<class Scalar>
36 Scalar scalarProd( const VectorBase<Scalar>& x, const VectorBase<Scalar>& y );
37 
38 
45 template<class Scalar>
46 Scalar inner( const VectorBase<Scalar>& x, const VectorBase<Scalar>& y );
47 
48 
56 template<class Scalar>
58 norm( const VectorBase<Scalar>& v );
59 
60 
65 template<class Scalar>
67 norm_1( const VectorBase<Scalar>& v );
68 
69 
74 template<class Scalar>
76 norm_2( const VectorBase<Scalar>& v );
77 
78 
84 template<class Scalar>
86 norm_2( const VectorBase<Scalar> &w, const VectorBase<Scalar>& v );
87 
88 
93 template<class Scalar>
95 norm_inf( const VectorBase<Scalar>& v_rhs );
96 
97 
102 template<class Scalar>
103 Scalar dot( const VectorBase<Scalar>& x, const VectorBase<Scalar>& y );
104 
105 
110 template<class Scalar>
111 Scalar get_ele( const VectorBase<Scalar>& v, Ordinal i );
112 
113 
118 template<class Scalar>
119 void set_ele( Ordinal i, Scalar alpha, const Ptr<VectorBase<Scalar> > &v );
120 
121 
127 template<class Scalar>
128 void put_scalar( const Scalar& alpha, const Ptr<VectorBase<Scalar> > &y );
129 
130 
136 template<class Scalar>
137 void copy( const VectorBase<Scalar>& x, const Ptr<VectorBase<Scalar> > &y );
138 
139 
145 template<class Scalar>
146 void add_scalar( const Scalar& alpha, const Ptr<VectorBase<Scalar> > &y );
147 
148 
158 template<class Scalar>
159 void scale( const Scalar& alpha, const Ptr<VectorBase<Scalar> > &y );
160 
161 
167 template<class Scalar>
168 void abs( const VectorBase<Scalar> &x, const Ptr<VectorBase<Scalar> > &y );
169 
170 
176 template<class Scalar>
177 void reciprocal( const VectorBase<Scalar> &x, const Ptr<VectorBase<Scalar> > &y );
178 
179 
185 template<class Scalar>
186 void ele_wise_prod( const Scalar& alpha, const VectorBase<Scalar>& x,
187  const VectorBase<Scalar>& v, const Ptr<VectorBase<Scalar> > &y );
188 
189 
195 template<class Scalar>
196 void pair_wise_max(const Scalar& alpha, const VectorBase<Scalar>& x,
197  const VectorBase<Scalar>& v, const Ptr<VectorBase<Scalar> > &y );
198 
204 template<class Scalar>
205 void ele_wise_conj_prod( const Scalar& alpha, const VectorBase<Scalar>& x,
206  const VectorBase<Scalar>& v, const Ptr<VectorBase<Scalar> > &y );
207 
208 
214 template<class Scalar>
215 void ele_wise_scale( const VectorBase<Scalar>& x, const Ptr<VectorBase<Scalar> > &y );
216 
217 
223 template<class Scalar>
224 void Vp_StVtV( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha,
225  const VectorBase<Scalar>& x, const VectorBase<Scalar>& v);
226 
227 
233 template<class Scalar>
234 void ele_wise_prod_update( const Scalar& alpha, const VectorBase<Scalar>& x,
235  const Ptr<VectorBase<Scalar> > &y );
236 
237 
243 template<class Scalar>
244 void pair_wise_max_update( const Scalar& alpha, const VectorBase<Scalar>& x,
245  const Ptr<VectorBase<Scalar> > &y );
246 
252 template<class Scalar>
253 void Vt_StV( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha,
254  const VectorBase<Scalar> &x );
255 
256 
262 template<class Scalar>
263 void ele_wise_divide( const Scalar& alpha, const VectorBase<Scalar>& x,
264  const VectorBase<Scalar>& v, const Ptr<VectorBase<Scalar> > &y );
265 
266 
289 template<class Scalar>
290 void 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 
307 template<class Scalar>
308 void seed_randomize( unsigned int s );
309 
310 
321 template<class Scalar>
322 void randomize( Scalar l, Scalar u, const Ptr<VectorBase<Scalar> > &v );
323 
324 
330 template<class Scalar>
331 void assign( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha );
332 
333 
339 template<class Scalar>
340 void assign( const Ptr<VectorBase<Scalar> > &y, const VectorBase<Scalar>& x );
341 
342 
348 template<class Scalar>
349 void Vp_S( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha );
350 
351 
361 template<class Scalar>
362 void Vt_S( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha );
363 
364 
370 template<class Scalar>
371 void V_StV( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha,
372  const VectorBase<Scalar> &x );
373 
374 
380 template<class Scalar>
381 void Vp_StV( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha,
382  const VectorBase<Scalar>& x );
383 
384 
389 template<class Scalar>
390 void Vp_V(
391  const Ptr<VectorBase<Scalar> > &y, const VectorBase<Scalar>& x,
392  const Scalar& beta = static_cast<Scalar>(1.0)
393  );
394 
395 
400 template<class Scalar>
401 void V_V( const Ptr<VectorBase<Scalar> > &y, const VectorBase<Scalar>& x );
402 
403 
408 template<class Scalar>
409 void V_S( const Ptr<VectorBase<Scalar> > &y, const Scalar& alpha );
410 
411 
416 template<class Scalar>
417 void V_VpV( const Ptr<VectorBase<Scalar> > &z, const VectorBase<Scalar>& x,
418  const VectorBase<Scalar>& y );
419 
420 
425 template<class Scalar>
426 void V_VmV( const Ptr<VectorBase<Scalar> > &z, const VectorBase<Scalar>& x,
427  const VectorBase<Scalar>& y );
428 
429 
434 template<class Scalar>
435 void V_StVpV( const Ptr<VectorBase<Scalar> > &z, const Scalar &alpha,
436  const VectorBase<Scalar>& x, const VectorBase<Scalar>& y );
437 
438 
443 template<class Scalar>
444 void V_VpStV( const Ptr<VectorBase<Scalar> > &z,
445  const VectorBase<Scalar>& x,
446  const Scalar &alpha, const VectorBase<Scalar>& y );
447 
448 
453 template<class Scalar>
454 void V_StVpStV( const Ptr<VectorBase<Scalar> > &z, const Scalar &alpha,
455  const VectorBase<Scalar>& x, const Scalar &beta, const VectorBase<Scalar>& y );
456 
457 
462 template<class Scalar>
463 Scalar min( const VectorBase<Scalar>& x );
464 
465 
485 template<class Scalar>
486 void min( const VectorBase<Scalar>& x,
487  const Ptr<Scalar> &maxEle, const Ptr<Ordinal> &maxIndex );
488 
489 
519 template<class Scalar>
520 void minGreaterThanBound( const VectorBase<Scalar>& x, const Scalar &bound,
521  const Ptr<Scalar> &minEle, const Ptr<Ordinal> &minIndex );
522 
523 
528 template<class Scalar>
529 Scalar max( const VectorBase<Scalar>& x );
530 
531 
551 template<class Scalar>
552 void max( const VectorBase<Scalar>& x,
553  const Ptr<Scalar> &maxEle, const Ptr<Ordinal> &maxIndex );
554 
555 
584 template<class Scalar>
585 void maxLessThanBound( const VectorBase<Scalar>& x, const Scalar &bound,
586  const Ptr<Scalar> &maxEle, const Ptr<Ordinal> &maxIndex );
587 
588 
589 
590 
591 } // end namespace Thyra
592 
593 
594 // /////////////////////////
595 // Inline functions
596 
597 
598 template<class Scalar>
599 inline
600 Scalar Thyra::scalarProd( const VectorBase<Scalar>& x, const VectorBase<Scalar>& y )
601 {
602  return x.space()->scalarProd(x, y);
603 }
604 
605 
606 template<class Scalar>
607 inline
608 Scalar Thyra::inner( const VectorBase<Scalar>& x, const VectorBase<Scalar>& y )
609 {
610  return x.space()->scalarProd(x, y);
611 }
612 
613 
614 template<class Scalar>
615 inline
617 Thyra::norm( const VectorBase<Scalar>& v )
618 {
620  return ST::magnitude(ST::squareroot(v.space()->scalarProd(v, v)));
621 }
622 
623 
624 #endif // THYRA_VECTOR_STD_OPS_DECL_HPP
Teuchos::Ordinal Ordinal
Type for the dimension of a vector space. `*.