QEDjl-project / QEDprocesses.jl

[WIP]: QEDprocesses.jl: Modeling of scattering processes for QED.jl
MIT License
1 stars 3 forks source link

scattering process setups #4

Closed szabo137 closed 2 weeks ago

szabo137 commented 11 months ago

This issue is related to QEDjl-project/QEDprocesses.jl#3.

Problem statement

In the calculation of differential cross sections, there are situations, where for a fixed initPS the cross sections is calculated for several finalPS. Therefore, the size-check of the initPS only needs to be performed once.

Suggested solution

One could introduce the concept of a setup for a certain quantity, say the differential cross section. In the initialization step for such a setup, the fixed parameters, like process, model, initPS, could be checked once. Then the actual quantity, i.e. the differential cross section, could be calculated via a computation function, which only takes an instance of the setup and the remaining arguments, i.e. the finalPS.

Suggested implementation

General setup interface

I suggest calling the root type AbstractSetup, and the following interface functions to be implemented.

Base.eltype(::AbstractSetup)  # returns the type of the output value of a computation
compute(::AbstactSetup,::Any) # returns the value of the computation 

Abstact process setup

I suggest having a dedicated abstract subtype for process-related setups: AbstractProcessSetup<:AbstractSetup. For concrete subtypes of AbstractProcessSetup, the following interface functions should be implemented:

scattering_process(::AbstractProcessSetup) # returns the scattering process
compute_model(::AbstractProcessSetup) # returns the computation model 
_compute(::AbstractProcessSetup, finalPS::AbstractVector{<:Real}) # computes the associated quantity on a given `finalPS`, without performing size-checks on `finalPS`

The _compute method is different from the general interface function compute, since one wants a version of it, without any size checks.

Using the interface above, one could provide generic implementations for the following functions.

inital_phasespace_dimension(::AbstractProcessSetup) # returns the dimension of the initial phasespace
final_phasespace_dimension(::AbstractProcessSetup) # returns the dimension of the final phasespace

In order to fulfil the general setup interface above, one could provide the following generic implementations, only using the interface functions of AbstractProcessSetup.

compute(::AbstractProcessSetup, finalPS::AbstractVector{<:Real}) # performing the computation including the size-check on finalPS
_compute(::AbstractProcessSetup, finalPS::AbstractMatrix{<:Real} # performing the computations on a series of finalPS vectors, without size-check
compute(::AbstractProcessSetup, finalPS::AbstractMatrix{<:Real} # performing the computations on a series of finalPS vectors, with size-check
AntonReinhard commented 3 weeks ago

Is this still relevant, especially with QEDjl-project/QEDbase.jl#73 ?

szabo137 commented 2 weeks ago

Indeed, this is not relevant anymore. We decided against the setup concept but used the phase space implementation instead (cf. QEDjl-project/QEDprocesses.jl#51 )