Skip to content

Commit

Permalink
force inline
Browse files Browse the repository at this point in the history
  • Loading branch information
BrendanKKrueger committed Oct 2, 2024
1 parent 51d11c8 commit df8f052
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions spiner/transformations.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,23 @@ namespace Spiner {
// linear transformation (aka no-op): y = x
struct TransformLinear {
template <typename T>
PORTABLE_INLINE_FUNCTION static T forward(const T x) {
PORTABLE_FORCEINLINE_FUNCTION static T forward(const T x) {
return x;
}
template <typename T>
PORTABLE_INLINE_FUNCTION static T reverse(const T u) {
PORTABLE_FORCEINLINE_FUNCTION static T reverse(const T u) {
return u;
}
};

// logarithmic transformation: y = log(x + small)
struct TransformLogarithmic {
template <typename T>
PORTABLE_INLINE_FUNCTION static T forward(const T x) {
return std::log(std::abs(x) + std::numeric_limits<T>::denorm_min());
PORTABLE_FORCEINLINE_FUNCTION static T forward(const T x) {
return std::log(std::abs(x) + std::numeric_limits<T>::denorm_min());
}
template <typename T>
PORTABLE_INLINE_FUNCTION static T reverse(const T u) {
PORTABLE_FORCEINLINE_FUNCTION static T reverse(const T u) {
return std::exp(u) - std::numeric_limits<T>::denorm_min();
}
};
Expand Down

0 comments on commit df8f052

Please sign in to comment.