Finish DAG generation and function

This commit is contained in:
2024-07-17 18:22:54 +02:00
parent 4f0da3dffb
commit 00a1252c9a
6 changed files with 121 additions and 104 deletions

View File

@@ -9,9 +9,9 @@
"name": "stderr",
"output_type": "stream",
"text": [
"WARNING: Method definition (::Type{QEDcore.ParticleStateful{DIR, SPECIES, ELEMENT} where ELEMENT<:QEDbase.AbstractFourMomentum})(QEDbase.AbstractFourMomentum) where {DIR<:QEDbase.ParticleDirection, SPECIES<:QEDbase.AbstractParticleType} in module QEDcore at /home/antonr/.julia/packages/QEDcore/uVldP/src/phase_spaces/create.jl:7 overwritten in module MetagraphOptimization at /home/antonr/.julia/packages/MetagraphOptimization/mvCVq/src/QEDprocesses_patch.jl:15.\n",
"WARNING: Method definition (::Type{QEDcore.ParticleStateful{DIR, SPECIES, ELEMENT} where ELEMENT<:QEDbase.AbstractFourMomentum})(QEDbase.AbstractFourMomentum) where {DIR<:QEDbase.ParticleDirection, SPECIES<:QEDbase.AbstractParticleType} in module QEDcore at /home/antonr/.julia/packages/QEDcore/uVldP/src/phase_spaces/create.jl:7 overwritten in module MetagraphOptimization at /home/antonr/.julia/packages/MetagraphOptimization/0iydf/src/QEDprocesses_patch.jl:15.\n",
"ERROR: Method overwriting is not permitted during Module precompilation. Use `__precompile__(false)` to opt-out of precompilation.\n",
"WARNING: Method definition (::Type{QEDcore.ParticleStateful{DIR, SPECIES, ELEMENT} where ELEMENT<:QEDbase.AbstractFourMomentum})(QEDbase.AbstractFourMomentum) where {DIR<:QEDbase.ParticleDirection, SPECIES<:QEDbase.AbstractParticleType} in module QEDcore at /home/antonr/.julia/packages/QEDcore/uVldP/src/phase_spaces/create.jl:7 overwritten in module MetagraphOptimization at /home/antonr/.julia/packages/MetagraphOptimization/mvCVq/src/QEDprocesses_patch.jl:15.\n",
"WARNING: Method definition (::Type{QEDcore.ParticleStateful{DIR, SPECIES, ELEMENT} where ELEMENT<:QEDbase.AbstractFourMomentum})(QEDbase.AbstractFourMomentum) where {DIR<:QEDbase.ParticleDirection, SPECIES<:QEDbase.AbstractParticleType} in module QEDcore at /home/antonr/.julia/packages/QEDcore/uVldP/src/phase_spaces/create.jl:7 overwritten in module MetagraphOptimization at /home/antonr/.julia/packages/MetagraphOptimization/0iydf/src/QEDprocesses_patch.jl:15.\n",
"ERROR: Method overwriting is not permitted during Module precompilation. Use `__precompile__(false)` to opt-out of precompilation.\n"
]
}
@@ -29,21 +29,13 @@
{
"data": {
"text/plain": [
"14-element Vector{VirtualParticle{GenericQEDProcess{Tuple{Photon, Photon, Photon, Electron}, Tuple{Photon, Electron}, Tuple{AllPolarization, AllPolarization, AllPolarization, AllSpin}, Tuple{AllPolarization, AllSpin}}, PT, 4, 2} where PT<:AbstractParticleType}:\n",
" positron: \t0000 | 11\n",
" electron: \t0001 | 10\n",
" positron: \t0010 | 01\n",
" electron: \t0011 | 00\n",
" positron: \t0100 | 01\n",
" electron: \t0101 | 00\n",
" positron: \t1000 | 01\n",
" electron: \t1001 | 00\n",
" positron: \t1000 | 11\n",
" electron: \t1001 | 10\n",
" positron: \t1010 | 01\n",
" electron: \t1011 | 00\n",
" positron: \t1100 | 01\n",
" electron: \t1101 | 00"
"6-element Vector{VirtualParticle{QEDProcess{Tuple{Photon, Photon, Electron}, Tuple{Photon, Electron}, Tuple{AllPolarization, AllPolarization, AllSpin}, Tuple{AllPolarization, AllSpin}}, PT, 3, 2} where PT<:AbstractParticleType}:\n",
" positron: \t000 | 11\n",
" electron: \t001 | 10\n",
" positron: \t010 | 01\n",
" electron: \t011 | 00\n",
" positron: \t100 | 01\n",
" electron: \t101 | 00"
]
},
"metadata": {},
@@ -58,7 +50,7 @@
}
],
"source": [
"proc = GenericQEDProcess(3, 1, 1, 1, 0, 0)\n",
"proc = QEDProcess(2, 1, 1, 1, 0, 0)\n",
"all_particles = Set()\n",
"for fd in feynman_diagrams(proc)\n",
" push!(all_particles, virtual_particles(proc, fd)...)\n",
@@ -75,21 +67,13 @@
{
"data": {
"text/plain": [
"OrderedCollections.OrderedDict{VirtualParticle, Vector{Tuple{VirtualParticle, VirtualParticle}}} with 14 entries:\n",
" positron: \t0000 | 11 => [(positron: \t0000 | 01, photon: \t0000 | 10)]\n",
" electron: \t0001 | 10 => [(photon: \t0000 | 10, electron: \t0001 | 00)]\n",
" positron: \t0010 | 01 => [(positron: \t0000 | 01, photon: \t0010 | 00)]\n",
" electron: \t0011 | 00 => [(electron: \t0001 | 00, photon: \t0010 | 00)]\n",
" positron: \t0100 | 01 => [(positron: \t0000 | 01, photon: \t0100 | 00)]\n",
" electron: \t0101 | 00 => [(electron: \t0001 | 00, photon: \t0100 | 00)]\n",
" positron: \t1000 | 01 => [(positron: \t0000 | 01, photon: \t1000 | 00)]\n",
" electron: \t1001 | 00 => [(electron: \t0001 | 00, photon: \t1000 | 00)]\n",
" positron: \t1000 | 11 => [(photon: \t0000 | 10, positron: \t1000 | 01), (photon: \t10…\n",
" electron: \t1001 | 10 => [(photon: \t0000 | 10, electron: \t1001 | 00), (photon: \t10…\n",
" positron: \t1010 | 01 => [(photon: \t0010 | 00, positron: \t1000 | 01), (photon: \t10…\n",
" electron: \t1011 | 00 => [(photon: \t0010 | 00, electron: \t1001 | 00), (photon: \t10…\n",
" positron: \t1100 | 01 => [(photon: \t0100 | 00, positron: \t1000 | 01), (photon: \t10…\n",
" electron: \t1101 | 00 => [(photon: \t0100 | 00, electron: \t1001 | 00), (photon: \t10…"
"OrderedCollections.OrderedDict{VirtualParticle, Vector{Tuple{VirtualParticle, VirtualParticle}}} with 6 entries:\n",
" positron: \t000 | 11 => [(positron: \t000 | 01, photon: \t000 | 10)]\n",
" electron: \t001 | 10 => [(photon: \t000 | 10, electron: \t001 | 00)]\n",
" positron: \t010 | 01 => [(positron: \t000 | 01, photon: \t010 | 00)]\n",
" electron: \t011 | 00 => [(electron: \t001 | 00, photon: \t010 | 00)]\n",
" positron: \t100 | 01 => [(positron: \t000 | 01, photon: \t100 | 00)]\n",
" electron: \t101 | 00 => [(electron: \t001 | 00, photon: \t100 | 00)]"
]
},
"metadata": {},
@@ -108,19 +92,13 @@
{
"data": {
"text/plain": [
"12-element Vector{Tuple{VirtualParticle, VirtualParticle, VirtualParticle}}:\n",
" (photon: \t0000 | 10, electron: \t0011 | 00, positron: \t1100 | 01)\n",
" (photon: \t0000 | 10, electron: \t0101 | 00, positron: \t1010 | 01)\n",
" (photon: \t0000 | 10, electron: \t1101 | 00, positron: \t0010 | 01)\n",
" (photon: \t0000 | 10, electron: \t1011 | 00, positron: \t0100 | 01)\n",
" (photon: \t0010 | 00, electron: \t0001 | 10, positron: \t1100 | 01)\n",
" (photon: \t0010 | 00, electron: \t0101 | 00, positron: \t1000 | 11)\n",
" (photon: \t0010 | 00, electron: \t1101 | 00, positron: \t0000 | 11)\n",
" (photon: \t0010 | 00, electron: \t1001 | 10, positron: \t0100 | 01)\n",
" (photon: \t0100 | 00, electron: \t0001 | 10, positron: \t1010 | 01)\n",
" (photon: \t0100 | 00, electron: \t0011 | 00, positron: \t1000 | 11)\n",
" (photon: \t0100 | 00, electron: \t1011 | 00, positron: \t0000 | 11)\n",
" (photon: \t0100 | 00, electron: \t1001 | 10, positron: \t0010 | 01)"
"6-element Vector{Tuple{VirtualParticle, VirtualParticle, VirtualParticle}}:\n",
" (photon: \t000 | 10, electron: \t011 | 00, positron: \t100 | 01)\n",
" (photon: \t000 | 10, electron: \t101 | 00, positron: \t010 | 01)\n",
" (photon: \t010 | 00, electron: \t101 | 00, positron: \t000 | 11)\n",
" (photon: \t010 | 00, electron: \t001 | 10, positron: \t100 | 01)\n",
" (photon: \t100 | 00, electron: \t011 | 00, positron: \t000 | 11)\n",
" (photon: \t100 | 00, electron: \t001 | 10, positron: \t010 | 01)"
]
},
"metadata": {},
@@ -140,26 +118,20 @@
"name": "stdout",
"output_type": "stream",
"text": [
"s: 24, should be: 24\n",
"number of triples: 12\n"
"s: 6, should be: 6\n",
"number of triples: 6\n"
]
},
{
"data": {
"text/plain": [
"12-element Vector{Tuple{VirtualParticle, VirtualParticle, VirtualParticle}}:\n",
" (photon: \t0000 | 10, electron: \t0011 | 00, positron: \t1100 | 01)\n",
" (photon: \t0000 | 10, electron: \t0101 | 00, positron: \t1010 | 01)\n",
" (photon: \t0000 | 10, electron: \t1011 | 00, positron: \t0100 | 01)\n",
" (photon: \t0000 | 10, electron: \t1101 | 00, positron: \t0010 | 01)\n",
" (photon: \t0010 | 00, electron: \t0001 | 10, positron: \t1100 | 01)\n",
" (photon: \t0010 | 00, electron: \t0101 | 00, positron: \t1000 | 11)\n",
" (photon: \t0010 | 00, electron: \t1001 | 10, positron: \t0100 | 01)\n",
" (photon: \t0010 | 00, electron: \t1101 | 00, positron: \t0000 | 11)\n",
" (photon: \t0100 | 00, electron: \t0001 | 10, positron: \t1010 | 01)\n",
" (photon: \t0100 | 00, electron: \t0011 | 00, positron: \t1000 | 11)\n",
" (photon: \t0100 | 00, electron: \t1001 | 10, positron: \t0010 | 01)\n",
" (photon: \t0100 | 00, electron: \t1011 | 00, positron: \t0000 | 11)"
"6-element Vector{Tuple{VirtualParticle, VirtualParticle, VirtualParticle}}:\n",
" (photon: \t000 | 10, electron: \t011 | 00, positron: \t100 | 01)\n",
" (photon: \t000 | 10, electron: \t101 | 00, positron: \t010 | 01)\n",
" (photon: \t010 | 00, electron: \t001 | 10, positron: \t100 | 01)\n",
" (photon: \t010 | 00, electron: \t101 | 00, positron: \t000 | 11)\n",
" (photon: \t100 | 00, electron: \t001 | 10, positron: \t010 | 01)\n",
" (photon: \t100 | 00, electron: \t011 | 00, positron: \t000 | 11)"
]
},
"metadata": {},
@@ -198,11 +170,11 @@
"data": {
"text/plain": [
"Graph:\n",
" Nodes: Total: 2320, FeynmanDiagramGenerator.ComputeTask_CollectTriples: 64, MetagraphOptimization.DataTask: 1173, \n",
" FeynmanDiagramGenerator.ComputeTask_CollectPairs: 80, FeynmanDiagramGenerator.ComputeTask_SpinPolCumulation: 1, FeynmanDiagramGenerator.ComputeTask_Propagator: 14, \n",
" FeynmanDiagramGenerator.ComputeTask_Triple: 768, FeynmanDiagramGenerator.ComputeTask_BaseState: 12, FeynmanDiagramGenerator.ComputeTask_PropagatePairs: 80, \n",
" FeynmanDiagramGenerator.ComputeTask_Pair: 128\n",
" Edges: 4853\n",
" Nodes: Total: 642, FeynmanDiagramGenerator.ComputeTask_PropagatePairs: 24, FeynmanDiagramGenerator.ComputeTask_CollectPairs: 24, \n",
" FeynmanDiagramGenerator.ComputeTask_Triple: 192, FeynmanDiagramGenerator.ComputeTask_SpinPolCumulation: 1, MetagraphOptimization.DataTask: 329, \n",
" FeynmanDiagramGenerator.ComputeTask_BaseState: 10, FeynmanDiagramGenerator.ComputeTask_Pair: 24, FeynmanDiagramGenerator.ComputeTask_Propagator: 6, \n",
" FeynmanDiagramGenerator.ComputeTask_CollectTriples: 32\n",
" Edges: 1249\n",
" Total Compute Effort: 0.0\n",
" Total Data Transfer: 0.0\n",
" Total Compute Intensity: 0.0\n"
@@ -218,13 +190,13 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 7,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"compute__2e0e67fe_4441_11ef_36f2_5fda31178519 (generic function with 1 method)"
"mock_machine (generic function with 1 method)"
]
},
"metadata": {},
@@ -248,18 +220,53 @@
" ],\n",
" [-1.0;;],\n",
" )\n",
"end\n",
"\n",
"func = get_compute_function(graph, proc, mock_machine())"
"end"
]
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 8,
"metadata": {},
"outputs": [],
"outputs": [
{
"data": {
"text/plain": [
"PhaseSpacePoint{QEDProcess{Tuple{Photon, Photon, Electron}, Tuple{Photon, Electron}, Tuple{AllPolarization, AllPolarization, AllSpin}, Tuple{AllPolarization, AllSpin}}, PerturbativeQED, PhasespaceDefinition{SphericalCoordinateSystem, ElectronRestFrame}, Tuple{ParticleStateful{Incoming, Photon, SFourMomentum}, ParticleStateful{Incoming, Photon, SFourMomentum}, ParticleStateful{Incoming, Electron, SFourMomentum}}, Tuple{ParticleStateful{Outgoing, Photon, SFourMomentum}, ParticleStateful{Outgoing, Electron, SFourMomentum}}, SFourMomentum}"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"psp = PhaseSpacePoint(proc, PerturbativeQED(), PhasespaceDefinition(SphericalCoordinateSystem(), ElectronRestFrame()), [rand(SFourMomentum) for _ in 1:number_incoming_particles(proc)], [rand(SFourMomentum) for _ in 1:number_outgoing_particles(proc)])"
"psp = PhaseSpacePoint(\n",
" proc, \n",
" PerturbativeQED(), \n",
" PhasespaceDefinition(SphericalCoordinateSystem(), ElectronRestFrame()), \n",
" tuple((rand(SFourMomentum) for _ in 1:number_incoming_particles(proc))...),\n",
" tuple((rand(SFourMomentum) for _ in 1:number_outgoing_particles(proc))...)\n",
")\n",
"typeof(psp)"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"ename": "Base.Meta.ParseError",
"evalue": "Error trying to display an error.",
"output_type": "error",
"traceback": [
"Error trying to display an error."
]
}
],
"source": [
"func = eval(get_compute_function(graph, proc, mock_machine()))\n",
"\n",
"func(psp)"
]
}
],