-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Uwe Hernandez Acosta
committed
Sep 13, 2024
1 parent
95042f4
commit 7aeb8f6
Showing
12 changed files
with
420 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
function Base.convert( | ||
::Type{B}, param::S | ||
) where {T<:Real,B<:AbstractAxisBoostParameter{T},S<:Real} | ||
return B(T(param)) | ||
end | ||
function Base.convert( | ||
::Type{B1}, d::B2 | ||
) where {T<:Real,B1<:AbstractAxisBoostParameter{T},B2<:AbstractAxisBoostParameter} | ||
return B1(T(d.param)) | ||
end | ||
function Base.convert( | ||
::Type{B1}, d::B2 | ||
) where {T<:Real,B1<:AbstractAxisBoostParameter{T},B2<:AbstractAxisBoostParameter{T}} | ||
return d | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
# TODO: | ||
# - test conversions | ||
# - decompose into separate files | ||
|
||
""" | ||
AbstractAxisBoostParameter{T} | ||
An abstract base type representing a boost parameter of type `T`, associated with a specific axis in space (e.g., ``x``, ``y``, or ``z``). | ||
This type serves as a foundation for concrete boost parameter types that define Lorentz boosts along individual spatial directions, The parameter `T` typically represents the data type for the boost value (e.g., `Float64`, `Float32`). | ||
### Usage | ||
Subtypes of `AbstractAxisBoostParameter{T}` are used to define specific boost transformations along a given axis (such as `BetaX` for the x-axis). These types are essential in performing Lorentz boosts, which transform four-momentum vectors between different inertial reference frames. | ||
This abstract type is meant to be extended by concrete types to represent boosts along different Cartesian axes. | ||
""" | ||
abstract type AbstractAxisBoostParameter{T} <: AbstractBoostParameter end | ||
|
||
function (::Type{BP})( | ||
boost_val::S | ||
) where {T<:Real,BP<:AbstractAxisBoostParameter{T},S<:Real} | ||
return BP(T(boost_val)) | ||
end | ||
|
||
Base.eltype(::AbstractAxisBoostParameter{T}) where {T} = T |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# TODO: | ||
# - add interaction with axis boosts | ||
# - add convenient constructors BetaVector(p) for the rest system? | ||
# - test constructor error | ||
|
||
""" | ||
AbstractBoostVector <: AbstractBoostParameter | ||
An abstract base type representing vector-like boost parameters, used to model Lorentz boosts | ||
in any spatial dimension. | ||
`AbstractBoostVector` extends `AbstractBoostParameter` and provides the framework for | ||
describing boosts that act in multiple spatial dimensions simultaneously, typically in | ||
three-dimensional space. This type is designed to support vector representations of | ||
velocities (in units of the speed of light) associated with Lorentz transformations in | ||
special relativity. | ||
## Usage | ||
Concrete subtypes of `AbstractBoostVector` represent specific boost vectors that describe | ||
the velocity components in each spatial dimension, such as `BetaVector`. These boost | ||
vectors are commonly used in transformations of four-vectors (e.g., four-momentum, | ||
four-position) between different reference frames. | ||
For example: | ||
- [`BetaVector{T}`](@ref): A concrete subtype representing a boost vector with velocity components ``\\beta_x``, ``\\beta_y``, and ``\\beta_z`` (in units of the speed of light). | ||
""" | ||
abstract type AbstractBoostVector <: AbstractBoostParameter end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
|
||
function Base.isapprox( | ||
b1::BetaVector, | ||
b2::BetaVector; | ||
atol::Real=0, | ||
rtol::Real=Base.rtoldefault(b1.x, b1.y, atol), | ||
nans::Bool=false, | ||
norm::Function=abs, | ||
) | ||
return isapprox(b1.x, b2.x; atol=atol, rtol=rtol, nans=nans, norm=norm) && | ||
isapprox(b1.y, b2.y; atol=atol, rtol=rtol, nans=nans, norm=norm) && | ||
isapprox(b1.z, b2.z; atol=atol, rtol=rtol, nans=nans, norm=norm) | ||
end |
Oops, something went wrong.