Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Common/MathUtils/include/MathUtils/Utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ inline double angle2Alphad(double phi)
return detail::angle2Alpha<double>(phi);
}

GPUhdi() float fastATan2(float y, float x)
GPUhdi() constexpr float fastATan2(float y, float x)
{
return detail::fastATan2<float>(y, x);
}

GPUhdi() double fastATan2d(double y, double x)
GPUhdi() constexpr double fastATan2d(double y, double x)
{
return detail::fastATan2<double>(y, x);
}
Expand Down
2 changes: 1 addition & 1 deletion Common/MathUtils/include/MathUtils/detail/basicMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace detail
{

template <typename T>
GPUhdi() T copysign(T x, T y)
GPUhdi() constexpr T copysign(T x, T y)
{
return o2::gpu::GPUCommonMath::Copysign(x, y);
}
Expand Down
4 changes: 2 additions & 2 deletions Common/MathUtils/include/MathUtils/detail/trigonometric.h
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ GPUhdi() constexpr T deltaPhiSmall(T phi0, T phi1)
}

template <typename T>
GPUhdi() T fastATan2(T y, T x)
GPUhdi() constexpr T fastATan2(T y, T x)
{
// Fast atan2(y,x) for any angle [-Pi,Pi]
// Average inaccuracy: 0.00048
Expand All @@ -283,7 +283,7 @@ GPUhdi() T fastATan2(T y, T x)
// https://stackoverflow.com/questions/42537957/fast-accurate-atan-arctan-approximation-algorithm
constexpr T A = 0.0776509570923569;
constexpr T B = -0.287434475393028;
constexpr T C = (Pi / 4 - A - B);
constexpr T C = ((Pi / 4) - A - B);
const T a2 = a * a;
return ((A * a2 + B) * a2 + C) * a;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
#ifndef O2_ITS_TRACKING_MATHUTILS_H_
#define O2_ITS_TRACKING_MATHUTILS_H_

#include <cstdint>

#include "CommonConstants/MathConstants.h"
#include "ITStracking/Constants.h"
#include "MathUtils/Utils.h"
Expand All @@ -27,7 +25,7 @@
namespace o2::its::math_utils
{

GPUhdi() float computePhi(float x, float y)
GPUhdi() constexpr float computePhi(float x, float y)
{
return o2::math_utils::fastATan2(-y, -x) + o2::constants::math::PI;
}
Expand Down