Skip to content

Commit 598331e

Browse files
committed
WIP trait implementations
1 parent ee66248 commit 598331e

File tree

7 files changed

+13
-11
lines changed

7 files changed

+13
-11
lines changed

include/alpaka/math/asin/AsinUniformCudaHipBuiltIn.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ namespace alpaka
5959
{
6060
// This holds everywhere, including the branch cuts: asin(z) = i * ln(sqrt(1 - z^2) - i * z)
6161
return Complex<T>(0.0, 1.0)
62-
* log(acos_ctx, sqrt(acos_ctx, T(1.0) - arg * arg) - Complex<T>(0.0, 1.0) * arg);
62+
* log(asin_ctx, sqrt(asin_ctx, T(1.0) - arg * arg) - Complex<T>(0.0, 1.0) * arg);
6363
}
6464
};
6565
} // namespace traits

include/alpaka/math/atan/AtanUniformCudaHipBuiltIn.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ namespace alpaka
5858
{
5959
// This holds everywhere, including the branch cuts: atan(z) = -i/2 * ln((i - z) / (i + z))
6060
return Complex<T>{0.0, -0.5}
61-
* log(acos_ctx, (Complex<T>{0.0, 1.0} + arg) / (Complex<T>{0.0, 1.0} + arg));
61+
* log(atan_ctx, (Complex<T>{0.0, 1.0} + arg) / (Complex<T>{0.0, 1.0} + arg));
6262
}
6363
};
6464
} // namespace traits

include/alpaka/math/cos/CosUniformCudaHipBuiltIn.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,12 @@ namespace alpaka
5757
__device__ auto operator()(CosUniformCudaHipBuiltIn const& cos_ctx, Complex<T> const& arg)
5858
{
5959
// cos(z) = 0.5 * (exp(i * z) + exp(-i * z))
60-
return T(0.5) * (exp(cos_ctx, Complex<T>{0.0, 1.0) * arg) + exp(cos_ctx, Complex<T>{0.0, -1.0) * arg));
60+
return T(0.5)
61+
* (exp(cos_ctx, Complex<T>{0.0, 1.0} * arg) + exp(cos_ctx, Complex<T>{0.0, -1.0} * arg));
6162
}
6263
};
63-
} // namespace traits
64-
} // namespace math
64+
} // namespace traits
65+
} // namespace math
6566
} // namespace alpaka
6667

6768
#endif

include/alpaka/math/exp/ExpUniformCudaHipBuiltIn.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ namespace alpaka
5252
}
5353
};
5454
//! The CUDA/HIP exp Complex<T> specialization.
55-
template<template T>
55+
template<typename T>
5656
struct Exp<ExpUniformCudaHipBuiltIn, Complex<T>>
5757
{
5858
__device__ auto operator()(ExpUniformCudaHipBuiltIn const& exp_ctx, Complex<T> const& arg)

include/alpaka/math/rsqrt/RsqrtUniformCudaHipBuiltIn.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace alpaka
5555
{
5656
__device__ auto operator()(RsqrtUniformCudaHipBuiltIn const& rsqrt_ctx, Complex<T> const& arg)
5757
{
58-
return T{1.0} / sqrt(rsqrt_ctx, arg) l
58+
return T{1.0} / sqrt(rsqrt_ctx, arg);
5959
}
6060
};
6161
} // namespace traits

include/alpaka/math/sin/SinUniformCudaHipBuiltIn.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,12 @@ namespace alpaka
5757
__device__ auto operator()(SinUniformCudaHipBuiltIn const& sin_ctx, Complex<T> const& arg)
5858
{
5959
// sin(z) = (exp(i * z) - exp(-i * z)) / 2i
60-
return (exp(cos_ctx, Complex<T>{0.0, 1.0) * arg) - exp(cos_ctx, Complex<T>{0.0, -1.0) * arg)) / Complex<T>{0.0, 2.0};
60+
return (exp(sin_ctx, Complex<T>{0.0, 1.0} * arg) - exp(sin_ctx, Complex<T>{0.0, -1.0} * arg))
61+
/ Complex<T>{0.0, 2.0};
6162
}
6263
};
63-
} // namespace traits
64-
} // namespace math
64+
} // namespace traits
65+
} // namespace math
6566
} // namespace alpaka
6667

6768
#endif

include/alpaka/math/tan/TanUniformCudaHipBuiltIn.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ namespace alpaka
5959
// tan(z) = i * (e^-iz - e^iz) / (e^-iz + e^iz)
6060
auto const exp1 = exp(tan_ctx, Complex<T>{0.0, -1.0} * arg);
6161
auto const exp2 = exp(tan_ctx, Complex<T>{0.0, 1.0} * arg);
62-
return Complex{0.0, 1.0} * (exp1 - exp2) / (exp1 + exp2);
62+
return Complex<T>{0.0, 1.0} * (exp1 - exp2) / (exp1 + exp2);
6363
}
6464
};
6565
} // namespace traits

0 commit comments

Comments
 (0)