Skip to content

Commit

Permalink
force inline
Browse files Browse the repository at this point in the history
  • Loading branch information
s-m-e committed Jan 30, 2024
1 parent 94f6dca commit 52bdf1d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 37 deletions.
38 changes: 19 additions & 19 deletions src/hapsira/core/angles.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
]


@hjit("f(f,f)")
@hjit("f(f,f)", inline=True)
def E_to_M_hf(E, ecc):
r"""Mean anomaly from eccentric anomaly.
Expand Down Expand Up @@ -99,7 +99,7 @@ def E_to_M_vf(E, ecc):
return E_to_M_hf(E, ecc)


@hjit("f(f,f)")
@hjit("f(f,f)", inline=True)
def F_to_M_hf(F, ecc):
r"""Mean anomaly from hyperbolic anomaly.
Expand Down Expand Up @@ -140,27 +140,27 @@ def F_to_M_vf(F, ecc):
return F_to_M_hf(F, ecc)


@hjit("f(f,f,f)")
@hjit("f(f,f,f)", inline=True)
def kepler_equation_hf(E, M, ecc):
return E_to_M_hf(E, ecc) - M


@hjit("f(f,f,f)")
@hjit("f(f,f,f)", inline=True)
def kepler_equation_prime_hf(E, M, ecc):
return 1 - ecc * cos(E)


@hjit("f(f,f,f)")
@hjit("f(f,f,f)", inline=True)
def kepler_equation_hyper_hf(F, M, ecc):
return F_to_M_hf(F, ecc) - M


@hjit("f(f,f,f)")
@hjit("f(f,f,f)", inline=True)
def kepler_equation_prime_hyper_hf(F, M, ecc):
return ecc * cosh(F) - 1


@hjit("f(f,f,f,f,i8)")
@hjit("f(f,f,f,f,i8)", inline=True)
def _newton_elliptic_hf(p0, M, ecc, tol, maxiter):
for _ in range(maxiter):
fval = kepler_equation_hf(p0, M, ecc)
Expand All @@ -173,7 +173,7 @@ def _newton_elliptic_hf(p0, M, ecc, tol, maxiter):
return nan


@hjit("f(f,f,f,f,i8)")
@hjit("f(f,f,f,f,i8)", inline=True)
def _newton_hyperbolic_hf(p0, M, ecc, tol, maxiter):
for _ in range(maxiter):
fval = kepler_equation_hyper_hf(p0, M, ecc)
Expand All @@ -186,7 +186,7 @@ def _newton_hyperbolic_hf(p0, M, ecc, tol, maxiter):
return nan


@hjit("f(f)")
@hjit("f(f)", inline=True)
def D_to_nu_hf(D):
r"""True anomaly from parabolic anomaly.
Expand Down Expand Up @@ -221,7 +221,7 @@ def D_to_nu_vf(D):
return D_to_nu_hf(D)


@hjit("f(f)")
@hjit("f(f)", inline=True)
def nu_to_D_hf(nu):
r"""Parabolic anomaly from true anomaly.
Expand Down Expand Up @@ -282,7 +282,7 @@ def nu_to_D_vf(nu):
return nu_to_D_hf(nu)


@hjit("f(f,f)")
@hjit("f(f,f)", inline=True)
def nu_to_E_hf(nu, ecc):
r"""Eccentric anomaly from true anomaly.
Expand Down Expand Up @@ -327,7 +327,7 @@ def nu_to_E_vf(nu, ecc):
return nu_to_E_hf(nu, ecc)


@hjit("f(f,f)")
@hjit("f(f,f)", inline=True)
def nu_to_F_hf(nu, ecc):
r"""Hyperbolic anomaly from true anomaly.
Expand Down Expand Up @@ -372,7 +372,7 @@ def nu_to_F_vf(nu, ecc):
return nu_to_F_hf(nu, ecc)


@hjit("f(f,f)")
@hjit("f(f,f)", inline=True)
def E_to_nu_hf(E, ecc):
r"""True anomaly from eccentric anomaly.
Expand Down Expand Up @@ -417,7 +417,7 @@ def E_to_nu_vf(E, ecc):
return E_to_nu_hf(E, ecc)


@hjit("f(f,f)")
@hjit("f(f,f)", inline=True)
def F_to_nu_hf(F, ecc):
r"""True anomaly from hyperbolic anomaly.
Expand Down Expand Up @@ -455,7 +455,7 @@ def F_to_nu_vf(F, ecc):
return F_to_nu_hf(F, ecc)


@hjit("f(f,f)")
@hjit("f(f,f)", inline=True)
def M_to_E_hf(M, ecc):
"""Eccentric anomaly from mean anomaly.
Expand Down Expand Up @@ -495,7 +495,7 @@ def M_to_E_vf(M, ecc):
return M_to_E_hf(M, ecc)


@hjit("f(f,f)")
@hjit("f(f,f)", inline=True)
def M_to_F_hf(M, ecc):
"""Hyperbolic anomaly from mean anomaly.
Expand Down Expand Up @@ -530,7 +530,7 @@ def M_to_F_vf(M, ecc):
return M_to_F_hf(M, ecc)


@hjit("f(f)")
@hjit("f(f)", inline=True)
def M_to_D_hf(M):
"""Parabolic anomaly from mean anomaly.
Expand Down Expand Up @@ -564,7 +564,7 @@ def M_to_D_vf(M):
return M_to_D_hf(M)


@hjit("f(f)")
@hjit("f(f)", inline=True)
def D_to_M_hf(D):
r"""Mean anomaly from parabolic anomaly.
Expand Down Expand Up @@ -606,7 +606,7 @@ def D_to_M_vf(D):
return D_to_M_hf(D)


@hjit("f(f,f)")
@hjit("f(f,f)", inline=True)
def fp_angle_hf(nu, ecc):
r"""Returns the flight path angle.
Expand Down
36 changes: 18 additions & 18 deletions src/hapsira/core/math/linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@
]


@hjit("V(V)")
@hjit("V(V)", inline=True)
def abs_V_hf(x):
return abs(x[0]), abs(x[1]), abs(x[2])


@hjit("V(V,f)")
@hjit("V(V,f)", inline=True)
def add_Vs_hf(a, b):
return a[0] + b, a[1] + b, a[2] + b


@hjit("V(V,V)")
@hjit("V(V,V)", inline=True)
def add_VV_hf(a, b):
return a[0] + b[0], a[1] + b[1], a[2] + b[2]


@hjit("V(V,V)")
@hjit("V(V,V)", inline=True)
def cross_VV_hf(a, b):
return (
a[1] * b[2] - a[2] * b[1],
Expand All @@ -50,7 +50,7 @@ def cross_VV_hf(a, b):
)


@hjit("f(f,f)")
@hjit("f(f,f)", inline=True)
def div_ss_hf(a, b):
"""
Similar to np.divide
Expand All @@ -60,17 +60,17 @@ def div_ss_hf(a, b):
return a / b


@hjit("V(V,V)")
@hjit("V(V,V)", inline=True)
def div_VV_hf(x, y):
return x[0] / y[0], x[1] / y[1], x[2] / y[2]


@hjit("V(V,f)")
@hjit("V(V,f)", inline=True)
def div_Vs_hf(v, s):
return v[0] / s, v[1] / s, v[2] / s


@hjit("M(M,M)")
@hjit("M(M,M)", inline=True)
def matmul_MM_hf(a, b):
return (
(
Expand All @@ -91,7 +91,7 @@ def matmul_MM_hf(a, b):
)


@hjit("V(V,M)")
@hjit("V(V,M)", inline=True)
def matmul_VM_hf(a, b):
return (
a[0] * b[0][0] + a[1] * b[1][0] + a[2] * b[2][0],
Expand All @@ -100,12 +100,12 @@ def matmul_VM_hf(a, b):
)


@hjit("f(V,V)")
@hjit("f(V,V)", inline=True)
def matmul_VV_hf(a, b):
return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]


@hjit("V(V,V)")
@hjit("V(V,V)", inline=True)
def max_VV_hf(x, y):
return (
x[0] if x[0] > y[0] else y[0],
Expand All @@ -114,12 +114,12 @@ def max_VV_hf(x, y):
)


@hjit("V(V,f)")
@hjit("V(V,f)", inline=True)
def mul_Vs_hf(v, s):
return v[0] * s, v[1] * s, v[2] * s


@hjit("V(V,V)")
@hjit("V(V,V)", inline=True)
def mul_VV_hf(a, b):
return a[0] * b[0], a[1] * b[1], a[2] * b[2]

Expand All @@ -131,7 +131,7 @@ def nextafter_hf(x, direction):
return x - EPS


@hjit("f(V)")
@hjit("f(V)", inline=True)
def norm_V_hf(a):
return sqrt(matmul_VV_hf(a, a))

Expand All @@ -142,12 +142,12 @@ def norm_V_vf(a, b, c):
return norm_V_hf((a, b, c))


@hjit("f(V,V)")
@hjit("f(V,V)", inline=True)
def norm_VV_hf(x, y):
return sqrt(x[0] ** 2 + x[1] ** 2 + x[2] ** 2 + y[0] ** 2 + y[1] ** 2 + y[2] ** 2)


@hjit("f(f)")
@hjit("f(f)", inline=True)
def sign_hf(x):
if x < 0.0:
return -1.0
Expand All @@ -156,12 +156,12 @@ def sign_hf(x):
return 1.0 # if x > 0


@hjit("V(V,V)")
@hjit("V(V,V)", inline=True)
def sub_VV_hf(va, vb):
return va[0] - vb[0], va[1] - vb[1], va[2] - vb[2]


@hjit("M(M)")
@hjit("M(M)", inline=True)
def transpose_M_hf(a):
return (
(a[0][0], a[1][0], a[2][0]),
Expand Down

0 comments on commit 52bdf1d

Please sign in to comment.