RTOp Package Browser (Single Doxygen Collection)  Version of the Day
RTOpPack_TOpPairWiseMax.hpp
Go to the documentation of this file.
2 // *****************************************************************************
3 // RTOp: Interfaces and Support Software for Vector Reduction Transformation
4 // Operations
5 //
6 // Copyright 2006 NTESS and the RTOp contributors.
8 // *****************************************************************************
10
11 #ifndef RTOPPACK_TOP_PAIR_WISE_MAX_HPP
12 #define RTOPPACK_TOP_PAIR_WISE_MAX_HPP
13
14 #include "RTOpPack_RTOpTHelpers.hpp"
15
16
17 namespace RTOpPack {
18
19
21 template<class Scalar>
23 {
24 public:
26  : alpha_(alpha)
27  {}
28  void operator()( const Scalar &v0, const Scalar &v1, Scalar &z0 ) const
29  {
30  z0 = alpha_ * std::max(v0, v1);
31  }
32 private:
33  Scalar alpha_;
34 };
35
36
40 template<class Scalar>
42  : public TOp_2_1_Base<Scalar, TOpPairWiseMaxPairWiseTransformation<Scalar> >
43 {
44 public:
47  TOpPairWiseMax(const Scalar &alpha )
49  {
50  this->setOpNameBase("TOpPAIRWiseMax");
51  }
52 };
53
54
55 } // namespace RTOpPack
56
57
58 #endif // RTOPPACK_TOP_PAIR_WISE_MAX_HPP
TOp_2_1_Base< Scalar, TOpPairWiseMaxPairWiseTransformation< Scalar > > base_t
TOpPairWiseMax(const Scalar &alpha)
Base class for transformations for 2 input and 1 output vector.
Pair-wise Maximum transformation operator: z0[i] = alpha*max(v0[i],v1[i]), i=0...n-1.
void operator()(const Scalar &v0, const Scalar &v1, Scalar &z0) const
Pair-wise transformation operator for TOpPairWiseMax.
void setOpNameBase(const std::string &op_name_base)
Just set the operator name.