arch/AltiVec/MathFunctions.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2007 Julien Pommier
5 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>
6 // Copyright (C) 2016 Konstantinos Margaritis <markos@freevec.org>
7 //
8 // This Source Code Form is subject to the terms of the Mozilla
9 // Public License v. 2.0. If a copy of the MPL was not distributed
10 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
11 
12 #ifndef EIGEN_MATH_FUNCTIONS_ALTIVEC_H
13 #define EIGEN_MATH_FUNCTIONS_ALTIVEC_H
14 
15 #include "../../InternalHeaderCheck.h"
16 
17 namespace Eigen {
18 
19 namespace internal {
20 
22 #ifdef EIGEN_VECTORIZE_VSX
24 #endif
25 
26 #ifdef EIGEN_VECTORIZE_VSX
29 {
30  return vec_sqrt(x);
31 }
32 
35 {
36  return vec_sqrt(x);
37 }
38 
39 #if !EIGEN_COMP_CLANG
42 {
43  return pset1<Packet4f>(1.0f) / psqrt<Packet4f>(x);
44 // vec_rsqrt returns different results from the generic version
45 // return vec_rsqrt(x);
46 }
47 
50 {
51  return pset1<Packet2d>(1.0) / psqrt<Packet2d>(x);
52 // vec_rsqrt returns different results from the generic version
53 // return vec_rsqrt(x);
54 }
55 
56 #endif
57 
58 template<> EIGEN_STRONG_INLINE Packet8bf psqrt<Packet8bf> (const Packet8bf& a){
60 }
61 
62 #if !EIGEN_COMP_CLANG
63 template<> EIGEN_STRONG_INLINE Packet8bf prsqrt<Packet8bf> (const Packet8bf& a){
65 }
66 #endif
67 #else
70 {
71  Packet4f a;
72  for (Index i = 0; i < packet_traits<float>::size; i++) {
73  a[i] = numext::sqrt(x[i]);
74  }
75  return a;
76 }
77 #endif
78 
79 } // end namespace internal
80 
81 } // end namespace Eigen
82 
83 #endif // EIGEN_MATH_FUNCTIONS_ALTIVEC_H
#define BF16_TO_F32_UNARY_OP_WRAPPER(OP, A)
#define EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_DOUBLE(PACKET)
#define EIGEN_INSTANTIATE_GENERIC_MATH_FUNCS_FLOAT(PACKET)
#define EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS
Definition: Macros.h:892
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet4f psqrt< Packet4f >(const Packet4f &x)
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet2d prsqrt< Packet2d >(const Packet2d &x)
eigen_packet_wrapper< __vector unsigned short int, 0 > Packet8bf
Packet2d pset1< Packet2d >(const double &from)
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet2d psqrt< Packet2d >(const Packet2d &x)
Packet4f pset1< Packet4f >(const float &from)
EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS Packet4f prsqrt< Packet4f >(const Packet4f &x)
__vector float Packet4f
EIGEN_ALWAYS_INLINE float sqrt(const float &x)
: InteropHeaders
Definition: Core:139
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:82