From ea741b3df2f7b0880baf535154421ae45d51a2ab Mon Sep 17 00:00:00 2001 From: Anton Reinhard Date: Wed, 23 Oct 2024 11:00:32 +0200 Subject: [PATCH] Remove base patch (#71) Merge after #69 This deletes the QEDbase patch which is no longer necessary as the relevant PR in QEDbase was merged. Unfortunately, there seems to be a somewhat strange interaction of doubly defined typenames and `@reexport`, creating an issue in QEDbase's documentation building. This means that I had to remove some `@extref` statements for now that can be readded later, when QEDbase is ready. --- .gitlab-ci.yml | 24 ++- docs/src/library/lorentzboosts.md | 1 - src/QEDcore.jl | 2 - .../boost_parameter/boost_axis/beta.jl | 6 +- .../boost_parameter/boost_axis/types.jl | 2 +- .../boost_parameter/boost_vector/beta.jl | 4 +- .../boost_parameter/boost_vector/types.jl | 6 +- src/lorentz_boost/types.jl | 13 +- src/patch_QEDbase.jl | 170 ------------------ 9 files changed, 32 insertions(+), 196 deletions(-) delete mode 100644 src/patch_QEDbase.jl diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 7f64d6c..ad0de8e 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,10 +4,18 @@ stages: - run_integration_test - verify-unit-test-deps -.untit_test_template: +.unit_test_template: stage: unit-test script: - apt update && apt install -y git + - git clone --depth 1 -b dev https://github.com/QEDjl-project/QuantumElectrodynamics.jl.git /QEDjl + - > + if [[ $CI_COMMIT_BRANCH == "main" || $CI_COMMIT_REF_NAME == "main" || $CI_COMMIT_BRANCH == "dev" || $CI_COMMIT_REF_NAME == "dev" ]]; then + # set name of the commit message from CI_COMMIT_MESSAGE to NO_MESSAGE, that the script does not read accidentally custom packages from the commit message of a merge commit + julia --project=. /QEDjl/.ci/SetupDevEnv/src/SetupDevEnv.jl ${CI_PROJECT_DIR}/Project.toml NO_MESSAGE + else + julia --project=. /QEDjl/.ci/SetupDevEnv/src/SetupDevEnv.jl ${CI_PROJECT_DIR}/Project.toml + fi - julia --project=. -e 'import Pkg; Pkg.instantiate()' - julia --project=. -e 'import Pkg; Pkg.test(; coverage = true)' interruptible: true @@ -15,35 +23,35 @@ stages: - cpuonly unit_tests_releases: - extends: .untit_test_template + extends: .unit_test_template parallel: matrix: - JULIA_VERSION: ["1.10", "1.11", "rc"] image: julia:$JULIA_VERSION unit_tests_nightly: - extends: .untit_test_template + extends: .unit_test_template # use the same baseimage like the official julia images image: debian:bookworm-slim variables: # path where julia tar bal should be downloaded - JULIA_DONWLOAD: /julia/download + JULIA_DOWNLOAD: /julia/download # path where julia should be extracted JULIA_EXTRACT: /julia/extract before_script: - apt update && apt install -y wget - - mkdir -p $JULIA_DONWLOAD + - mkdir -p $JULIA_DOWNLOAD - mkdir -p $JULIA_EXTRACT - > if [[ $CI_RUNNER_EXECUTABLE_ARCH == "linux/arm64" ]]; then - wget https://julialangnightlies-s3.julialang.org/bin/linux/aarch64/julia-latest-linux-aarch64.tar.gz -O $JULIA_DONWLOAD/julia-nightly.tar.gz + wget https://julialangnightlies-s3.julialang.org/bin/linux/aarch64/julia-latest-linux-aarch64.tar.gz -O $JULIA_DOWNLOAD/julia-nightly.tar.gz elif [[ $CI_RUNNER_EXECUTABLE_ARCH == "linux/amd64" ]]; then - wget https://julialangnightlies-s3.julialang.org/bin/linux/x86_64/julia-latest-linux-x86_64.tar.gz -O $JULIA_DONWLOAD/julia-nightly.tar.gz + wget https://julialangnightlies-s3.julialang.org/bin/linux/x86_64/julia-latest-linux-x86_64.tar.gz -O $JULIA_DOWNLOAD/julia-nightly.tar.gz else echo "unknown runner architecture -> $CI_RUNNER_EXECUTABLE_ARCH" exit 1 fi - - tar -xf $JULIA_DONWLOAD/julia-nightly.tar.gz -C $JULIA_EXTRACT + - tar -xf $JULIA_DOWNLOAD/julia-nightly.tar.gz -C $JULIA_EXTRACT # we need to search for the julia base folder name, because the second part of the name is the git commit hash # e.g. julia-b0c6781676f - JULIA_EXTRACT_FOLDER=${JULIA_EXTRACT}/$(ls $JULIA_EXTRACT | grep -m1 julia) diff --git a/docs/src/library/lorentzboosts.md b/docs/src/library/lorentzboosts.md index b148fb3..d467e12 100644 --- a/docs/src/library/lorentzboosts.md +++ b/docs/src/library/lorentzboosts.md @@ -12,5 +12,4 @@ BetaVector BetaX BetaY BetaZ -AbstractCoordinateTransformation ``` diff --git a/src/QEDcore.jl b/src/QEDcore.jl index c73e9fd..56a1d3b 100644 --- a/src/QEDcore.jl +++ b/src/QEDcore.jl @@ -38,8 +38,6 @@ using SimpleTraits @reexport using QEDbase -include("patch_QEDbase.jl") - include("algebraic_objects/dirac_tensors/types.jl") include("algebraic_objects/dirac_tensors/multiplication.jl") diff --git a/src/lorentz_boost/boost_parameter/boost_axis/beta.jl b/src/lorentz_boost/boost_parameter/boost_axis/beta.jl index b798000..b9f51e2 100644 --- a/src/lorentz_boost/boost_parameter/boost_axis/beta.jl +++ b/src/lorentz_boost/boost_parameter/boost_axis/beta.jl @@ -105,7 +105,7 @@ end BetaX(beta::T) where {T<:Real} = BetaX{T}(beta) -function _transform(boost_param::BetaX, p::M) where {M<:AbstractFourMomentum} +function QEDbase._transform(boost_param::BetaX, p::M) where {M<:AbstractFourMomentum} en = getE(p) px = getX(p) @@ -187,7 +187,7 @@ end BetaY(beta::T) where {T} = BetaY{T}(beta) -function _transform(boost_param::BetaY, p::M) where {M<:AbstractFourMomentum} +function QEDbase._transform(boost_param::BetaY, p::M) where {M<:AbstractFourMomentum} en = getE(p) py = getY(p) @@ -269,7 +269,7 @@ struct BetaZ{T<:Real} <: AbstractAxisBeta{T} end BetaZ(beta::T) where {T} = BetaZ{T}(beta) -function _transform(boost_param::BetaZ, p::M) where {M<:AbstractFourMomentum} +function QEDbase._transform(boost_param::BetaZ, p::M) where {M<:AbstractFourMomentum} en = getE(p) pz = getZ(p) diff --git a/src/lorentz_boost/boost_parameter/boost_axis/types.jl b/src/lorentz_boost/boost_parameter/boost_axis/types.jl index 577d0e6..2b33417 100644 --- a/src/lorentz_boost/boost_parameter/boost_axis/types.jl +++ b/src/lorentz_boost/boost_parameter/boost_axis/types.jl @@ -12,7 +12,7 @@ Subtypes of `AbstractAxisBoostParameter{T}` are used to define specific boost tr This abstract type is meant to be extended by concrete types to represent boosts along different Cartesian axes. """ -abstract type AbstractAxisBoostParameter{T} <: AbstractBoostParameter end +abstract type AbstractAxisBoostParameter{T} <: QEDbase.AbstractBoostParameter end function (::Type{BP})(boost_val::Real) where {T<:Real,BP<:AbstractAxisBoostParameter{T}} return BP(T(boost_val)) diff --git a/src/lorentz_boost/boost_parameter/boost_vector/beta.jl b/src/lorentz_boost/boost_parameter/boost_vector/beta.jl index 93b5d99..8d966f9 100644 --- a/src/lorentz_boost/boost_parameter/boost_vector/beta.jl +++ b/src/lorentz_boost/boost_parameter/boost_vector/beta.jl @@ -96,7 +96,9 @@ function _three_vector_square(beta_vec::BetaVector) return bx^2 + by^2 + bz^2 end -@inline function _transform(beta_vec::BetaVector, p::M) where {M<:AbstractFourMomentum} +@inline function QEDbase._transform( + beta_vec::BetaVector, p::M +) where {M<:AbstractFourMomentum} b2 = _three_vector_square(beta_vec) if b2 == one(b2) return p diff --git a/src/lorentz_boost/boost_parameter/boost_vector/types.jl b/src/lorentz_boost/boost_parameter/boost_vector/types.jl index 184f406..2546f1a 100644 --- a/src/lorentz_boost/boost_parameter/boost_vector/types.jl +++ b/src/lorentz_boost/boost_parameter/boost_vector/types.jl @@ -1,10 +1,10 @@ """ - AbstractBoostVector <: AbstractBoostParameter + AbstractBoostVector <: QEDbase.AbstractBoostParameter An abstract base type representing vector-like boost parameters, used to model Lorentz boosts in any spatial dimension. -`AbstractBoostVector` extends [`AbstractBoostParameter`](@ref) and provides the framework for +`AbstractBoostVector` extends `QEDbase.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 @@ -21,4 +21,4 @@ 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 +abstract type AbstractBoostVector <: QEDbase.AbstractBoostParameter end diff --git a/src/lorentz_boost/types.jl b/src/lorentz_boost/types.jl index 70a83f1..1b8b505 100644 --- a/src/lorentz_boost/types.jl +++ b/src/lorentz_boost/types.jl @@ -1,11 +1,10 @@ """ - - Boost{V<:AbstractBoostParameter} <: AbstractLorentzBoost + Boost{V<:QEDbase.AbstractBoostParameter} <: QEDbase.AbstractLorentzBoost A concrete type representing a Lorentz boost transformation, parameterized by a boost parameter `V`. The boost parameter can be either axis-specific or vector-like, depending -on the subtype of [`AbstractBoostParameter`](@ref) used. The `Boost` type is used to perform +on the subtype of `QEDbase.AbstractBoostParameter` used. The `Boost` type is used to perform Lorentz boosts on four-vectors (such as four-momentum or four-position) between different inertial frames in special relativity. @@ -69,13 +68,13 @@ four-vector will not change the invariant quantity. ## See Also -* [`AbstractBoostParameter`](@ref): Base type for specific kinds of boost parameters. +* `QEDbase.AbstractBoostParameter`: Base type for specific kinds of boost parameters. * [`BetaX`](@ref): Boost parameter for the x-axis. * [`BetaY`](@ref): Boost parameter for the y-axis. * [`BetaZ`](@ref): Boost parameter for the z-axis. * [`BetaVector`](@ref): Vector of boost parameters for boosts in multiple spatial directions. """ -struct Boost{T<:AbstractBoostParameter} <: AbstractLorentzBoost +struct Boost{T<:QEDbase.AbstractBoostParameter} <: QEDbase.AbstractLorentzBoost param::T end boost_type(::Boost{T}) where {T} = T @@ -85,8 +84,8 @@ Base.eltype(boost::Boost) = eltype(boost.param) Boost(x::Real) = Boost(BetaX(x)) Boost(x::Real, y::Real, z::Real) = Boost(BetaVector(x, y, z)) -function _transform(boost::Boost, p::AbstractFourMomentum) - return _transform(boost.param, p) +function QEDbase._transform(boost::Boost, p::AbstractFourMomentum) + return QEDbase._transform(boost.param, p) end function Base.inv(boost::Boost) diff --git a/src/patch_QEDbase.jl b/src/patch_QEDbase.jl deleted file mode 100644 index f88fc7c..0000000 --- a/src/patch_QEDbase.jl +++ /dev/null @@ -1,170 +0,0 @@ -# This can be removed, if https://github.com/QEDjl-project/QEDbase.jl/pull/129 is merged -# and released. - -####### -# General coordinate transformations -####### - -""" - AbstractCoordinateTransformation - -Abstract base type for coordinate transformations supposed to be acting on four-momenta. -Every subtype of `trafo::AbstractCoordinateTransformation` should implement the following interface functions: - -* `QEDcore._transform(trafo,p)`: transforms `p` -* `Base.inv(trafo)`: returns the inverted transform - -## Example - -Implementing the interface by defining the interface functions: - -```jldoctest trafo_interface -julia> using QEDcore - -julia> struct TestTrafo{T} <: QEDcore.AbstractCoordinateTransformation - a::T - end - -julia> QEDcore._transform(trafo::TestTrafo,p) = trafo.a*p - -julia> Base.inv(trafo::TestTrafo) = TestTrafo(inv(trafo.a)) - -``` - -The `TestTrafo` can then be used to transform four-momenta: - -```jldoctest trafo_interface -julia> trafo = TestTrafo(2.0) -TestTrafo{Float64}(2.0) - -julia> p = SFourMomentum(4,3,2,1) -4-element SFourMomentum with indices SOneTo(4): - 4.0 - 3.0 - 2.0 - 1.0 - -julia> trafo(p) # multiply every component with 2.0 -4-element SFourMomentum with indices SOneTo(4): - 8.0 - 6.0 - 4.0 - 2.0 - -julia> inv(trafo)(p) # divide every component by 2.0 -4-element SFourMomentum with indices SOneTo(4): - 2.0 - 1.5 - 1.0 - 0.5 -``` -""" -abstract type AbstractCoordinateTransformation end -Base.broadcastable(trafo::AbstractCoordinateTransformation) = Ref(trafo) - -""" - _transform(trafo::AbstractCoordinateTransformation,p::AbstractFourMomentum) - -Interface function for the application of the transformation to the four-momentum `p`. Must return a four-momentum -of the same type as `p`. -""" -function _transform end - -# make the transform callable -@inline function (trafo::AbstractCoordinateTransformation)(p::AbstractFourMomentum) - return _transform(trafo, p) -end - -@inline function (trafo::AbstractCoordinateTransformation)( - psf::PSF -) where {PSF<:AbstractParticleStateful} - p_prime = _transform(trafo, momentum(psf)) - return PSF(p_prime) -end - -@inline function (trafo::AbstractCoordinateTransformation)( - psp::PSP -) where {PSP<:AbstractPhaseSpacePoint} - in_moms = momenta(psp, Incoming()) - out_moms = momenta(psp, Outgoing()) - in_moms_prime = _transform.(trafo, in_moms) - out_moms_prime = _transform.(trafo, out_moms) - - proc = process(psp) - mod = model(psp) - ps_def = phase_space_definition(psp) - return PhaseSpacePoint(proc, mod, ps_def, in_moms_prime, out_moms_prime) -end - -######### -# Abstract Lorentz Boosts -######### - -""" - - AbstractLorentzTransformation <: AbstractCoordinateTransformation - -An abstract base type representing Lorentz transformations, which are coordinate -transformations between inertial and reference frames in special relativity. - -`AbstractLorentzTransformation` extends `AbstractCoordinateTransformation` and provides -the foundational framework for all types of Lorentz transformations, including boosts. -These transformations preserve the Minkowski product of two four-vectors and are fundamental to -the description of relativistic physics, ensuring the laws of physics are the same in all -inertial frames. - -### Usage - -Subtypes of `AbstractLorentzTransformation` implement specific kinds of Lorentz transformations. -For example: -- [`Boost{T}`](@ref): A concrete implementation of Lorentz boosts with boost parameter `T` (see also [`AbstractBoostParameter`](@ref)). - -These subtypes perform transformations on four-vectors (such as [`SFourMomentum`](@ref)) between different inertial reference frames. -""" -abstract type AbstractLorentzTransformation <: AbstractCoordinateTransformation end - -""" - - AbstractLorentzBoost <: AbstractLorentzTransformation - -An abstract base type representing Lorentz boosts, a specific type of Lorentz transformation -associated with relative motion between inertial frames along one or more spatial directions. - -`AbstractLorentzBoost` extends `AbstractLorentzTransformation` and serves as the foundation -for all types of boost transformations in special relativity. Lorentz boosts describe how -four-vectors (such as [`SFourMomentum`](@ref)) change when transitioning between two reference frames moving at constant velocities (in units of the speed of light) relative to each other. - -For example: -- [`Boost{T}`](@ref): A concrete implementation of Lorentz boosts with boost parameter `T` (see also [`AbstractBoostParameter`](@ref)). - -""" -abstract type AbstractLorentzBoost <: AbstractLorentzTransformation end - -""" - - AbstractBoostParameter - -An abstract base type representing boost parameters used in Lorentz transformations, which -describe the relative motion between two inertial frames in special relativity. - -`AbstractBoostParameter` serves as the foundation for defining specific boost parameters -that control Lorentz boosts in different spatial directions. Boost parameters typically -represent the velocity of one reference frame relative to another, expressed as a fraction -of the speed of light (`\\beta`), and are essential for performing Lorentz transformations -on four-vectors (such as [`SFourMomentum`](@ref)). - -## Overview - -In the context of special relativity, a Lorentz boost is a transformation that changes the -time and spatial components of a four-vector based on the relative motion between two -inertial reference frames. For example, the boost parameter ``\\beta`` is dimensionless and represents -this velocity as a fraction of the speed of light. Depending on the frame's relative velocity, -different forms of boost parameters exist, such as those associated with a single axis or -a vector describing boosts in multiple spatial dimensions. - -The `AbstractBoostParameter` type is the parent type for all specific kinds of boost parameters, including: -- **Axis-specific Boost Parameters**: Such as [`BetaX`](@ref), which describes a boost along the x-axis. -- **Vector-like Boost Parameters**: Such as [`BetaVector`](@ref), which describes boosts with components in multiple spatial directions. - -""" -abstract type AbstractBoostParameter end