RTOp Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RTOpPack_TOpScaleVector.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // RTOp: Interfaces and Support Software for Vector Reduction Transformation
4 // Operations
5 //
6 // Copyright 2006 NTESS and the RTOp contributors.
7 // SPDX-License-Identifier: BSD-3-Clause
8 // *****************************************************************************
9 // @HEADER
10 
11 #ifndef RTOPPACK_TOP_SCALE_VECTOR_HPP
12 #define RTOPPACK_TOP_SCALE_VECTOR_HPP
13 
14 #include "RTOpPack_RTOpTHelpers.hpp"
15 
16 
17 namespace RTOpPack {
18 
19 
21 template<class Scalar>
23 {
24 public:
25  TOpScaleVectorEleWiseTransformation( const Scalar &alpha )
26  : alpha_(alpha)
27  {}
28  void operator()( Scalar &z0 ) const
29  {
30  z0 *= alpha_;
31  }
32 private:
33  Scalar alpha_;
34 };
35 
36 
40 template<class Scalar>
42  : public TOp_0_1_Base<Scalar, TOpScaleVectorEleWiseTransformation<Scalar> >
43 {
44 public:
47  TOpScaleVector( const Scalar &alpha )
49  {
50  this->setOpNameBase("TOpScaleVector");
51  }
52 };
53 
54 
55 } // namespace RTOpPack
56 
57 
58 #endif // RTOPPACK_TOP_SCALE_VECTOR_HPP
TOp_0_1_Base< Scalar, TOpScaleVectorEleWiseTransformation< Scalar > > base_t
Base class for transformations for 0 input and 1 output vector.
TOpScaleVector(const Scalar &alpha)
void setOpNameBase(const std::string &op_name_base)
Just set the operator name.
Element-wise transformation operator for TOpScaleVector.
Simple transformation operator that scales every vector element by a scalar alpha.