10 #ifndef EIGEN_GPU_SPECIALFUNCTIONS_H
11 #define EIGEN_GPU_SPECIALFUNCTIONS_H
20 #if defined(EIGEN_GPUCC) && defined(EIGEN_USE_GPU)
22 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
23 float4 plgamma<float4>(
const float4& a)
25 return make_float4(lgammaf(a.x), lgammaf(a.y), lgammaf(a.z), lgammaf(a.w));
28 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
29 double2 plgamma<double2>(
const double2& a)
35 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
36 float4 pdigamma<float4>(
const float4& a)
38 using numext::digamma;
42 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
43 double2 pdigamma<double2>(
const double2& a)
45 using numext::digamma;
49 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
50 float4 pzeta<float4>(
const float4& x,
const float4& q)
53 return make_float4(zeta(x.x, q.x), zeta(x.y, q.y), zeta(x.z, q.z), zeta(x.w, q.w));
56 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
57 double2 pzeta<double2>(
const double2& x,
const double2& q)
60 return make_double2(zeta(x.x, q.x), zeta(x.y, q.y));
63 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
64 float4 ppolygamma<float4>(
const float4& n,
const float4& x)
66 using numext::polygamma;
67 return make_float4(polygamma(n.x, x.x), polygamma(n.y, x.y), polygamma(n.z, x.z), polygamma(n.w, x.w));
70 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
71 double2 ppolygamma<double2>(
const double2& n,
const double2& x)
73 using numext::polygamma;
74 return make_double2(polygamma(n.x, x.x), polygamma(n.y, x.y));
77 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
78 float4 perf<float4>(
const float4& a)
80 return make_float4(erff(a.x), erff(a.y), erff(a.z), erff(a.w));
83 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
84 double2 perf<double2>(
const double2& a)
87 return make_double2(
erf(a.x),
erf(a.y));
90 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
91 float4 perfc<float4>(
const float4& a)
97 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
98 double2 perfc<double2>(
const double2& a)
101 return make_double2(
erfc(a.x),
erfc(a.y));
104 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
105 float4 pndtri<float4>(
const float4& a)
111 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
112 double2 pndtri<double2>(
const double2& a)
118 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
119 float4 pigamma<float4>(
const float4& a,
const float4& x)
121 using numext::igamma;
129 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
130 double2 pigamma<double2>(
const double2& a,
const double2& x)
132 using numext::igamma;
133 return make_double2(igamma(a.x, x.x), igamma(a.y, x.y));
137 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pigamma_der_a<float4>(
138 const float4& a,
const float4& x) {
139 using numext::igamma_der_a;
140 return make_float4(igamma_der_a(a.x, x.x), igamma_der_a(a.y, x.y),
141 igamma_der_a(a.z, x.z), igamma_der_a(a.w, x.w));
145 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
146 pigamma_der_a<double2>(
const double2& a,
const double2& x) {
147 using numext::igamma_der_a;
148 return make_double2(igamma_der_a(a.x, x.x), igamma_der_a(a.y, x.y));
152 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pgamma_sample_der_alpha<float4>(
153 const float4& alpha,
const float4& sample) {
154 using numext::gamma_sample_der_alpha;
156 gamma_sample_der_alpha(alpha.x, sample.x),
157 gamma_sample_der_alpha(alpha.y, sample.y),
158 gamma_sample_der_alpha(alpha.z, sample.z),
159 gamma_sample_der_alpha(alpha.w, sample.w));
163 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
164 pgamma_sample_der_alpha<double2>(
const double2& alpha,
const double2& sample) {
165 using numext::gamma_sample_der_alpha;
167 gamma_sample_der_alpha(alpha.x, sample.x),
168 gamma_sample_der_alpha(alpha.y, sample.y));
171 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
172 float4 pigammac<float4>(
const float4& a,
const float4& x)
174 using numext::igammac;
182 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
183 double2 pigammac<double2>(
const double2& a,
const double2& x)
185 using numext::igammac;
186 return make_double2(igammac(a.x, x.x), igammac(a.y, x.y));
189 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
190 float4 pbetainc<float4>(
const float4& a,
const float4& b,
const float4& x)
192 using numext::betainc;
194 betainc(a.x, b.x, x.x),
195 betainc(a.y, b.y, x.y),
196 betainc(a.z, b.z, x.z),
197 betainc(a.w, b.w, x.w));
200 template<> EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE
201 double2 pbetainc<double2>(
const double2& a,
const double2& b,
const double2& x)
203 using numext::betainc;
204 return make_double2(betainc(a.x, b.x, x.x), betainc(a.y, b.y, x.y));
208 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_i0e<float4>(
const float4& x) {
209 using numext::bessel_i0e;
210 return make_float4(bessel_i0e(x.x), bessel_i0e(x.y), bessel_i0e(x.z), bessel_i0e(x.w));
214 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
215 pbessel_i0e<double2>(
const double2& x) {
216 using numext::bessel_i0e;
217 return make_double2(bessel_i0e(x.x), bessel_i0e(x.y));
221 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_i0<float4>(
const float4& x) {
222 using numext::bessel_i0;
223 return make_float4(bessel_i0(x.x), bessel_i0(x.y), bessel_i0(x.z), bessel_i0(x.w));
227 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
228 pbessel_i0<double2>(
const double2& x) {
229 using numext::bessel_i0;
230 return make_double2(bessel_i0(x.x), bessel_i0(x.y));
234 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_i1e<float4>(
const float4& x) {
235 using numext::bessel_i1e;
236 return make_float4(bessel_i1e(x.x), bessel_i1e(x.y), bessel_i1e(x.z), bessel_i1e(x.w));
240 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
241 pbessel_i1e<double2>(
const double2& x) {
242 using numext::bessel_i1e;
243 return make_double2(bessel_i1e(x.x), bessel_i1e(x.y));
247 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_i1<float4>(
const float4& x) {
248 using numext::bessel_i1;
249 return make_float4(bessel_i1(x.x), bessel_i1(x.y), bessel_i1(x.z), bessel_i1(x.w));
253 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
254 pbessel_i1<double2>(
const double2& x) {
255 using numext::bessel_i1;
256 return make_double2(bessel_i1(x.x), bessel_i1(x.y));
260 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_k0e<float4>(
const float4& x) {
261 using numext::bessel_k0e;
262 return make_float4(bessel_k0e(x.x), bessel_k0e(x.y), bessel_k0e(x.z), bessel_k0e(x.w));
266 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
267 pbessel_k0e<double2>(
const double2& x) {
268 using numext::bessel_k0e;
269 return make_double2(bessel_k0e(x.x), bessel_k0e(x.y));
273 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_k0<float4>(
const float4& x) {
274 using numext::bessel_k0;
275 return make_float4(bessel_k0(x.x), bessel_k0(x.y), bessel_k0(x.z), bessel_k0(x.w));
279 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
280 pbessel_k0<double2>(
const double2& x) {
281 using numext::bessel_k0;
282 return make_double2(bessel_k0(x.x), bessel_k0(x.y));
286 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_k1e<float4>(
const float4& x) {
287 using numext::bessel_k1e;
288 return make_float4(bessel_k1e(x.x), bessel_k1e(x.y), bessel_k1e(x.z), bessel_k1e(x.w));
292 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
293 pbessel_k1e<double2>(
const double2& x) {
294 using numext::bessel_k1e;
295 return make_double2(bessel_k1e(x.x), bessel_k1e(x.y));
299 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_k1<float4>(
const float4& x) {
300 using numext::bessel_k1;
301 return make_float4(bessel_k1(x.x), bessel_k1(x.y), bessel_k1(x.z), bessel_k1(x.w));
305 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
306 pbessel_k1<double2>(
const double2& x) {
307 using numext::bessel_k1;
308 return make_double2(bessel_k1(x.x), bessel_k1(x.y));
312 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_j0<float4>(
const float4& x) {
313 using numext::bessel_j0;
314 return make_float4(bessel_j0(x.x), bessel_j0(x.y), bessel_j0(x.z), bessel_j0(x.w));
318 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
319 pbessel_j0<double2>(
const double2& x) {
320 using numext::bessel_j0;
321 return make_double2(bessel_j0(x.x), bessel_j0(x.y));
325 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_j1<float4>(
const float4& x) {
326 using numext::bessel_j1;
327 return make_float4(bessel_j1(x.x), bessel_j1(x.y), bessel_j1(x.z), bessel_j1(x.w));
331 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
332 pbessel_j1<double2>(
const double2& x) {
333 using numext::bessel_j1;
334 return make_double2(bessel_j1(x.x), bessel_j1(x.y));
338 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_y0<float4>(
const float4& x) {
339 using numext::bessel_y0;
340 return make_float4(bessel_y0(x.x), bessel_y0(x.y), bessel_y0(x.z), bessel_y0(x.w));
344 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
345 pbessel_y0<double2>(
const double2& x) {
346 using numext::bessel_y0;
347 return make_double2(bessel_y0(x.x), bessel_y0(x.y));
351 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE float4 pbessel_y1<float4>(
const float4& x) {
352 using numext::bessel_y1;
353 return make_float4(bessel_y1(x.x), bessel_y1(x.y), bessel_y1(x.z), bessel_y1(x.w));
357 EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE double2
358 pbessel_y1<double2>(
const double2& x) {
359 using numext::bessel_y1;
360 return make_double2(bessel_y1(x.x), bessel_y1(x.y));
369 #endif // EIGEN_GPU_SPECIALFUNCTIONS_H
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_ndtri_op< typename Derived::Scalar >, const Derived > ndtri(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_lgamma_op< typename Derived::Scalar >, const Derived > lgamma(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_erf_op< typename Derived::Scalar >, const Derived > erf(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_erfc_op< typename Derived::Scalar >, const Derived > erfc(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_digamma_op< typename Derived::Scalar >, const Derived > digamma(const Eigen::ArrayBase< Derived > &x)