-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Uwe Hernandez Acosta
committed
Nov 27, 2024
1 parent
0ac3b24
commit 9fa7847
Showing
5 changed files
with
291 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,223 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"id": "dd65841c-9106-4e60-93c8-6cae5cff9c04", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"MersenneTwister(1)" | ||
] | ||
}, | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"using QEDcore\n", | ||
"using Random\n", | ||
"RNG = MersenneTwister(1)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 12, | ||
"id": "ad07e5d2-9e2c-4fc3-ab75-87508a442cc7", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stderr", | ||
"output_type": "stream", | ||
"text": [ | ||
"\u001b[32m\u001b[1m Resolving\u001b[22m\u001b[39m package versions...\n", | ||
"\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/Work/jlProjects/QEDjl-project/forks/QEDcore.jl/Project.toml`\n", | ||
"\u001b[32m\u001b[1m No Changes\u001b[22m\u001b[39m to `~/Work/jlProjects/QEDjl-project/forks/QEDcore.jl/Manifest.toml`\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"import Pkg\n", | ||
"Pkg.add(\"SpecialFunctions\")\n", | ||
"using SpecialFunctions" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 18, | ||
"id": "659b62c6-1ec3-4b43-bd76-f164b0d48b95", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"using BenchmarkTools" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "0fe32a00-322c-41f3-bfc4-fa717e4984d0", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"Main.TestImplementation" | ||
] | ||
}, | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"include(\"test/test_implementation/TestImplementation.jl\")\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 27, | ||
"id": "f4ecc2d4-d3d0-45d6-833a-35be9b336ee3", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"TESTSQRTS = 24.53580264675422\n" | ||
] | ||
}, | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"5-element Vector{SFourMomentum}:\n", | ||
" [15.044106836425321, 13.336070515918811, 1.527307257013702, -6.39153395069551]\n", | ||
" [17.336250415222185, 14.379561966652835, 0.4621811079199091, -9.395220313008341]\n", | ||
" [4.093524330439206, 1.9013732530288348, -2.0798301891956785, -1.8777719724914776]\n", | ||
" [65.80222040736777, 59.00899489001489, 8.728105773351555, -27.75339442697402]\n", | ||
" [23.071168998359795, 19.545379937281332, 1.1076748703459958, -12.148663236743474]" | ||
] | ||
}, | ||
"execution_count": 27, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"MODEL = TestImplementation.TestModel()\n", | ||
"INPSL = TestImplementation.TrivialInPSL()\n", | ||
"\n", | ||
"N_INCOMING = 2\n", | ||
"N_OUTGOING = 5\n", | ||
"\n", | ||
"INCOMING_PARTICLES = Tuple(rand(RNG, TestImplementation.PARTICLE_SET, N_INCOMING))\n", | ||
"IN_MASSES = mass.(INCOMING_PARTICLES)\n", | ||
"SUM_IN_MASSES = sum(IN_MASSES)\n", | ||
"\n", | ||
"OUTGOING_PARTICLES = Tuple(rand(RNG, TestImplementation.PARTICLE_SET, N_OUTGOING))\n", | ||
"OUT_MASSES = mass.(OUTGOING_PARTICLES)\n", | ||
"SUM_OUT_MASSES = sum(OUT_MASSES)\n", | ||
"TESTSQRTS = (1 + rand(RNG)) * (SUM_OUT_MASSES + SUM_IN_MASSES)\n", | ||
"@show TESTSQRTS\n", | ||
"\n", | ||
"PROC = TestImplementation.TestProcess(INCOMING_PARTICLES, OUTGOING_PARTICLES)\n", | ||
"\n", | ||
"INMOMS = TestImplementation._generate_onshell_two_body_moms(\n", | ||
" RNG, IN_MASSES, TESTSQRTS\n", | ||
")\n", | ||
"\n", | ||
"test_out_psl = FlatPhaseSpaceLayout(INPSL)\n", | ||
"\n", | ||
"OUTCOORDS = Tuple(rand(RNG, 4 * N_OUTGOING))\n", | ||
"\n", | ||
"out_moms = build_momenta(\n", | ||
" PROC, MODEL, INMOMS, test_out_psl, OUTCOORDS\n", | ||
")\n", | ||
"\n", | ||
"\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 25, | ||
"id": "affcc929-b36d-49c8-845e-a6142a98cbb4", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"massless_weight (generic function with 1 method)" | ||
] | ||
}, | ||
"execution_count": 25, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"function massless_weight(n_out,sqrt_s)\n", | ||
" return (pi/2)^(n_out-1)*sqrt_s^(2*n_out-4)/(factorial(n_out-1)*factorial(n_out-2))\n", | ||
"end" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 28, | ||
"id": "5bf79f89-f703-483c-b060-d641ba075fa8", | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"BenchmarkTools.Trial: 10000 samples with 999 evaluations.\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[1m8.925 ns\u001b[22m\u001b[39m … \u001b[35m209.918 ns\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmin … max\u001b[90m): \u001b[39m0.00% … 0.00%\n", | ||
" Time \u001b[90m(\u001b[39m\u001b[34m\u001b[1mmedian\u001b[22m\u001b[39m\u001b[90m): \u001b[39m\u001b[34m\u001b[1m9.050 ns \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[1m9.283 ns\u001b[22m\u001b[39m ± \u001b[32m 2.715 ns\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmean ± σ\u001b[90m): \u001b[39m0.00% ± 0.00%\n", | ||
"\n", | ||
" \u001b[39m▄\u001b[39m█\u001b[34m▇\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 \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[34m█\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▁\u001b[39m▁\u001b[39m▄\u001b[39m▃\u001b[39m▃\u001b[39m▃\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▄\u001b[39m \u001b[39m█\n", | ||
" 8.92 ns\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 12.1 ns \u001b[0m\u001b[1m<\u001b[22m\n", | ||
"\n", | ||
" Memory estimate\u001b[90m: \u001b[39m\u001b[33m0 bytes\u001b[39m, allocs estimate\u001b[90m: \u001b[39m\u001b[33m0\u001b[39m." | ||
] | ||
}, | ||
"execution_count": 28, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"@benchmark massless_weight($N_OUTGOING,$TESTSQRTS)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "2a648d3f-add6-495f-bc59-0777e9429594", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"function massive_weight()\n", | ||
"\n", | ||
"end" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Julia 1.10.5", | ||
"language": "julia", | ||
"name": "julia-1.10" | ||
}, | ||
"language_info": { | ||
"file_extension": ".jl", | ||
"mimetype": "application/julia", | ||
"name": "julia", | ||
"version": "1.10.5" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
repos: | ||
- repo: https://github.com/Lucas-C/pre-commit-hooks | ||
rev: v1.5.4 | ||
hooks: | ||
- id: forbid-crlf | ||
- id: remove-crlf | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.5.0 | ||
hooks: | ||
- id: check-added-large-files | ||
args: ['--maxkb=5120'] # 5MB | ||
- id: check-executables-have-shebangs | ||
- id: check-shebang-scripts-are-executable | ||
- id: trailing-whitespace | ||
exclude: &exclude_txtfiles >- | ||
(?x)^( | ||
test/.*\.win| | ||
test/.*\.amn| | ||
test/.*\.mmn| | ||
test/.*\.vmn| | ||
test/.*\.eig| | ||
test/.*\.chk.fmt| | ||
test/.*\.nnkp| | ||
test/.*\.wout| | ||
test/.*_band.dat| | ||
test/.*_band.kpt| | ||
test/.*_band.labelinfo.dat| | ||
test/.*_tb.dat| | ||
test/.*_hr.dat| | ||
test/.*_wsvec.dat| | ||
test/.*\.xsf| | ||
test/.*\.cube| | ||
test/.*\.bxsf | ||
)$ | ||
- id: mixed-line-ending | ||
exclude: *exclude_txtfiles | ||
- id: end-of-file-fixer | ||
exclude: *exclude_txtfiles | ||
- id: check-merge-conflict | ||
- id: check-yaml | ||
args: [ --unsafe ] | ||
- id: check-json | ||
- id: check-toml | ||
- id: check-xml | ||
- repo: https://github.com/qiaojunfeng/pre-commit-julia-format | ||
rev: v0.2.0 | ||
hooks: | ||
- id: julia-format | ||
args: [--project=.formatting] | ||
exclude: >- | ||
(?x)^( | ||
deps/statements.jl | ||
)$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters