Clamp.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_SHIMS_CLAMP_H_
36 #define _BLAZE_MATH_SHIMS_CLAMP_H_
37 
38 
39 namespace blaze {
40 
41 //=================================================================================================
42 //
43 // CLAMP SHIM
44 //
45 //=================================================================================================
46 
47 //*************************************************************************************************
70 template< typename T >
71 inline const T& clamp( const T& a, const T& min, const T& max ) noexcept
72 {
73  if( a < min )
74  return min;
75  else if( max < a )
76  return max;
77  else return a;
78 }
80 //*************************************************************************************************
81 
82 } // namespace blaze
83 
84 #endif
decltype(auto) clamp(const DenseMatrix< MT, SO > &dm, const DT &min, const DT &max)
Restricts each single element of the dense matrix dm to the range .
Definition: DMatMapExpr.h:1581
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
decltype(auto) min(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise minimum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1147
decltype(auto) max(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise maximum of the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1179