Hypot.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_FUNCTORS_HYPOT_H_
36 #define _BLAZE_MATH_FUNCTORS_HYPOT_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
44 #include <blaze/math/shims/Hypot.h>
45 #include <blaze/math/simd/Hypot.h>
59 #include <blaze/system/Inline.h>
61 
62 
63 namespace blaze {
64 
65 //=================================================================================================
66 //
67 // CLASS DEFINITION
68 //
69 //=================================================================================================
70 
71 //*************************************************************************************************
75 struct Hypot
76 {
77  //**********************************************************************************************
80  explicit inline Hypot()
81  {}
82  //**********************************************************************************************
83 
84  //**********************************************************************************************
91  template< typename T1, typename T2 >
92  BLAZE_ALWAYS_INLINE decltype(auto) operator()( const T1& a, const T2& b ) const
93  {
94  return hypot( a, b );
95  }
96  //**********************************************************************************************
97 
98  //**********************************************************************************************
103  template< typename T1, typename T2 >
104  static constexpr bool simdEnabled() { return HasSIMDHypot_v<T1,T2>; }
105  //**********************************************************************************************
106 
107  //**********************************************************************************************
112  static constexpr bool paddingEnabled() { return true; }
113  //**********************************************************************************************
114 
115  //**********************************************************************************************
122  template< typename T1, typename T2 >
123  BLAZE_ALWAYS_INLINE decltype(auto) load( const T1& a, const T2& b ) const
124  {
127  return hypot( a, b );
128  }
129  //**********************************************************************************************
130 };
131 //*************************************************************************************************
132 
133 
134 
135 
136 //=================================================================================================
137 //
138 // YIELDSUNIFORM SPECIALIZATIONS
139 //
140 //=================================================================================================
141 
142 //*************************************************************************************************
144 template< typename T1, typename T2 >
145 struct YieldsUniform<Hypot,T1,T2>
146  : public BoolConstant< IsUniform_v<T1> && IsUniform_v<T2> >
147 {};
149 //*************************************************************************************************
150 
151 
152 
153 
154 //=================================================================================================
155 //
156 // YIELDSSYMMETRIC SPECIALIZATIONS
157 //
158 //=================================================================================================
159 
160 //*************************************************************************************************
162 template< typename MT1, typename MT2 >
163 struct YieldsSymmetric<Hypot,MT1,MT2>
164  : public BoolConstant< IsSymmetric_v<MT1> && IsSymmetric_v<MT2> >
165 {};
167 //*************************************************************************************************
168 
169 
170 
171 
172 //=================================================================================================
173 //
174 // YIELDSLOWER SPECIALIZATIONS
175 //
176 //=================================================================================================
177 
178 //*************************************************************************************************
180 template< typename MT1, typename MT2 >
181 struct YieldsLower<Hypot,MT1,MT2>
182  : public BoolConstant< IsLower_v<MT1> && IsLower_v<MT2> >
183 {};
185 //*************************************************************************************************
186 
187 
188 
189 
190 //=================================================================================================
191 //
192 // YIELDSSTRICTLYLOWER SPECIALIZATIONS
193 //
194 //=================================================================================================
195 
196 //*************************************************************************************************
198 template< typename MT1, typename MT2 >
199 struct YieldsStrictlyLower<Hypot,MT1,MT2>
200  : public BoolConstant< IsStrictlyLower_v<MT1> && IsStrictlyLower_v<MT2> >
201 {};
203 //*************************************************************************************************
204 
205 
206 
207 
208 //=================================================================================================
209 //
210 // YIELDSUPPER SPECIALIZATIONS
211 //
212 //=================================================================================================
213 
214 //*************************************************************************************************
216 template< typename MT1, typename MT2 >
217 struct YieldsUpper<Hypot,MT1,MT2>
218  : public BoolConstant< IsUpper_v<MT1> && IsUpper_v<MT2> >
219 {};
221 //*************************************************************************************************
222 
223 
224 
225 
226 //=================================================================================================
227 //
228 // YIELDSSTRICTLYUPPER SPECIALIZATIONS
229 //
230 //=================================================================================================
231 
232 //*************************************************************************************************
234 template< typename MT1, typename MT2 >
235 struct YieldsStrictlyUpper<Hypot,MT1,MT2>
236  : public BoolConstant< IsStrictlyUpper_v<MT1> && IsStrictlyUpper_v<MT2> >
237 {};
239 //*************************************************************************************************
240 
241 } // namespace blaze
242 
243 #endif
decltype(auto) hypot(const DenseMatrix< MT1, SO1 > &lhs, const DenseMatrix< MT2, SO2 > &rhs)
Computes the componentwise hypotenous for the dense matrices lhs and rhs.
Definition: DMatDMatMapExpr.h:1211
Header file for the YieldsStrictlyLower type trait.
static constexpr bool paddingEnabled()
Returns whether the operation supports padding, i.e. whether it can deal with zeros.
Definition: Hypot.h:112
Hypot()
Default constructor of the Hypot functor.
Definition: Hypot.h:80
#define BLAZE_CONSTRAINT_MUST_BE_SIMD_PACK(T)
Constraint on the data type.In case the given data type T is not a SIMD pack, a compilation error is ...
Definition: SIMDPack.h:60
Header file for the IsUniform type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for the YieldsStrictlyUpper type trait.
Header file for the SIMD hypothenous functionality.
decltype(auto) BLAZE_ALWAYS_INLINE load(const T1 &a, const T2 &b) const
Returns the result of the hypot() function for the given SIMD vectors.
Definition: Hypot.h:123
Header file for the IsLower type trait.
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
Header file for the YieldsUniform type trait.
Header file for the YieldsSymmetric type trait.
Header file for the YieldsUpper type trait.
Header file for the hypot shim.
Header file for the YieldsLower type trait.
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant class template represents ...
Definition: IntegralConstant.h:101
Generic wrapper for the hypot() function.
Definition: Hypot.h:75
Header file for the IntegralConstant class template.
Header file for the IsUpper type trait.
Header file for the HasSIMDHypot type trait.
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data types T1 and T2.
Definition: Hypot.h:104
System settings for the inline keywords.