Blaze 3.9
Hypot.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_SIMD_HYPOT_H_
36#define _BLAZE_MATH_SIMD_HYPOT_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#if BLAZE_SLEEF_MODE
44# include <sleef.h>
45#endif
47#include <blaze/system/Inline.h>
49
50
51namespace blaze {
52
53//=================================================================================================
54//
55// 32-BIT FLOATING POINT SIMD TYPES
56//
57//=================================================================================================
58
59//*************************************************************************************************
72template< typename T > // Type of the operand
73BLAZE_ALWAYS_INLINE const SIMDfloat hypot( const SIMDf32<T>& a, const SIMDf32<T>& b ) noexcept
74#if BLAZE_SVML_MODE
75# if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
76{
77 return _mm512_hypot_ps( (*a).eval().value, (*b).eval().value );
78}
79# elif BLAZE_AVX_MODE
80{
81 return _mm256_hypot_ps( (*a).eval().value, (*b).eval().value );
82}
83# elif BLAZE_SSE_MODE
84{
85 return _mm_hypot_ps( (*a).eval().value, (*b).eval().value );
86}
87# endif
88#elif BLAZE_SLEEF_MODE
89# if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
90{
91 return Sleef_hypotf16_u05avx512f( (*a).eval().value, (*b).eval().value );
92}
93# elif BLAZE_AVX2_MODE
94{
95 return Sleef_hypotf8_u05avx2( (*a).eval().value, (*b).eval().value );
96}
97# elif BLAZE_AVX_MODE
98{
99 return Sleef_hypotf8_u05avx( (*a).eval().value, (*b).eval().value );
100}
101# elif BLAZE_SSE_MODE
102{
103 return Sleef_hypotf4_u05( (*a).eval().value, (*b).eval().value );
104}
105# endif
106#elif BLAZE_XSIMD_MODE
107{
108 return SIMDfloat{ xsimd::hypot( xsimd::batch<float>{ (*a).eval().value },
109 xsimd::batch<float>{ (*b).eval().value } ).data };
110}
111#else
112= delete;
113#endif
114//*************************************************************************************************
115
116
117
118
119//=================================================================================================
120//
121// 64-BIT FLOATING POINT SIMD TYPES
122//
123//=================================================================================================
124
125//*************************************************************************************************
138template< typename T > // Type of the operand
139BLAZE_ALWAYS_INLINE const SIMDdouble hypot( const SIMDf64<T>& a, const SIMDf64<T>& b ) noexcept
140#if BLAZE_SVML_MODE
141# if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
142{
143 return _mm512_hypot_pd( (*a).eval().value, (*b).eval().value );
144}
145# elif BLAZE_AVX_MODE
146{
147 return _mm256_hypot_pd( (*a).eval().value, (*b).eval().value );
148}
149# elif BLAZE_SSE_MODE
150{
151 return _mm_hypot_pd( (*a).eval().value, (*b).eval().value );
152}
153# endif
154#elif BLAZE_SLEEF_MODE
155# if BLAZE_AVX512F_MODE || BLAZE_MIC_MODE
156{
157 return Sleef_hypotd8_u05avx512f( (*a).eval().value, (*b).eval().value );
158}
159# elif BLAZE_AVX2_MODE
160{
161 return Sleef_hypotd4_u05avx2( (*a).eval().value, (*b).eval().value );
162}
163# elif BLAZE_AVX_MODE
164{
165 return Sleef_hypotd4_u05avx( (*a).eval().value, (*b).eval().value );
166}
167# elif BLAZE_SSE_MODE
168{
169 return Sleef_hypotd2_u05( (*a).eval().value, (*b).eval().value );
170}
171# endif
172#elif BLAZE_XSIMD_MODE
173{
174 return SIMDdouble{ xsimd::hypot( xsimd::batch<double>{ (*a).eval().value },
175 xsimd::batch<double>{ (*b).eval().value } ).data };
176}
177#else
178= delete;
179#endif
180//*************************************************************************************************
181
182} // namespace blaze
183
184#endif
Header file for the basic SIMD types.
SIMD type for 64-bit double precision floating point data values.
SIMD type for 32-bit single precision floating point data values.
MT::ElementType * data(DenseMatrix< MT, SO > &dm) noexcept
Low-level data access to the dense matrix elements.
Definition: DenseMatrix.h:182
BLAZE_ALWAYS_INLINE const SIMDdouble hypot(const SIMDf64< T > &a, const SIMDf64< T > &b) noexcept=delete
Computes the length of the hypotenous of a right triangle of a vector of double precision floating po...
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
System settings for the inline keywords.
System settings for the SSE mode.