Make diagram generation faster, add tests for it, update some notebooks
This commit is contained in:
parent
f78cde613a
commit
86799644c4
122
docs/src/structure_qed.drawio
Normal file
122
docs/src/structure_qed.drawio
Normal file
File diff suppressed because one or more lines are too long
@ -2,38 +2,30 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"using Revise; using QEDbase; using QEDprocesses; using MetagraphOptimization; using BenchmarkTools; using DataStructures"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 37,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"using Revise; using QEDbase; using QEDprocesses; using MetagraphOptimization; using BenchmarkTools; using DataStructures\n",
|
||||
"import MetagraphOptimization.gen_diagrams"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"execution_count": 38,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Diagram 1: Initial Particles: [k_in_1, e_in_1, k_out_1, e_out_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_out_1 + e_out_1 -> e_out_2, k_in_1 + e_in_1 -> e_in_2]\n",
|
||||
" Tie: e_out_2 -- e_in_2\n",
|
||||
"Diagram 1: Initial Particles: [k_i_1, e_i_1, k_o_1, e_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_i_1 + e_i_1 -> e_i_2, k_o_1 + e_o_1 -> e_o_2]\n",
|
||||
" Tie: e_i_2 -- e_o_2\n",
|
||||
"\n",
|
||||
"Diagram 2: Initial Particles: [k_in_1, e_in_1, k_out_1, e_out_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_in_1 + e_out_1 -> e_out_2, e_in_1 + k_out_1 -> e_in_2]\n",
|
||||
" Tie: e_out_2 -- e_in_2\n",
|
||||
"Diagram 2: Initial Particles: [k_i_1, e_i_1, k_o_1, e_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_i_1 + e_o_1 -> e_o_2, e_i_1 + k_o_1 -> e_i_2]\n",
|
||||
" Tie: e_o_2 -- e_i_2\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
@ -53,22 +45,22 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"execution_count": 39,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"BenchmarkTools.Trial: 3077 samples with 1 evaluation.\n",
|
||||
" Range \u001b[90m(\u001b[39m\u001b[36m\u001b[1mmin\u001b[22m\u001b[39m … \u001b[35mmax\u001b[39m\u001b[90m): \u001b[39m\u001b[36m\u001b[1m1.461 ms\u001b[22m\u001b[39m … \u001b[35m 3.180 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmin … max\u001b[90m): \u001b[39m0.00% … 47.86%\n",
|
||||
" Time \u001b[90m(\u001b[39m\u001b[34m\u001b[1mmedian\u001b[22m\u001b[39m\u001b[90m): \u001b[39m\u001b[34m\u001b[1m1.557 ms \u001b[22m\u001b[39m\u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmedian\u001b[90m): \u001b[39m0.00%\n",
|
||||
" Time \u001b[90m(\u001b[39m\u001b[32m\u001b[1mmean\u001b[22m\u001b[39m ± \u001b[32mσ\u001b[39m\u001b[90m): \u001b[39m\u001b[32m\u001b[1m1.624 ms\u001b[22m\u001b[39m ± \u001b[32m275.482 μs\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmean ± σ\u001b[90m): \u001b[39m3.59% ± 9.19%\n",
|
||||
"BenchmarkTools.Trial: 6044 samples with 1 evaluation.\n",
|
||||
" Range \u001b[90m(\u001b[39m\u001b[36m\u001b[1mmin\u001b[22m\u001b[39m … \u001b[35mmax\u001b[39m\u001b[90m): \u001b[39m\u001b[36m\u001b[1m490.857 μs\u001b[22m\u001b[39m … \u001b[35m 3.657 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmin … max\u001b[90m): \u001b[39m0.00% … 77.38%\n",
|
||||
" Time \u001b[90m(\u001b[39m\u001b[34m\u001b[1mmedian\u001b[22m\u001b[39m\u001b[90m): \u001b[39m\u001b[34m\u001b[1m800.314 μs \u001b[22m\u001b[39m\u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmedian\u001b[90m): \u001b[39m0.00%\n",
|
||||
" Time \u001b[90m(\u001b[39m\u001b[32m\u001b[1mmean\u001b[22m\u001b[39m ± \u001b[32mσ\u001b[39m\u001b[90m): \u001b[39m\u001b[32m\u001b[1m825.263 μs\u001b[22m\u001b[39m ± \u001b[32m208.306 μs\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmean ± σ\u001b[90m): \u001b[39m1.62% ± 5.53%\n",
|
||||
"\n",
|
||||
" \u001b[39m▃\u001b[39m▅\u001b[39m▇\u001b[39m█\u001b[34m█\u001b[39m\u001b[39m▇\u001b[39m▄\u001b[32m▃\u001b[39m\u001b[39m▁\u001b[39m▁\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▁\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▁\n",
|
||||
" \u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[34m█\u001b[39m\u001b[39m█\u001b[39m█\u001b[32m█\u001b[39m\u001b[39m█\u001b[39m█\u001b[39m▇\u001b[39m▅\u001b[39m▃\u001b[39m▄\u001b[39m▅\u001b[39m▃\u001b[39m▄\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▃\u001b[39m▁\u001b[39m▁\u001b[39m▃\u001b[39m▅\u001b[39m▆\u001b[39m▅\u001b[39m▅\u001b[39m▃\u001b[39m▃\u001b[39m▃\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▃\u001b[39m▄\u001b[39m▃\u001b[39m▁\u001b[39m▃\u001b[39m▁\u001b[39m▁\u001b[39m▄\u001b[39m▅\u001b[39m▆\u001b[39m▇\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▇\u001b[39m▇\u001b[39m \u001b[39m█\n",
|
||||
" 1.46 ms\u001b[90m \u001b[39m\u001b[90mHistogram: \u001b[39m\u001b[90m\u001b[1mlog(\u001b[22m\u001b[39m\u001b[90mfrequency\u001b[39m\u001b[90m\u001b[1m)\u001b[22m\u001b[39m\u001b[90m by time\u001b[39m 2.85 ms \u001b[0m\u001b[1m<\u001b[22m\n",
|
||||
" \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▃\u001b[39m█\u001b[39m▂\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▁\u001b[39m \u001b[39m▂\u001b[39m▃\u001b[39m▃\u001b[39m▂\u001b[39m▃\u001b[39m▃\u001b[39m▄\u001b[39m▅\u001b[34m▅\u001b[39m\u001b[39m▅\u001b[39m▃\u001b[32m▂\u001b[39m\u001b[39m▁\u001b[39m \u001b[39m▁\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▃\u001b[39m▆\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \n",
|
||||
" \u001b[39m▂\u001b[39m▂\u001b[39m▁\u001b[39m▂\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▂\u001b[39m▂\u001b[39m▁\u001b[39m▁\u001b[39m▃\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▇\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[34m█\u001b[39m\u001b[39m█\u001b[39m█\u001b[32m█\u001b[39m\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▇\u001b[39m▆\u001b[39m▆\u001b[39m▅\u001b[39m▅\u001b[39m▄\u001b[39m▄\u001b[39m▄\u001b[39m▅\u001b[39m▇\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▅\u001b[39m▄\u001b[39m▃\u001b[39m \u001b[39m▅\n",
|
||||
" 491 μs\u001b[90m Histogram: frequency by time\u001b[39m 1.04 ms \u001b[0m\u001b[1m<\u001b[22m\n",
|
||||
"\n",
|
||||
" Memory estimate\u001b[90m: \u001b[39m\u001b[33m2.16 MiB\u001b[39m, allocs estimate\u001b[90m: \u001b[39m\u001b[33m18208\u001b[39m."
|
||||
" Memory estimate\u001b[90m: \u001b[39m\u001b[33m280.03 KiB\u001b[39m, allocs estimate\u001b[90m: \u001b[39m\u001b[33m2709\u001b[39m."
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -79,10 +71,10 @@
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Found 6 Diagrams for 2-Photon Compton\n",
|
||||
"Diagram 1: Initial Particles: [k_in_1, k_in_2, e_in_1, k_out_1, e_out_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_in_1 + e_in_1 -> e_in_2, k_out_1 + e_out_1 -> e_out_2]\n",
|
||||
" Virtuality Level 2 Vertices: [k_in_2 + e_in_2 -> e_in_3]\n",
|
||||
" Tie: e_out_2 -- e_in_3\n",
|
||||
"Diagram 1: Initial Particles: [k_i_1, k_i_2, e_i_1, k_o_1, e_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_i_1 + e_i_1 -> e_i_2, k_i_2 + e_o_1 -> e_o_2]\n",
|
||||
" Virtuality Level 2 Vertices: [k_o_1 + e_i_2 -> e_i_3]\n",
|
||||
" Tie: e_o_2 -- e_i_3\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
@ -100,22 +92,22 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 40,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"BenchmarkTools.Trial: 500 samples with 1 evaluation.\n",
|
||||
" Range \u001b[90m(\u001b[39m\u001b[36m\u001b[1mmin\u001b[22m\u001b[39m … \u001b[35mmax\u001b[39m\u001b[90m): \u001b[39m\u001b[36m\u001b[1m 9.130 ms\u001b[22m\u001b[39m … \u001b[35m 16.858 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmin … max\u001b[90m): \u001b[39m0.00% … 11.40%\n",
|
||||
" Time \u001b[90m(\u001b[39m\u001b[34m\u001b[1mmedian\u001b[22m\u001b[39m\u001b[90m): \u001b[39m\u001b[34m\u001b[1m 9.611 ms \u001b[22m\u001b[39m\u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmedian\u001b[90m): \u001b[39m0.00%\n",
|
||||
" Time \u001b[90m(\u001b[39m\u001b[32m\u001b[1mmean\u001b[22m\u001b[39m ± \u001b[32mσ\u001b[39m\u001b[90m): \u001b[39m\u001b[32m\u001b[1m10.018 ms\u001b[22m\u001b[39m ± \u001b[32m802.928 μs\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmean ± σ\u001b[90m): \u001b[39m4.38% ± 5.79%\n",
|
||||
"BenchmarkTools.Trial: 1167 samples with 1 evaluation.\n",
|
||||
" Range \u001b[90m(\u001b[39m\u001b[36m\u001b[1mmin\u001b[22m\u001b[39m … \u001b[35mmax\u001b[39m\u001b[90m): \u001b[39m\u001b[36m\u001b[1m2.581 ms\u001b[22m\u001b[39m … \u001b[35m 7.394 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmin … max\u001b[90m): \u001b[39m0.00% … 38.39%\n",
|
||||
" Time \u001b[90m(\u001b[39m\u001b[34m\u001b[1mmedian\u001b[22m\u001b[39m\u001b[90m): \u001b[39m\u001b[34m\u001b[1m4.278 ms \u001b[22m\u001b[39m\u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmedian\u001b[90m): \u001b[39m0.00%\n",
|
||||
" Time \u001b[90m(\u001b[39m\u001b[32m\u001b[1mmean\u001b[22m\u001b[39m ± \u001b[32mσ\u001b[39m\u001b[90m): \u001b[39m\u001b[32m\u001b[1m4.284 ms\u001b[22m\u001b[39m ± \u001b[32m550.104 μs\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmean ± σ\u001b[90m): \u001b[39m1.84% ± 6.28%\n",
|
||||
"\n",
|
||||
" \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▃\u001b[39m▂\u001b[39m▅\u001b[39m█\u001b[39m▃\u001b[34m▂\u001b[39m\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[32m \u001b[39m\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \n",
|
||||
" \u001b[39m▄\u001b[39m▃\u001b[39m▅\u001b[39m█\u001b[39m▇\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[34m█\u001b[39m\u001b[39m█\u001b[39m▆\u001b[39m▅\u001b[39m▄\u001b[39m▃\u001b[39m▃\u001b[39m▃\u001b[39m▃\u001b[32m▁\u001b[39m\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▂\u001b[39m▃\u001b[39m▂\u001b[39m▁\u001b[39m▃\u001b[39m▃\u001b[39m▄\u001b[39m▃\u001b[39m▅\u001b[39m█\u001b[39m▅\u001b[39m▅\u001b[39m▆\u001b[39m▅\u001b[39m▆\u001b[39m▅\u001b[39m▄\u001b[39m▄\u001b[39m▃\u001b[39m▃\u001b[39m▃\u001b[39m▃\u001b[39m▃\u001b[39m▁\u001b[39m▂\u001b[39m▃\u001b[39m▃\u001b[39m▁\u001b[39m▃\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▂\u001b[39m \u001b[39m▃\n",
|
||||
" 9.13 ms\u001b[90m Histogram: frequency by time\u001b[39m 12 ms \u001b[0m\u001b[1m<\u001b[22m\n",
|
||||
" \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▃\u001b[39m▃\u001b[39m▅\u001b[39m▅\u001b[34m▃\u001b[39m\u001b[39m▃\u001b[39m▇\u001b[39m█\u001b[39m▄\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \n",
|
||||
" \u001b[39m▂\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▂\u001b[39m▂\u001b[39m▁\u001b[39m▂\u001b[39m▂\u001b[39m▂\u001b[39m▄\u001b[39m█\u001b[39m▄\u001b[39m▄\u001b[39m▄\u001b[39m▃\u001b[39m▃\u001b[39m▄\u001b[39m▆\u001b[39m▇\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[34m█\u001b[39m\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▆\u001b[39m▄\u001b[39m▃\u001b[39m▃\u001b[39m▂\u001b[39m▂\u001b[39m▂\u001b[39m▂\u001b[39m▂\u001b[39m▂\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▂\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▂\u001b[39m▃\u001b[39m▂\u001b[39m▂\u001b[39m▂\u001b[39m▂\u001b[39m▂\u001b[39m▂\u001b[39m▂\u001b[39m \u001b[39m▃\n",
|
||||
" 2.58 ms\u001b[90m Histogram: frequency by time\u001b[39m 6.46 ms \u001b[0m\u001b[1m<\u001b[22m\n",
|
||||
"\n",
|
||||
" Memory estimate\u001b[90m: \u001b[39m\u001b[33m14.19 MiB\u001b[39m, allocs estimate\u001b[90m: \u001b[39m\u001b[33m117375\u001b[39m."
|
||||
" Memory estimate\u001b[90m: \u001b[39m\u001b[33m1.71 MiB\u001b[39m, allocs estimate\u001b[90m: \u001b[39m\u001b[33m15410\u001b[39m."
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -126,10 +118,10 @@
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Found 24 Diagrams for 3-Photon Compton\n",
|
||||
"Diagram 1: Initial Particles: [k_in_1, k_in_2, k_in_3, e_in_1, k_out_1, e_out_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_in_1 + e_in_1 -> e_in_2, k_in_2 + e_out_1 -> e_out_2]\n",
|
||||
" Virtuality Level 2 Vertices: [k_in_3 + e_in_2 -> e_in_3, k_out_1 + e_out_2 -> e_out_3]\n",
|
||||
" Tie: e_in_3 -- e_out_3\n",
|
||||
"Diagram 1: Initial Particles: [k_i_1, k_i_2, k_i_3, e_i_1, k_o_1, e_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_i_2 + e_o_1 -> e_o_2, k_i_3 + e_i_1 -> e_i_2]\n",
|
||||
" Virtuality Level 2 Vertices: [k_i_1 + e_o_2 -> e_o_3, k_o_1 + e_i_2 -> e_i_3]\n",
|
||||
" Tie: e_o_3 -- e_i_3\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
@ -147,22 +139,22 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"execution_count": 41,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"BenchmarkTools.Trial: 27 samples with 1 evaluation.\n",
|
||||
" Range \u001b[90m(\u001b[39m\u001b[36m\u001b[1mmin\u001b[22m\u001b[39m … \u001b[35mmax\u001b[39m\u001b[90m): \u001b[39m\u001b[36m\u001b[1m182.038 ms\u001b[22m\u001b[39m … \u001b[35m203.672 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmin … max\u001b[90m): \u001b[39m4.83% … 11.23%\n",
|
||||
" Time \u001b[90m(\u001b[39m\u001b[34m\u001b[1mmedian\u001b[22m\u001b[39m\u001b[90m): \u001b[39m\u001b[34m\u001b[1m187.399 ms \u001b[22m\u001b[39m\u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmedian\u001b[90m): \u001b[39m7.11%\n",
|
||||
" Time \u001b[90m(\u001b[39m\u001b[32m\u001b[1mmean\u001b[22m\u001b[39m ± \u001b[32mσ\u001b[39m\u001b[90m): \u001b[39m\u001b[32m\u001b[1m189.151 ms\u001b[22m\u001b[39m ± \u001b[32m 5.412 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmean ± σ\u001b[90m): \u001b[39m8.49% ± 2.73%\n",
|
||||
"BenchmarkTools.Trial: 141 samples with 1 evaluation.\n",
|
||||
" Range \u001b[90m(\u001b[39m\u001b[36m\u001b[1mmin\u001b[22m\u001b[39m … \u001b[35mmax\u001b[39m\u001b[90m): \u001b[39m\u001b[36m\u001b[1m31.255 ms\u001b[22m\u001b[39m … \u001b[35m42.658 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmin … max\u001b[90m): \u001b[39m0.00% … 4.92%\n",
|
||||
" Time \u001b[90m(\u001b[39m\u001b[34m\u001b[1mmedian\u001b[22m\u001b[39m\u001b[90m): \u001b[39m\u001b[34m\u001b[1m35.749 ms \u001b[22m\u001b[39m\u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmedian\u001b[90m): \u001b[39m4.34%\n",
|
||||
" Time \u001b[90m(\u001b[39m\u001b[32m\u001b[1mmean\u001b[22m\u001b[39m ± \u001b[32mσ\u001b[39m\u001b[90m): \u001b[39m\u001b[32m\u001b[1m35.690 ms\u001b[22m\u001b[39m ± \u001b[32m 2.009 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmean ± σ\u001b[90m): \u001b[39m3.04% ± 2.83%\n",
|
||||
"\n",
|
||||
" \u001b[39m▃\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▃\u001b[39m \u001b[39m \u001b[34m█\u001b[39m\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[32m \u001b[39m\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \n",
|
||||
" \u001b[39m█\u001b[39m▇\u001b[39m▁\u001b[39m▇\u001b[39m▁\u001b[39m▇\u001b[39m▁\u001b[39m▇\u001b[39m▇\u001b[39m▁\u001b[39m█\u001b[39m▁\u001b[39m▇\u001b[34m█\u001b[39m\u001b[39m▁\u001b[39m▇\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[32m▇\u001b[39m\u001b[39m▇\u001b[39m▁\u001b[39m▇\u001b[39m▇\u001b[39m▁\u001b[39m▇\u001b[39m▇\u001b[39m▇\u001b[39m▁\u001b[39m▇\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▇\u001b[39m▇\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▇\u001b[39m▇\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▇\u001b[39m \u001b[39m▁\n",
|
||||
" 182 ms\u001b[90m Histogram: frequency by time\u001b[39m 204 ms \u001b[0m\u001b[1m<\u001b[22m\n",
|
||||
" \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▆\u001b[39m▁\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▃\u001b[39m▁\u001b[39m▁\u001b[39m \u001b[39m \u001b[39m▁\u001b[39m \u001b[39m▃\u001b[39m▁\u001b[39m▃\u001b[39m▁\u001b[39m \u001b[39m█\u001b[34m▆\u001b[39m\u001b[39m▁\u001b[39m▁\u001b[39m▆\u001b[39m▁\u001b[39m▁\u001b[39m▃\u001b[39m \u001b[39m▁\u001b[39m \u001b[39m▃\u001b[39m▆\u001b[39m▁\u001b[39m▆\u001b[39m█\u001b[39m \u001b[39m \u001b[39m \u001b[39m▁\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▁\u001b[39m \u001b[39m \u001b[39m \u001b[39m \n",
|
||||
" \u001b[39m▇\u001b[39m▄\u001b[39m▄\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▄\u001b[39m▇\u001b[39m▇\u001b[39m▄\u001b[39m▄\u001b[39m▄\u001b[39m▇\u001b[39m▄\u001b[39m█\u001b[39m█\u001b[39m▇\u001b[39m▄\u001b[39m▇\u001b[39m▇\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▇\u001b[39m▁\u001b[39m█\u001b[39m▄\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▇\u001b[39m█\u001b[34m█\u001b[39m\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▄\u001b[39m█\u001b[39m▇\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▇\u001b[39m▇\u001b[39m▁\u001b[39m█\u001b[39m▄\u001b[39m▁\u001b[39m▄\u001b[39m▇\u001b[39m█\u001b[39m▇\u001b[39m▄\u001b[39m \u001b[39m▄\n",
|
||||
" 31.3 ms\u001b[90m Histogram: frequency by time\u001b[39m 39.2 ms \u001b[0m\u001b[1m<\u001b[22m\n",
|
||||
"\n",
|
||||
" Memory estimate\u001b[90m: \u001b[39m\u001b[33m417.57 MiB\u001b[39m, allocs estimate\u001b[90m: \u001b[39m\u001b[33m3203645\u001b[39m."
|
||||
" Memory estimate\u001b[90m: \u001b[39m\u001b[33m23.29 MiB\u001b[39m, allocs estimate\u001b[90m: \u001b[39m\u001b[33m171048\u001b[39m."
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -173,11 +165,11 @@
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Found 120 Diagrams for 4-Photon Compton\n",
|
||||
"Diagram 1: Initial Particles: [k_in_1, k_in_2, k_in_3, k_in_4, e_in_1, k_out_1, e_out_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_in_3 + e_in_1 -> e_in_2, k_in_4 + e_out_1 -> e_out_2]\n",
|
||||
" Virtuality Level 2 Vertices: [k_in_2 + e_out_2 -> e_out_3, k_out_1 + e_in_2 -> e_in_3]\n",
|
||||
" Virtuality Level 3 Vertices: [k_in_1 + e_in_3 -> e_in_4]\n",
|
||||
" Tie: e_out_3 -- e_in_4\n",
|
||||
"Diagram 1: Initial Particles: [k_i_1, k_i_2, k_i_3, k_i_4, e_i_1, k_o_1, e_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_i_1 + e_o_1 -> e_o_2, e_i_1 + k_o_1 -> e_i_2]\n",
|
||||
" Virtuality Level 2 Vertices: [k_i_3 + e_o_2 -> e_o_3, k_i_2 + e_i_2 -> e_i_3]\n",
|
||||
" Virtuality Level 3 Vertices: [k_i_4 + e_o_3 -> e_o_4]\n",
|
||||
" Tie: e_i_3 -- e_o_4\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
@ -195,22 +187,22 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"execution_count": 42,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"BenchmarkTools.Trial: 2 samples with 1 evaluation.\n",
|
||||
" Range \u001b[90m(\u001b[39m\u001b[36m\u001b[1mmin\u001b[22m\u001b[39m … \u001b[35mmax\u001b[39m\u001b[90m): \u001b[39m\u001b[36m\u001b[1m3.210 s\u001b[22m\u001b[39m … \u001b[35m 3.254 s\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmin … max\u001b[90m): \u001b[39m10.57% … 11.76%\n",
|
||||
" Time \u001b[90m(\u001b[39m\u001b[34m\u001b[1mmedian\u001b[22m\u001b[39m\u001b[90m): \u001b[39m\u001b[34m\u001b[1m3.232 s \u001b[22m\u001b[39m\u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmedian\u001b[90m): \u001b[39m11.17%\n",
|
||||
" Time \u001b[90m(\u001b[39m\u001b[32m\u001b[1mmean\u001b[22m\u001b[39m ± \u001b[32mσ\u001b[39m\u001b[90m): \u001b[39m\u001b[32m\u001b[1m3.232 s\u001b[22m\u001b[39m ± \u001b[32m30.898 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmean ± σ\u001b[90m): \u001b[39m11.17% ± 0.84%\n",
|
||||
"BenchmarkTools.Trial: 10 samples with 1 evaluation.\n",
|
||||
" Range \u001b[90m(\u001b[39m\u001b[36m\u001b[1mmin\u001b[22m\u001b[39m … \u001b[35mmax\u001b[39m\u001b[90m): \u001b[39m\u001b[36m\u001b[1m471.789 ms\u001b[22m\u001b[39m … \u001b[35m527.196 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmin … max\u001b[90m): \u001b[39m6.00% … 7.35%\n",
|
||||
" Time \u001b[90m(\u001b[39m\u001b[34m\u001b[1mmedian\u001b[22m\u001b[39m\u001b[90m): \u001b[39m\u001b[34m\u001b[1m499.068 ms \u001b[22m\u001b[39m\u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmedian\u001b[90m): \u001b[39m6.98%\n",
|
||||
" Time \u001b[90m(\u001b[39m\u001b[32m\u001b[1mmean\u001b[22m\u001b[39m ± \u001b[32mσ\u001b[39m\u001b[90m): \u001b[39m\u001b[32m\u001b[1m502.132 ms\u001b[22m\u001b[39m ± \u001b[32m 17.383 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmean ± σ\u001b[90m): \u001b[39m6.79% ± 0.77%\n",
|
||||
"\n",
|
||||
" \u001b[34m█\u001b[39m\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[32m \u001b[39m\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m█\u001b[39m \u001b[39m \n",
|
||||
" \u001b[34m█\u001b[39m\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[32m▁\u001b[39m\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m█\u001b[39m \u001b[39m▁\n",
|
||||
" 3.21 s\u001b[90m Histogram: frequency by time\u001b[39m 3.25 s \u001b[0m\u001b[1m<\u001b[22m\n",
|
||||
" \u001b[39m▁\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m█\u001b[39m▁\u001b[39m \u001b[34m▁\u001b[39m\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[32m \u001b[39m\u001b[39m \u001b[39m▁\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▁\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▁\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▁\u001b[39m▁\u001b[39m \u001b[39m \n",
|
||||
" \u001b[39m█\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m█\u001b[39m█\u001b[39m▁\u001b[34m█\u001b[39m\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[32m▁\u001b[39m\u001b[39m▁\u001b[39m█\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m█\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m█\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m█\u001b[39m█\u001b[39m \u001b[39m▁\n",
|
||||
" 472 ms\u001b[90m Histogram: frequency by time\u001b[39m 527 ms \u001b[0m\u001b[1m<\u001b[22m\n",
|
||||
"\n",
|
||||
" Memory estimate\u001b[90m: \u001b[39m\u001b[33m8.12 GiB\u001b[39m, allocs estimate\u001b[90m: \u001b[39m\u001b[33m67276764\u001b[39m."
|
||||
" Memory estimate\u001b[90m: \u001b[39m\u001b[33m627.12 MiB\u001b[39m, allocs estimate\u001b[90m: \u001b[39m\u001b[33m3747679\u001b[39m."
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
@ -221,11 +213,11 @@
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Found 720 Diagrams for 5-Photon Compton\n",
|
||||
"Diagram 1: Initial Particles: [k_in_1, k_in_2, k_in_3, k_in_4, k_in_5, e_in_1, k_out_1, e_out_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_in_3 + e_in_1 -> e_in_2, k_in_4 + e_out_1 -> e_out_2]\n",
|
||||
" Virtuality Level 2 Vertices: [k_in_2 + e_out_2 -> e_out_3, k_in_5 + e_in_2 -> e_in_3]\n",
|
||||
" Virtuality Level 3 Vertices: [k_in_1 + e_out_3 -> e_out_4, k_out_1 + e_in_3 -> e_in_4]\n",
|
||||
" Tie: e_out_4 -- e_in_4\n",
|
||||
"Diagram 1: Initial Particles: [k_i_1, k_i_2, k_i_3, k_i_4, k_i_5, e_i_1, k_o_1, e_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_i_1 + e_i_1 -> e_i_2, k_i_4 + e_o_1 -> e_o_2]\n",
|
||||
" Virtuality Level 2 Vertices: [k_i_3 + e_i_2 -> e_i_3, k_i_5 + e_o_2 -> e_o_3]\n",
|
||||
" Virtuality Level 3 Vertices: [k_i_2 + e_i_3 -> e_i_4, k_o_1 + e_o_3 -> e_o_4]\n",
|
||||
" Tie: e_i_4 -- e_o_4\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
@ -243,20 +235,20 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"execution_count": 43,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Diagram 1: Initial Particles: [p_in_1, e_in_1, p_out_1, e_out_1]\n",
|
||||
" Virtuality Level 1 Vertices: [p_out_1 + e_out_1 -> k_out_2, p_in_1 + e_in_1 -> k_out_1]\n",
|
||||
" Tie: k_out_2 -- k_out_1\n",
|
||||
"Diagram 1: Initial Particles: [p_i_1, e_i_1, e_o_1, p_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [p_i_1 + e_i_1 -> k_o_2, e_o_1 + p_o_1 -> k_o_1]\n",
|
||||
" Tie: k_o_2 -- k_o_1\n",
|
||||
"\n",
|
||||
"Diagram 2: Initial Particles: [p_in_1, e_in_1, p_out_1, e_out_1]\n",
|
||||
" Virtuality Level 1 Vertices: [p_in_1 + p_out_1 -> k_out_2, e_in_1 + e_out_1 -> k_out_1]\n",
|
||||
" Tie: k_out_2 -- k_out_1\n",
|
||||
"Diagram 2: Initial Particles: [p_i_1, e_i_1, e_o_1, p_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [p_i_1 + p_o_1 -> k_o_1, e_i_1 + e_o_1 -> k_o_2]\n",
|
||||
" Tie: k_o_1 -- k_o_2\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
@ -276,20 +268,20 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"execution_count": 44,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Diagram 1: Initial Particles: [e_in_1, e_in_2, e_out_1, e_out_2]\n",
|
||||
" Virtuality Level 1 Vertices: [e_in_1 + e_out_1 -> k_out_1, e_in_2 + e_out_2 -> k_out_2]\n",
|
||||
" Tie: k_out_1 -- k_out_2\n",
|
||||
"Diagram 1: Initial Particles: [e_i_1, e_i_2, e_o_1, e_o_2]\n",
|
||||
" Virtuality Level 1 Vertices: [e_i_2 + e_o_2 -> k_o_2, e_i_1 + e_o_1 -> k_o_1]\n",
|
||||
" Tie: k_o_2 -- k_o_1\n",
|
||||
"\n",
|
||||
"Diagram 2: Initial Particles: [e_in_1, e_in_2, e_out_1, e_out_2]\n",
|
||||
" Virtuality Level 1 Vertices: [e_in_1 + e_out_2 -> k_out_1, e_in_2 + e_out_1 -> k_out_2]\n",
|
||||
" Tie: k_out_1 -- k_out_2\n",
|
||||
"Diagram 2: Initial Particles: [e_i_1, e_i_2, e_o_1, e_o_2]\n",
|
||||
" Virtuality Level 1 Vertices: [e_i_1 + e_o_2 -> k_o_1, e_i_2 + e_o_1 -> k_o_2]\n",
|
||||
" Tie: k_o_1 -- k_o_2\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
@ -309,20 +301,20 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"execution_count": 45,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Diagram 1: Initial Particles: [p_in_1, e_in_1, k_out_1, k_out_2]\n",
|
||||
" Virtuality Level 1 Vertices: [e_in_1 + k_out_1 -> e_in_2, p_in_1 + k_out_2 -> e_out_1]\n",
|
||||
" Tie: e_in_2 -- e_out_1\n",
|
||||
"Diagram 1: Initial Particles: [p_i_1, e_i_1, k_o_1, k_o_2]\n",
|
||||
" Virtuality Level 1 Vertices: [e_i_1 + k_o_2 -> e_i_2, p_i_1 + k_o_1 -> e_o_1]\n",
|
||||
" Tie: e_i_2 -- e_o_1\n",
|
||||
"\n",
|
||||
"Diagram 2: Initial Particles: [p_in_1, e_in_1, k_out_1, k_out_2]\n",
|
||||
" Virtuality Level 1 Vertices: [e_in_1 + k_out_2 -> e_in_2, p_in_1 + k_out_1 -> e_out_1]\n",
|
||||
" Tie: e_in_2 -- e_out_1\n",
|
||||
"Diagram 2: Initial Particles: [p_i_1, e_i_1, k_o_1, k_o_2]\n",
|
||||
" Virtuality Level 1 Vertices: [e_i_1 + k_o_1 -> e_i_2, p_i_1 + k_o_2 -> e_o_1]\n",
|
||||
" Tie: e_i_2 -- e_o_1\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
@ -342,20 +334,20 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"execution_count": 46,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Diagram 1: Initial Particles: [k_in_1, k_in_2, p_out_1, e_out_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_in_1 + e_out_1 -> e_out_2, k_in_2 + p_out_1 -> e_in_1]\n",
|
||||
" Tie: e_out_2 -- e_in_1\n",
|
||||
"Diagram 1: Initial Particles: [k_i_1, k_i_2, e_o_1, p_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_i_1 + p_o_1 -> e_i_1, k_i_2 + e_o_1 -> e_o_2]\n",
|
||||
" Tie: e_i_1 -- e_o_2\n",
|
||||
"\n",
|
||||
"Diagram 2: Initial Particles: [k_in_1, k_in_2, p_out_1, e_out_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_in_1 + p_out_1 -> e_in_1, k_in_2 + e_out_1 -> e_out_2]\n",
|
||||
" Tie: e_in_1 -- e_out_2\n",
|
||||
"Diagram 2: Initial Particles: [k_i_1, k_i_2, e_o_1, p_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_i_1 + e_o_1 -> e_o_2, k_i_2 + p_o_1 -> e_i_1]\n",
|
||||
" Tie: e_o_2 -- e_i_1\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
@ -375,7 +367,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 12,
|
||||
"execution_count": 47,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@ -383,45 +375,45 @@
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Found 8 diagrams:\n",
|
||||
"Diagram 1: Initial Particles: [k_in_1, e_in_1, p_out_1, e_out_1, e_out_2]\n",
|
||||
" Virtuality Level 1 Vertices: [e_in_1 + e_out_1 -> k_out_1, k_in_1 + p_out_1 -> e_in_2]\n",
|
||||
" Virtuality Level 2 Vertices: [e_out_2 + k_out_1 -> e_out_3]\n",
|
||||
" Tie: e_in_2 -- e_out_3\n",
|
||||
"Diagram 1: Initial Particles: [k_i_1, e_i_1, e_o_1, e_o_2, p_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_i_1 + e_o_1 -> e_o_3, e_i_1 + e_o_2 -> k_o_1]\n",
|
||||
" Virtuality Level 2 Vertices: [p_o_1 + k_o_1 -> e_i_2]\n",
|
||||
" Tie: e_o_3 -- e_i_2\n",
|
||||
"\n",
|
||||
"Diagram 2: Initial Particles: [k_in_1, e_in_1, p_out_1, e_out_1, e_out_2]\n",
|
||||
" Virtuality Level 1 Vertices: [k_in_1 + e_out_1 -> e_out_3, p_out_1 + e_out_2 -> k_out_1]\n",
|
||||
" Virtuality Level 2 Vertices: [e_in_1 + e_out_3 -> k_out_2]\n",
|
||||
" Tie: k_out_1 -- k_out_2\n",
|
||||
"Diagram 2: Initial Particles: [k_i_1, e_i_1, e_o_1, e_o_2, p_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_i_1 + p_o_1 -> e_i_2, e_i_1 + e_o_2 -> k_o_1]\n",
|
||||
" Virtuality Level 2 Vertices: [e_o_1 + e_i_2 -> k_o_2]\n",
|
||||
" Tie: k_o_1 -- k_o_2\n",
|
||||
"\n",
|
||||
"Diagram 3: Initial Particles: [k_in_1, e_in_1, p_out_1, e_out_1, e_out_2]\n",
|
||||
" Virtuality Level 1 Vertices: [p_out_1 + e_out_1 -> k_out_1, k_in_1 + e_out_2 -> e_out_3]\n",
|
||||
" Virtuality Level 2 Vertices: [e_in_1 + k_out_1 -> e_in_2]\n",
|
||||
" Tie: e_out_3 -- e_in_2\n",
|
||||
"Diagram 3: Initial Particles: [k_i_1, e_i_1, e_o_1, e_o_2, p_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_i_1 + e_o_2 -> e_o_3, e_i_1 + e_o_1 -> k_o_1]\n",
|
||||
" Virtuality Level 2 Vertices: [p_o_1 + e_o_3 -> k_o_2]\n",
|
||||
" Tie: k_o_1 -- k_o_2\n",
|
||||
"\n",
|
||||
"Diagram 4: Initial Particles: [k_in_1, e_in_1, p_out_1, e_out_1, e_out_2]\n",
|
||||
" Virtuality Level 1 Vertices: [p_out_1 + e_out_2 -> k_out_1, k_in_1 + e_in_1 -> e_in_2]\n",
|
||||
" Virtuality Level 2 Vertices: [e_out_1 + k_out_1 -> e_out_3]\n",
|
||||
" Tie: e_in_2 -- e_out_3\n",
|
||||
"Diagram 4: Initial Particles: [k_i_1, e_i_1, e_o_1, e_o_2, p_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_i_1 + e_i_1 -> e_i_2, e_o_2 + p_o_1 -> k_o_1]\n",
|
||||
" Virtuality Level 2 Vertices: [e_o_1 + e_i_2 -> k_o_2]\n",
|
||||
" Tie: k_o_1 -- k_o_2\n",
|
||||
"\n",
|
||||
"Diagram 5: Initial Particles: [k_in_1, e_in_1, p_out_1, e_out_1, e_out_2]\n",
|
||||
" Virtuality Level 1 Vertices: [e_in_1 + e_out_1 -> k_out_1, k_in_1 + e_out_2 -> e_out_3]\n",
|
||||
" Virtuality Level 2 Vertices: [p_out_1 + k_out_1 -> e_in_2]\n",
|
||||
" Tie: e_out_3 -- e_in_2\n",
|
||||
"Diagram 5: Initial Particles: [k_i_1, e_i_1, e_o_1, e_o_2, p_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_i_1 + e_o_1 -> e_o_3, e_o_2 + p_o_1 -> k_o_1]\n",
|
||||
" Virtuality Level 2 Vertices: [e_i_1 + k_o_1 -> e_i_2]\n",
|
||||
" Tie: e_o_3 -- e_i_2\n",
|
||||
"\n",
|
||||
"Diagram 6: Initial Particles: [k_in_1, e_in_1, p_out_1, e_out_1, e_out_2]\n",
|
||||
" Virtuality Level 1 Vertices: [k_in_1 + p_out_1 -> e_in_2, e_in_1 + e_out_2 -> k_out_1]\n",
|
||||
" Virtuality Level 2 Vertices: [e_out_1 + k_out_1 -> e_out_3]\n",
|
||||
" Tie: e_in_2 -- e_out_3\n",
|
||||
"Diagram 6: Initial Particles: [k_i_1, e_i_1, e_o_1, e_o_2, p_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_i_1 + e_o_2 -> e_o_3, e_o_1 + p_o_1 -> k_o_1]\n",
|
||||
" Virtuality Level 2 Vertices: [e_i_1 + e_o_3 -> k_o_2]\n",
|
||||
" Tie: k_o_1 -- k_o_2\n",
|
||||
"\n",
|
||||
"Diagram 7: Initial Particles: [k_in_1, e_in_1, p_out_1, e_out_1, e_out_2]\n",
|
||||
" Virtuality Level 1 Vertices: [p_out_1 + e_out_1 -> k_out_1, k_in_1 + e_in_1 -> e_in_2]\n",
|
||||
" Virtuality Level 2 Vertices: [e_out_2 + k_out_1 -> e_out_3]\n",
|
||||
" Tie: e_in_2 -- e_out_3\n",
|
||||
"Diagram 7: Initial Particles: [k_i_1, e_i_1, e_o_1, e_o_2, p_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_i_1 + p_o_1 -> e_i_2, e_i_1 + e_o_1 -> k_o_1]\n",
|
||||
" Virtuality Level 2 Vertices: [e_o_2 + k_o_1 -> e_o_3]\n",
|
||||
" Tie: e_i_2 -- e_o_3\n",
|
||||
"\n",
|
||||
"Diagram 8: Initial Particles: [k_in_1, e_in_1, p_out_1, e_out_1, e_out_2]\n",
|
||||
" Virtuality Level 1 Vertices: [k_in_1 + e_out_1 -> e_out_3, e_in_1 + e_out_2 -> k_out_1]\n",
|
||||
" Virtuality Level 2 Vertices: [p_out_1 + k_out_1 -> e_in_2]\n",
|
||||
" Tie: e_out_3 -- e_in_2\n",
|
||||
"Diagram 8: Initial Particles: [k_i_1, e_i_1, e_o_1, e_o_2, p_o_1]\n",
|
||||
" Virtuality Level 1 Vertices: [k_i_1 + e_i_1 -> e_i_2, e_o_1 + p_o_1 -> k_o_1]\n",
|
||||
" Virtuality Level 2 Vertices: [e_o_2 + k_o_1 -> e_o_3]\n",
|
||||
" Tie: e_i_2 -- e_o_3\n",
|
||||
"\n"
|
||||
]
|
||||
}
|
||||
|
111
notebooks/diagram_gen_profiling.ipynb
Normal file
111
notebooks/diagram_gen_profiling.ipynb
Normal file
@ -0,0 +1,111 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "595a07c5-0ecc-4f3e-8cbe-63fc64b456da",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"\u001b[36m\u001b[1m[ \u001b[22m\u001b[39m\u001b[36m\u001b[1mInfo: \u001b[22m\u001b[39mPrecompiling MetagraphOptimization [3e869610-d48d-4942-ba70-c1b702a33ca4]\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"1"
|
||||
]
|
||||
},
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"using BenchmarkTools; using Profile; using PProf; using Revise; using MetagraphOptimization;\n",
|
||||
"Threads.nthreads()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "163f84be-1e2e-480e-9944-1fa4e0eedf3b",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Found 1 NUMA nodes\n",
|
||||
"CUDA is non-functional\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"QED Process: 'ke->kkkkke'"
|
||||
]
|
||||
},
|
||||
"execution_count": 2,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"machine = get_machine_info()\n",
|
||||
"model = QEDModel()\n",
|
||||
"process = parse_process(\"ke->kkkkke\", model)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"id": "6c2eef40-5df0-4396-8e62-5204c4de61f3",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"\"profile.pb.gz\""
|
||||
]
|
||||
},
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
},
|
||||
{
|
||||
"name": "stderr",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Main binary filename not available.\n",
|
||||
"Serving web UI on http://localhost:57599\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"gen_graph(parse_process(\"ke->kke\", model))\n",
|
||||
"Profile.clear()\n",
|
||||
"@profile gen_graph(process)\n",
|
||||
"pprof()"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Julia 1.9.4",
|
||||
"language": "julia",
|
||||
"name": "julia-1.9"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".jl",
|
||||
"mimetype": "application/julia",
|
||||
"name": "julia",
|
||||
"version": "1.9.4"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
129
notebooks/large_compton.ipynb
Normal file
129
notebooks/large_compton.ipynb
Normal file
@ -0,0 +1,129 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"12"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"using MetagraphOptimization\n",
|
||||
"using BenchmarkTools\n",
|
||||
"\n",
|
||||
"Threads.nthreads()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"Graph:\n",
|
||||
" Nodes: Total: 131069, DataTask: 65539, ComputeTaskQED_Sum: 1, \n",
|
||||
" ComputeTaskQED_V: 35280, ComputeTaskQED_S2: 5040, ComputeTaskQED_U: 9, \n",
|
||||
" ComputeTaskQED_S1: 25200\n",
|
||||
" Edges: 176419\n",
|
||||
" Total Compute Effort: 549370.0\n",
|
||||
" Total Data Transfer: 1.0645344e7\n",
|
||||
" Total Compute Intensity: 0.05160659909158408\n"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"machine = get_machine_info()\n",
|
||||
"model = QEDModel()\n",
|
||||
"process = parse_process(\"ke->kkkkkke\", model)\n",
|
||||
"\n",
|
||||
"inputs = [gen_process_input(process) for _ in 1:1e3];\n",
|
||||
"graph = gen_graph(process)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"Graph:\n",
|
||||
" Nodes: Total: 14783, DataTask: 7396, ComputeTaskQED_Sum: 1, \n",
|
||||
" ComputeTaskQED_V: 1819, ComputeTaskQED_S2: 5040, ComputeTaskQED_U: 9, \n",
|
||||
" ComputeTaskQED_S1: 518\n",
|
||||
" Edges: 26672\n",
|
||||
" Total Compute Effort: 77102.0\n",
|
||||
" Total Data Transfer: 5.063616e6\n",
|
||||
" Total Compute Intensity: 0.015226668056977465\n"
|
||||
]
|
||||
},
|
||||
"metadata": {},
|
||||
"output_type": "display_data"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"optimizer = ReductionOptimizer()\n",
|
||||
"\n",
|
||||
"optimize_to_fixpoint!(optimizer, graph)\n",
|
||||
"graph"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "stdout",
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Calculated 15537.0 results/s, 1295.0 results/s per thread for QED Process: 'ke->kkkkkke' (12 threads)\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"compute_compton_reduced = get_compute_function(graph, process, machine)\n",
|
||||
"outputs = [zero(ComplexF64) for _ in 1:1e6]\n",
|
||||
"\n",
|
||||
"bench_result = @benchmark begin\n",
|
||||
" Threads.@threads :static for i in eachindex(inputs)\n",
|
||||
" outputs[i] = compute_compton_reduced(inputs[i])\n",
|
||||
" end\n",
|
||||
"end\n",
|
||||
"\n",
|
||||
"rate = length(inputs) / (mean(bench_result.times) / 1.0e9)\n",
|
||||
"rate_per_thread = rate / Threads.nthreads()\n",
|
||||
"println(\"Calculated $(round(rate)) results/s, $(round(rate_per_thread)) results/s per thread for $(process) ($(Threads.nthreads()) threads)\")"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Julia 1.9.4",
|
||||
"language": "julia",
|
||||
"name": "julia-1.9"
|
||||
},
|
||||
"language_info": {
|
||||
"file_extension": ".jl",
|
||||
"mimetype": "application/julia",
|
||||
"name": "julia",
|
||||
"version": "1.9.4"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
@ -72,6 +72,7 @@ export ComputeTaskQED_S2
|
||||
export ComputeTaskQED_V
|
||||
export ComputeTaskQED_U
|
||||
export ComputeTaskQED_Sum
|
||||
export gen_graph
|
||||
|
||||
# code generation related
|
||||
export execute
|
||||
|
@ -41,7 +41,7 @@ function show(io::IO, graph::DAG)
|
||||
if length(graph.nodes) <= 20
|
||||
show_nodes(io, graph)
|
||||
else
|
||||
print("Total: ", length(graph.nodes), ", ")
|
||||
print(io, "Total: ", length(graph.nodes), ", ")
|
||||
first = true
|
||||
i = 0
|
||||
for (type, number) in zip(keys(nodeDict), values(nodeDict))
|
||||
@ -49,12 +49,12 @@ function show(io::IO, graph::DAG)
|
||||
if first
|
||||
first = false
|
||||
else
|
||||
print(", ")
|
||||
print(io, ", ")
|
||||
end
|
||||
if (i % 3 == 0)
|
||||
print("\n ")
|
||||
print(io, "\n ")
|
||||
end
|
||||
print(type, ": ", number)
|
||||
print(io, type, ": ", number)
|
||||
end
|
||||
end
|
||||
println(io)
|
||||
|
@ -96,13 +96,16 @@ end
|
||||
compute(::ComputeTaskQED_S1, data::QEDParticleValue)
|
||||
|
||||
Compute inner edge (1 input particle, 1 output particle).
|
||||
|
||||
11 FLOP.
|
||||
"""
|
||||
function compute(::ComputeTaskQED_S1, data::QEDParticleValue{P})::QEDParticleValue where {P <: QEDParticle}
|
||||
new_p = propagation_result(P)(data.p)
|
||||
newP = propagation_result(P)
|
||||
new_p = newP(data.p)
|
||||
# inner edge is just a scalar, can multiply from either side
|
||||
return QEDParticleValue{newP}(new_p, data.v * QED_inner_edge(new_p))
|
||||
if typeof(data.v) <: BiSpinor
|
||||
return ParticleValue(new_p, QED_inner_edge(new_p) * data.v)
|
||||
else
|
||||
return ParticleValue(new_p, data.v * QED_inner_edge(new_p))
|
||||
end
|
||||
end
|
||||
|
||||
"""
|
||||
|
@ -45,8 +45,7 @@ function gen_process_input(processDescription::QEDProcessDescription)
|
||||
index = 1
|
||||
for (particle, n) in processDescription.outParticles
|
||||
for _ in 1:n
|
||||
mom = final_momenta[index]
|
||||
push!(outputParticles, particle(SFourMomentum(mom.E, mom.px, mom.py, mom.pz)))
|
||||
push!(outputParticles, particle(final_momenta[index]))
|
||||
index += 1
|
||||
end
|
||||
end
|
||||
@ -68,6 +67,7 @@ function gen_graph(process_description::QEDProcessDescription)
|
||||
graph = DAG()
|
||||
|
||||
COMPLEX_SIZE = sizeof(ComplexF64)
|
||||
PARTICLE_VALUE_SIZE = 96.0
|
||||
|
||||
# TODO: Not all diagram outputs should always be summed at the end, if they differ by fermion exchange they need to be diffed
|
||||
# Should not matter for n-Photon Compton processes though
|
||||
@ -79,14 +79,93 @@ function gen_graph(process_description::QEDProcessDescription)
|
||||
dataOutNodes = Dict()
|
||||
|
||||
for particle in initial_diagram.particles
|
||||
# generate U tasks
|
||||
# generate data in and U tasks
|
||||
data_in = insert_node!(
|
||||
graph,
|
||||
make_node(DataTask(PARTICLE_VALUE_SIZE), String(particle)),
|
||||
track = false,
|
||||
invalidate_cache = false,
|
||||
) # read particle data node
|
||||
compute_u = insert_node!(graph, make_node(ComputeTaskQED_U()), track = false, invalidate_cache = false) # compute U node
|
||||
data_out =
|
||||
insert_node!(graph, make_node(DataTask(PARTICLE_VALUE_SIZE)), track = false, invalidate_cache = false) # transfer data out from u (one ABCParticleValue object)
|
||||
|
||||
insert_edge!(graph, data_in, compute_u, track = false, invalidate_cache = false)
|
||||
insert_edge!(graph, compute_u, data_out, track = false, invalidate_cache = false)
|
||||
|
||||
# remember the data_out node for future edges
|
||||
dataOutNodes[String(particle)] = data_out
|
||||
end
|
||||
|
||||
for diagram in diagrams
|
||||
for (vertices, ties) in zip(diagram.vertices, diagram.ties)
|
||||
#dataOutBackup = copy(dataOutNodes)
|
||||
|
||||
for diagram in diagrams
|
||||
# the intermediate (virtual) particles change across
|
||||
#dataOutNodes = copy(dataOutBackup)
|
||||
|
||||
tie = diagram.tie[]
|
||||
|
||||
# handle the vertices
|
||||
for vertices in diagram.vertices
|
||||
for vertex in vertices
|
||||
data_in1 = dataOutNodes[String(vertex.in1)]
|
||||
data_in2 = dataOutNodes[String(vertex.in2)]
|
||||
|
||||
compute_V = insert_node!(graph, make_node(ComputeTaskQED_V()), track = false, invalidate_cache = false) # compute vertex
|
||||
|
||||
insert_edge!(graph, data_in1, compute_V, track = false, invalidate_cache = false)
|
||||
insert_edge!(graph, data_in2, compute_V, track = false, invalidate_cache = false)
|
||||
|
||||
data_V_out = insert_node!(
|
||||
graph,
|
||||
make_node(DataTask(PARTICLE_VALUE_SIZE)),
|
||||
track = false,
|
||||
invalidate_cache = false,
|
||||
)
|
||||
|
||||
insert_edge!(graph, compute_V, data_V_out, track = false, invalidate_cache = false)
|
||||
|
||||
if (vertex.out == tie.in1 || vertex.out == tie.in2)
|
||||
# out particle is part of the tie -> there will be an S2 task with it later, don't make S1 task
|
||||
dataOutNodes[String(vertex.out)] = data_V_out
|
||||
continue
|
||||
end
|
||||
|
||||
# otherwise, add S1 task
|
||||
compute_S1 =
|
||||
insert_node!(graph, make_node(ComputeTaskQED_S1()), track = false, invalidate_cache = false) # compute propagator
|
||||
|
||||
insert_edge!(graph, data_V_out, compute_S1, track = false, invalidate_cache = false)
|
||||
|
||||
data_S1_out = insert_node!(
|
||||
graph,
|
||||
make_node(DataTask(PARTICLE_VALUE_SIZE)),
|
||||
track = false,
|
||||
invalidate_cache = false,
|
||||
)
|
||||
|
||||
insert_edge!(graph, compute_S1, data_S1_out, track = false, invalidate_cache = false)
|
||||
|
||||
# overrides potentially different nodes from previous diagrams, which is intentional
|
||||
dataOutNodes[String(vertex.out)] = data_S1_out
|
||||
end
|
||||
end
|
||||
|
||||
# handle the tie
|
||||
data_in1 = dataOutNodes[String(tie.in1)]
|
||||
data_in2 = dataOutNodes[String(tie.in2)]
|
||||
|
||||
compute_S2 = insert_node!(graph, make_node(ComputeTaskQED_S2()), track = false, invalidate_cache = false)
|
||||
|
||||
data_S2 = insert_node!(graph, make_node(DataTask(PARTICLE_VALUE_SIZE)), track = false, invalidate_cache = false)
|
||||
|
||||
insert_edge!(graph, data_in1, compute_S2, track = false, invalidate_cache = false)
|
||||
insert_edge!(graph, data_in2, compute_S2, track = false, invalidate_cache = false)
|
||||
|
||||
insert_edge!(graph, compute_S2, data_S2, track = false, invalidate_cache = false)
|
||||
|
||||
insert_edge!(graph, data_S2, sum_node, track = false, invalidate_cache = false)
|
||||
add_child!(task(sum_node))
|
||||
end
|
||||
|
||||
return graph
|
||||
|
@ -46,6 +46,7 @@ struct FeynmanDiagram
|
||||
vertices::Vector{Set{FeynmanVertex}}
|
||||
tie::Ref{Union{FeynmanTie, Missing}}
|
||||
particles::Vector{FeynmanParticle}
|
||||
type_ids::Dict{Type, Int64} # lut for number of used ids for a particle type
|
||||
end
|
||||
|
||||
"""
|
||||
@ -67,7 +68,16 @@ function FeynmanDiagram(pd::QEDProcessDescription)
|
||||
push!(parts, FeynmanParticle(type, i))
|
||||
end
|
||||
end
|
||||
return FeynmanDiagram([], missing, parts)
|
||||
ids = Dict{Type, Int64}()
|
||||
for t in types(QEDModel())
|
||||
if (isincoming(t))
|
||||
ids[t] = get(pd.inParticles, t, 0)
|
||||
else
|
||||
ids[t] = get(pd.outParticles, t, 0)
|
||||
end
|
||||
end
|
||||
|
||||
return FeynmanDiagram([], missing, parts, ids)
|
||||
end
|
||||
|
||||
function particle_after_tie(p::FeynmanParticle, t::FeynmanTie)
|
||||
@ -81,6 +91,10 @@ function vertex_after_tie(v::FeynmanVertex, t::FeynmanTie)
|
||||
return FeynmanVertex(particle_after_tie(v.in1, t), particle_after_tie(v.in2, t), particle_after_tie(v.out, t))
|
||||
end
|
||||
|
||||
function vertex_after_tie(v::FeynmanVertex, t::Missing)
|
||||
return v
|
||||
end
|
||||
|
||||
function vertex_set_after_tie(vs::Set{FeynmanVertex}, t::FeynmanTie)
|
||||
return Set{FeynmanVertex}(vertex_after_tie(v, t) for v in vs)
|
||||
end
|
||||
@ -89,6 +103,10 @@ function vertex_set_after_tie(vs::Set{FeynmanVertex}, t::Missing)
|
||||
return vs
|
||||
end
|
||||
|
||||
function vertex_set_after_tie(vs::Set{FeynmanVertex}, t1::Union{FeynmanTie, Missing}, t2::Union{FeynmanTie, Missing})
|
||||
return Set{FeynmanVertex}(vertex_after_tie(vertex_after_tie(v, t1), t2) for v in vs)
|
||||
end
|
||||
|
||||
"""
|
||||
String(p::FeynmanParticle)
|
||||
|
||||
@ -99,27 +117,23 @@ function String(p::FeynmanParticle)
|
||||
end
|
||||
|
||||
function hash(v::FeynmanVertex)
|
||||
return hash(Set{FeynmanParticle}([v.in1, v.in2]))
|
||||
return hash(v.in1) * hash(v.in2)
|
||||
end
|
||||
|
||||
function hash(t::FeynmanTie)
|
||||
return hash(Set{FeynmanParticle}([t.in1, t.in2]))
|
||||
return hash(t.in1) * hash(t.in2)
|
||||
end
|
||||
|
||||
function hash(d::FeynmanDiagram)
|
||||
if (isempty(d.vertices))
|
||||
return hash(d.particles)
|
||||
end
|
||||
|
||||
return hash((vertex_set_after_tie(union(d.vertices...), d.tie[]), d.particles))
|
||||
return hash((d.vertices, d.particles))
|
||||
end
|
||||
|
||||
function ==(v1::FeynmanVertex, v2::FeynmanVertex)
|
||||
return Set{FeynmanParticle}([v1.in1, v1.in2]) == Set{FeynmanParticle}([v2.in1, v2.in2])
|
||||
return (v1.in1 == v2.in1 && v1.in2 == v2.in1) || (v1.in2 == v2.in1 && v1.in1 == v2.in2)
|
||||
end
|
||||
|
||||
function ==(t1::FeynmanTie, t2::FeynmanTie)
|
||||
return Set{FeynmanParticle}([t1.in1, t1.in2]) == Set{FeynmanParticle}([t2.in1, t2.in2])
|
||||
return (t1.in1 == t2.in1 && t1.in2 == t2.in1) || (t1.in2 == t2.in1 && t1.in1 == t2.in2)
|
||||
end
|
||||
|
||||
function ==(d1::FeynmanDiagram, d2::FeynmanDiagram)
|
||||
@ -129,13 +143,26 @@ function ==(d1::FeynmanDiagram, d2::FeynmanDiagram)
|
||||
if d1.particles != d2.particles
|
||||
return false
|
||||
end
|
||||
if length(d1.vertices) != length(d2.vertices)
|
||||
return false
|
||||
end
|
||||
|
||||
# TODO can i prove that this works?
|
||||
return vertex_set_after_tie(vertex_set_after_tie(union(d1.vertices...), d1.tie[]), d2.tie[]) ==
|
||||
vertex_set_after_tie(vertex_set_after_tie(union(d2.vertices...), d1.tie[]), d2.tie[])
|
||||
for (v1, v2) in zip(d1.vertices, d2.vertices)
|
||||
if vertex_set_after_tie(v1, d1.tie[], d2.tie[]) != vertex_set_after_tie(v2, d1.tie[], d2.tie[])
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
|
||||
#=return isequal.(
|
||||
vertex_set_after_tie(d1.vertices, d1.tie, d2.tie),
|
||||
vertex_set_after_tie(d2.vertices, d1.tie, d2.tie),
|
||||
)=#
|
||||
end
|
||||
|
||||
copy(fd::FeynmanDiagram) = FeynmanDiagram(deepcopy(fd.vertices), copy(fd.tie[]), deepcopy(fd.particles))
|
||||
copy(fd::FeynmanDiagram) =
|
||||
FeynmanDiagram(deepcopy(fd.vertices), copy(fd.tie[]), deepcopy(fd.particles), copy(fd.type_ids))
|
||||
|
||||
"""
|
||||
id_for_type(d::FeynmanDiagram, t::Type{<:QEDParticle})
|
||||
@ -143,16 +170,7 @@ copy(fd::FeynmanDiagram) = FeynmanDiagram(deepcopy(fd.vertices), copy(fd.tie[]),
|
||||
Return the highest id of any particle of the given type in the diagram + 1.
|
||||
"""
|
||||
function id_for_type(d::FeynmanDiagram, t::Type{<:QEDParticle})
|
||||
id = 1
|
||||
for l in 0:length(d.vertices)
|
||||
particles = get_particles(d, l)
|
||||
for p in particles
|
||||
if (p.particle <: t)
|
||||
id = max(id, p.id + 1)
|
||||
end
|
||||
end
|
||||
end
|
||||
return id
|
||||
return d.type_ids[t] + 1
|
||||
end
|
||||
|
||||
"""
|
||||
@ -241,6 +259,7 @@ function add_vertex!(fd::FeynmanDiagram, vertex::FeynmanVertex)
|
||||
for i in eachindex(fd.vertices)
|
||||
if (can_apply_vertex(get_particles(fd, i - 1), vertex))
|
||||
push!(fd.vertices[i], vertex)
|
||||
fd.type_ids[vertex.out.particle] += 1
|
||||
return nothing
|
||||
end
|
||||
end
|
||||
@ -251,6 +270,8 @@ function add_vertex!(fd::FeynmanDiagram, vertex::FeynmanVertex)
|
||||
|
||||
push!(fd.vertices, Set{FeynmanVertex}())
|
||||
push!(fd.vertices[end], vertex)
|
||||
fd.type_ids[vertex.out.particle] += 1
|
||||
|
||||
return nothing
|
||||
end
|
||||
|
||||
@ -334,7 +355,8 @@ function possible_vertices(fd::FeynmanDiagram)
|
||||
possibilities = Vector{FeynmanVertex}()
|
||||
fully_generated_particles = get_particles(fd)
|
||||
|
||||
for l in 0:length(fd.vertices)
|
||||
min_level = max(0, length(fd.vertices) - 1)
|
||||
for l in min_level:length(fd.vertices)
|
||||
particles = get_particles(fd, l)
|
||||
for i in 1:length(particles)
|
||||
for j in (i + 1):length(particles)
|
||||
@ -397,16 +419,22 @@ function possible_tie(fd::FeynmanDiagram)
|
||||
return missing
|
||||
end
|
||||
|
||||
function remove_duplicates(my_set::Set{FeynmanDiagram}, is_eq)
|
||||
new_set = Set()
|
||||
function remove_duplicates(compare_set::Set{FeynmanDiagram})
|
||||
result = Set()
|
||||
|
||||
for x in my_set
|
||||
if all(!is_eq(x, y) for y in new_set)
|
||||
push!(new_set, x)
|
||||
while !isempty(compare_set)
|
||||
x = pop!(compare_set)
|
||||
# we know there will only be one duplicate if any, so search for that and delete it
|
||||
for y in compare_set
|
||||
if x == y
|
||||
delete!(compare_set, y)
|
||||
break
|
||||
end
|
||||
end
|
||||
push!(result, x)
|
||||
end
|
||||
|
||||
return new_set
|
||||
return result
|
||||
end
|
||||
|
||||
"""
|
||||
@ -420,23 +448,37 @@ function gen_diagrams(fd::FeynmanDiagram)
|
||||
|
||||
push!(working, fd)
|
||||
|
||||
while !isempty(working)
|
||||
d = pop!(working)
|
||||
# we know there will be particle_number - 2 vertices, followed by 1 tie
|
||||
n_particles = length(fd.particles)
|
||||
n_vertices = n_particles - 2
|
||||
|
||||
possibilities = possible_vertices(d)
|
||||
for v in possibilities
|
||||
push!(working, add_vertex(d, v))
|
||||
# doing this in iterations should reduce the intermediate number of diagrams by hash collisions
|
||||
for _ in 1:n_vertices
|
||||
next_iter_set = Set{FeynmanDiagram}()
|
||||
|
||||
while !isempty(working)
|
||||
d = pop!(working)
|
||||
|
||||
possibilities = possible_vertices(d)
|
||||
for v in possibilities
|
||||
push!(next_iter_set, add_vertex(d, v))
|
||||
end
|
||||
end
|
||||
|
||||
# can only find a tie when no vertices are possible anymore anyways
|
||||
working = next_iter_set
|
||||
end
|
||||
|
||||
# add the tie
|
||||
for d in working
|
||||
tie = possible_tie(d)
|
||||
if !ismissing(tie)
|
||||
add_tie!(d, tie)
|
||||
if (isvalid(d))
|
||||
push!(results, d)
|
||||
end
|
||||
if ismissing(tie)
|
||||
continue
|
||||
end
|
||||
add_tie!(d, tie)
|
||||
if isvalid(d)
|
||||
push!(results, d)
|
||||
end
|
||||
end
|
||||
|
||||
return remove_duplicates(results, ==)
|
||||
return remove_duplicates(results)
|
||||
end
|
||||
|
@ -169,8 +169,8 @@ end
|
||||
String(::Type{Incoming}) = "Incoming"
|
||||
String(::Type{Outgoing}) = "Outgoing"
|
||||
|
||||
String(::Incoming) = "in"
|
||||
String(::Outgoing) = "out"
|
||||
String(::Incoming) = "i"
|
||||
String(::Outgoing) = "o"
|
||||
|
||||
function String(::Type{<:PhotonStateful})
|
||||
return "k"
|
||||
|
@ -1,38 +1,41 @@
|
||||
using SafeTestsets
|
||||
|
||||
@safetestset "Utility Unit Tests" begin
|
||||
@safetestset "Utility Unit Tests " begin
|
||||
include("unit_tests_utility.jl")
|
||||
end
|
||||
@safetestset "Task Unit Tests" begin
|
||||
@safetestset "Task Unit Tests " begin
|
||||
include("unit_tests_tasks.jl")
|
||||
end
|
||||
@safetestset "Node Unit Tests" begin
|
||||
@safetestset "Node Unit Tests " begin
|
||||
include("unit_tests_nodes.jl")
|
||||
end
|
||||
@safetestset "Properties Unit Tests" begin
|
||||
@safetestset "Properties Unit Tests " begin
|
||||
include("unit_tests_properties.jl")
|
||||
end
|
||||
@safetestset "Estimation Unit Tests" begin
|
||||
@safetestset "Estimation Unit Tests " begin
|
||||
include("unit_tests_estimator.jl")
|
||||
end
|
||||
@safetestset "ABC-Model Unit Tests" begin
|
||||
@safetestset "ABC-Model Unit Tests " begin
|
||||
include("unit_tests_abcmodel.jl")
|
||||
end
|
||||
@safetestset "QED-Model Unit Tests" begin
|
||||
@safetestset "QED Feynman Diagram Generation Tests" begin
|
||||
include("unit_tests_qed_diagrams.jl")
|
||||
end
|
||||
@safetestset "QED-Model Unit Tests " begin
|
||||
include("unit_tests_qedmodel.jl")
|
||||
end
|
||||
@safetestset "Node Reduction Unit Tests" begin
|
||||
@safetestset "Node Reduction Unit Tests " begin
|
||||
include("node_reduction.jl")
|
||||
end
|
||||
@safetestset "Graph Unit Tests" begin
|
||||
@safetestset "Graph Unit Tests " begin
|
||||
include("unit_tests_graph.jl")
|
||||
end
|
||||
@safetestset "Execution Unit Tests" begin
|
||||
@safetestset "Execution Unit Tests " begin
|
||||
include("unit_tests_execution.jl")
|
||||
end
|
||||
@safetestset "Optimization Unit Tests" begin
|
||||
@safetestset "Optimization Unit Tests " begin
|
||||
include("unit_tests_optimization.jl")
|
||||
end
|
||||
@safetestset "Known Graph Tests" begin
|
||||
@safetestset "Known Graph Tests " begin
|
||||
include("known_graphs.jl")
|
||||
end
|
||||
|
47
test/unit_tests_qed_diagrams.jl
Normal file
47
test/unit_tests_qed_diagrams.jl
Normal file
@ -0,0 +1,47 @@
|
||||
using MetagraphOptimization
|
||||
|
||||
import MetagraphOptimization.gen_diagrams
|
||||
import MetagraphOptimization.isincoming
|
||||
import MetagraphOptimization.types
|
||||
|
||||
|
||||
model = QEDModel()
|
||||
compton = ("Compton Scattering", parse_process("ke->ke", model), 2)
|
||||
compton_3 = ("3-Photon Compton Scattering", parse_process("kkke->ke", QEDModel()), 24)
|
||||
compton_4 = ("4-Photon Compton Scattering", parse_process("kkkke->ke", QEDModel()), 120)
|
||||
bhabha = ("Bhabha Scattering", parse_process("ep->ep", model), 2)
|
||||
moller = ("Møller Scattering", parse_process("ee->ee", model), 2)
|
||||
pair_production = ("Pair production", parse_process("kk->ep", model), 2)
|
||||
pair_annihilation = ("Pair annihilation", parse_process("ep->kk", model), 2)
|
||||
trident = ("Trident", parse_process("ke->epe", model), 8)
|
||||
|
||||
@testset "Known Processes" begin
|
||||
@testset "$name" for (name, process, n) in
|
||||
[compton, bhabha, moller, pair_production, pair_annihilation, trident, compton_3, compton_4]
|
||||
initial_diagram = FeynmanDiagram(process)
|
||||
|
||||
n_particles = 0
|
||||
for type in types(model)
|
||||
if (isincoming(type))
|
||||
n_particles += get(process.inParticles, type, 0)
|
||||
else
|
||||
n_particles += get(process.outParticles, type, 0)
|
||||
end
|
||||
end
|
||||
@test n_particles == length(initial_diagram.particles)
|
||||
@test ismissing(initial_diagram.tie[])
|
||||
@test isempty(initial_diagram.vertices)
|
||||
|
||||
result_diagrams = gen_diagrams(initial_diagram)
|
||||
@test length(result_diagrams) == n
|
||||
|
||||
for d in result_diagrams
|
||||
n_vertices = 0
|
||||
for vs in d.vertices
|
||||
n_vertices += length(vs)
|
||||
end
|
||||
@test n_vertices == n_particles - 2
|
||||
@test !ismissing(d.tie[])
|
||||
end
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user