diff --git a/src/QEDbase.jl b/src/QEDbase.jl index 5f955d9..1bde44d 100644 --- a/src/QEDbase.jl +++ b/src/QEDbase.jl @@ -1,6 +1,6 @@ module QEDbase -import Base: * +import Base: *, / import StaticArrays: similar_type export minkowski_dot, mdot, register_LorentzVectorLike diff --git a/src/interfaces/lorentz_vectors/arithmetic.jl b/src/interfaces/lorentz_vectors/arithmetic.jl index 2247eaa..f7ef976 100644 --- a/src/interfaces/lorentz_vectors/arithmetic.jl +++ b/src/interfaces/lorentz_vectors/arithmetic.jl @@ -1,3 +1,16 @@ +# TODO: these overloads shouldn't be necessary, but are for some reason +@inline function *(L::TL, NUM::Number) where {TL<:AbstractLorentzVector} + return constructorof(TL)(L[1] * NUM, L[2] * NUM, L[3] * NUM, L[4] * NUM) +end + +@inline function *(NUM::Number, L::TL) where {TL<:AbstractLorentzVector} + return constructorof(TL)(L[1] * NUM, L[2] * NUM, L[3] * NUM, L[4] * NUM) +end + +@inline function /(L::TL, NUM::Number) where {TL<:AbstractLorentzVector} + return constructorof(TL)(L[1] / NUM, L[2] / NUM, L[3] / NUM, L[4] / NUM) +end + function dot(p1::T1, p2::T2) where {T1<:AbstractLorentzVector,T2<:AbstractLorentzVector} return mdot(p1, p2) end