Clip.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_FUNCTORS_CLIP_H_
36 #define _BLAZE_MATH_FUNCTORS_CLIP_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <blaze/math/shims/Clip.h>
44 #include <blaze/system/Inline.h>
45 
46 
47 namespace blaze {
48 
49 //=================================================================================================
50 //
51 // CLASS DEFINITION
52 //
53 //=================================================================================================
54 
55 //*************************************************************************************************
59 template< typename DT > // Type of the delimiters
60 struct Clip
61 {
62  public:
63  //**********************************************************************************************
69  explicit inline Clip( const DT& min, const DT& max )
70  : min_( min ) // The lower delimiter
71  , max_( max ) // The upper delimiter
72  {}
73  //**********************************************************************************************
74 
75  //**********************************************************************************************
81  template< typename T >
82  BLAZE_ALWAYS_INLINE auto operator()( const T& a ) const
83  {
84  return clip( a, min_, max_ );
85  }
86  //**********************************************************************************************
87 
88  private:
89  //**Member variables****************************************************************************
90  DT min_;
91  DT max_;
92  //**********************************************************************************************
93 };
94 //*************************************************************************************************
95 
96 } // namespace blaze
97 
98 #endif
const ElementType_< MT > min(const DenseMatrix< MT, SO > &dm)
Returns the smallest element of the dense matrix.
Definition: DenseMatrix.h:1669
Header file for the clip shim.
const ElementType_< MT > max(const DenseMatrix< MT, SO > &dm)
Returns the largest element of the dense matrix.
Definition: DenseMatrix.h:1716
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
BLAZE_ALWAYS_INLINE auto operator()(const T &a) const
Returns the result of the clip() function for the given object/value.
Definition: Clip.h:82
Generic wrapper for the clip() function.
Definition: Clip.h:60
Clip(const DT &min, const DT &max)
Constructor of the Clip functor.
Definition: Clip.h:69
const DMatForEachExpr< MT, Clip< DT >, SO > clip(const DenseMatrix< MT, SO > &dm, const DT &min, const DT &max)
Restricts each single element of the dense matrix dm to the range .
Definition: DMatForEachExpr.h:1407
DT max_
The upper delimiter.
Definition: Clip.h:91
DT min_
The lower delimiter.
Definition: Clip.h:90
System settings for the inline keywords.