Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for synced spins/pols #31

Merged
merged 7 commits into from
Sep 20, 2024
Prev Previous commit
Next Next commit
Remove some unnecessary type parameters
AntonReinhard committed Sep 19, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit 1900cc2d017719ee828b3a33f82fad71a0b73ebe
42 changes: 19 additions & 23 deletions src/computable_dags/compute.jl
Original file line number Diff line number Diff line change
@@ -42,9 +42,7 @@ struct BaseStateInput{PS_T<:AbstractParticleStateful,SPIN_POL_T<:AbstractSpinOrP
spin_pol::SPIN_POL_T
end

function compute(
::ComputeTask_BaseState, input::BaseStateInput{PS,SPIN_POL}
) where {PS,SPIN_POL}
function compute(::ComputeTask_BaseState, input::BaseStateInput)
species = particle_species(input.particle)
if is_outgoing(input.particle)
species = _invert(species)
@@ -113,48 +111,46 @@ end

@inline function compute( # photon, electron
::ComputeTask_Pair,
photon::Propagated{Photon,V1},
electron::Propagated{Electron,V2},
) where {V1,V2}
photon::Propagated{Photon},
electron::Propagated{Electron},
)
return Unpropagated(Electron(), photon.value * VERTEX * electron.value) # photon - electron -> electron
end
@inline function compute( # photon, positron
::ComputeTask_Pair,
photon::Propagated{Photon,V1},
positron::Propagated{Positron,V2},
) where {V1,V2}
photon::Propagated{Photon},
positron::Propagated{Positron},
)
return Unpropagated(Positron(), positron.value * VERTEX * photon.value) # photon - positron -> positron
end
@inline function compute( # electron, positron
::ComputeTask_Pair,
electron::Propagated{Electron,V1},
positron::Propagated{Positron,V2},
) where {V1,V2}
electron::Propagated{Electron},
positron::Propagated{Positron},
)
return Unpropagated(Photon(), positron.value * VERTEX * electron.value) # electron - positron -> photon
end

@inline function compute(
::ComputeTask_PropagatePairs, prop::PROP_V, photon::Unpropagated{Photon,VAL}
) where {PROP_V,VAL}
@inline function compute(::ComputeTask_PropagatePairs, prop, photon::Unpropagated{Photon})
return Propagated(Photon(), photon.value * prop)
end
@inline function compute(
::ComputeTask_PropagatePairs, prop::PROP_V, electron::Unpropagated{Electron,VAL}
) where {PROP_V,VAL}
::ComputeTask_PropagatePairs, prop, electron::Unpropagated{Electron}
)
return Propagated(Electron(), prop * electron.value)
end
@inline function compute(
::ComputeTask_PropagatePairs, prop::PROP_V, positron::Unpropagated{Positron,VAL}
) where {PROP_V,VAL}
::ComputeTask_PropagatePairs, prop, positron::Unpropagated{Positron}
)
return Propagated(Positron(), positron.value * prop)
end

@inline function compute(
::ComputeTask_Triple,
photon::Propagated{Photon,V1},
electron::Propagated{Electron,V2},
positron::Propagated{Positron,V3},
) where {V1,V2,V3}
photon::Propagated{Photon},
electron::Propagated{Electron},
positron::Propagated{Positron},
)
return positron.value * (VERTEX * photon.value) * electron.value
end