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

Caching harmonic sums #202

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
c14b43e
Split math of status quo
felixhekhorn Jan 11, 2023
85c2da6
Move ads to new layout
felixhekhorn Jan 12, 2023
10d2240
Add pytest coverage
felixhekhorn Jan 12, 2023
8fd5436
fix init name
giacomomagni Jan 16, 2023
4678da7
Start reshuffling OME
felixhekhorn Jan 16, 2023
694a239
Move ad benchmark
felixhekhorn Jan 16, 2023
ec04696
Move OME
felixhekhorn Jan 17, 2023
febd415
Add missing init file
felixhekhorn Jan 17, 2023
bb6af22
propagate polarized and time-like from op card to op.__init__
giacomomagni Jan 16, 2023
3db8696
Add switch for OME
felixhekhorn Jan 17, 2023
7a74ddb
Fix function names
felixhekhorn Jan 17, 2023
1126089
Fix runcard translation
felixhekhorn Jan 26, 2023
9226ccc
Init cache at LO
felixhekhorn Jan 26, 2023
45b95a5
Update src/ekore/harmonics/cache.py
felixhekhorn Jan 27, 2023
764d876
added all harmonic sums that are currently implemented to new cache, …
t7phy Jan 30, 2023
d2fd535
with pre-commit
t7phy Jan 30, 2023
3d766ba
change imports to use eko.constants
t7phy Jan 30, 2023
26f1ddb
added fractional harmonic sums and g functions to cache
t7phy Jan 31, 2023
611f3bb
harmonic sums Smx using cache
t7phy Feb 1, 2023
e88edf9
removal of recursive imports while preserving use of already computed…
t7phy Feb 1, 2023
0168fa1
g3p1 and g3p2 added to cache
t7phy Feb 6, 2023
65fee8a
sm21 and pylint error fixes for cache file
t7phy Feb 9, 2023
0d2c8d2
additional cache error fixes
t7phy Feb 9, 2023
51d8ec8
merge master in harmonic-sums-cache
t7phy Feb 9, 2023
0cf143d
merge master in harmonic-sums-cache
t7phy Feb 9, 2023
5de8a74
resolve merge conflicts
t7phy Feb 9, 2023
07eec29
resolve merge conflicts
t7phy Feb 9, 2023
12fbe7a
complete implementation of new harmonic sums cachefor spacelike case
t7phy Feb 10, 2023
1f4e9b5
some error fixes
t7phy Feb 10, 2023
1e3adf9
new cache consistency fixes
t7phy Feb 10, 2023
483107c
fixed some tests to work with new cache
t7phy Feb 10, 2023
0d5fd14
Merge branch 'master' into harmonic-sums-cache
giacomomagni Feb 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmarks/eko/benchmark_evol_to_unity.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from eko.io.runcards import OperatorCard, TheoryCard
from eko.runner.legacy import Runner

# from eko.matching_conditions.operator_matrix_element import OperatorMatrixElement
# from ekore.matching_conditions.operator_matrix_element import OperatorMatrixElement


def update_cards(theory: TheoryCard, operator: OperatorCard):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import numpy as np
import pytest

import eko.anomalous_dimensions.as2 as ad_as2
import eko.harmonics as h
import ekore.anomalous_dimensions.unpolarized.space_like.as2 as ad_as2
import ekore.harmonics as h
from eko.constants import CA, CF, TR


Expand Down
2 changes: 1 addition & 1 deletion benchmarks/performance/harmonics.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import numpy as np

from eko import anomalous_dimensions as ad
import ekore.anomalous_dimensions.unpolarized.space_like as ad
from eko.mellin import Path

NF = 5
Expand Down
4 changes: 2 additions & 2 deletions doc/source/overview/features.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Features
========

- perturbation orders: :mod:`LO <eko.anomalous_dimensions.lo>` + :mod:`NLO <eko.anomalous_dimensions.nlo>`
+ :mod:`NNLO <eko.anomalous_dimensions.nnlo>`
- perturbation orders: :mod:`LO <ekore.anomalous_dimensions.lo>` + :mod:`NLO <ekore.anomalous_dimensions.nlo>`
+ :mod:`NNLO <ekore.anomalous_dimensions.nnlo>`
- evolution in an (almost) arbitrary sequence of |FNS| (:class:`~eko.thresholds.ThresholdsAtlas`)
- :ref:`theory/pQCD:scale variations`
- different :doc:`solutions </theory/DGLAP>` of |DGLAP| differential equation
Expand Down
12 changes: 6 additions & 6 deletions doc/source/theory/Mellin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ the Mellin inverse.
S_m(N) = \sum\limits_{j=1}^N \frac 1 {j^m} = \frac{(-1)^{m-1}}{(m-1)!} \psi_{m-1}(N+1)+c_m \quad
\text{with},\quad c_m = \left\{\begin{array}{ll} \gamma_E, & m=1\\ \zeta(m), & m>1\end{array} \right.

where :math:`\psi_k(N)` is the :math:`k`-th polygamma function (implemented as :meth:`~eko.harmonics.polygamma.cern_polygamma`)
where :math:`\psi_k(N)` is the :math:`k`-th polygamma function (implemented as :meth:`~ekore.harmonics.polygamma.cern_polygamma`)
and :math:`\zeta` the Riemann zeta function (using :func:`scipy.special.zeta`).

- for the sums :math:`S_{-m}(N)` and m > 0 we use :cite:`Gluck:1989ze`:
Expand All @@ -149,7 +149,7 @@ the Mellin inverse.
which express higher weight sums in terms of simple one :math:`S_{m}, S_{-m}` and some irreducible integrals.
The above prescription on the analytical continuation of :math:`\eta` is applied.

The complete list of harmonics sums available in :mod:`eko.harmonics` is:
The complete list of harmonics sums available in :mod:`ekore.harmonics` is:

- weight 1:

Expand All @@ -166,20 +166,20 @@ The complete list of harmonics sums available in :mod:`eko.harmonics` is:
.. math::
S_{3}, S_{2,1}, S_{2,-1}, S_{-2,1}, S_{-2,-1}, S_{-3}

these sums relies on the integrals :mod:`eko.harmonics.g_functions` :cite:`MuselliPhD,Blumlein:1998if`
these sums relies on the integrals :mod:`ekore.harmonics.g_functions` :cite:`MuselliPhD,Blumlein:1998if`

- weight 4:

.. math ::
S_{4}, S_{3,1}, S_{2,1,1}, S_{-2,-2}, S_{-3, 1}, S_{-4}

these sums relies on the integrals :mod:`eko.harmonics.g_functions` :cite:`MuselliPhD,Blumlein:1998if`
these sums relies on the integrals :mod:`ekore.harmonics.g_functions` :cite:`MuselliPhD,Blumlein:1998if`

- weight 5:

.. math ::
S_{5}, S_{4,1}, S_{3,1,1}, S_{2,3}, S_{2,2,1}, S_{2,1,1,1}, S_{2,1,-2}, S_{2,-3}, S_{-2,3}, S_{-2,2,1}, S_{-2,1,1,1}, S_{-5}

these sums relies on the integrals :mod:`eko.harmonics.f_functions` :cite:`Blumlein:2009ta`
these sums relies on the integrals :mod:`ekore.harmonics.f_functions` :cite:`Blumlein:2009ta`

We have also implemented a recursive computation of simple harmonics (single index), see :func:`eko.harmonics.polygamma.recursive_harmonic_sum`
We have also implemented a recursive computation of simple harmonics (single index), see :func:`ekore.harmonics.polygamma.recursive_harmonic_sum`
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ python_functions = ['test_*', 'benchmark_*']
addopts = [
'--cov=eko',
'--cov=ekobox',
'--cov=ekore',
'--cov-report=html',
'--cov-report=xml',
'--strict-markers',
Expand Down
2 changes: 1 addition & 1 deletion src/eko/beta.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numba as nb

from . import constants
from .harmonics.constants import zeta3
from ekore.harmonics.constants import zeta3


@nb.njit(cache=True)
Expand Down
38 changes: 34 additions & 4 deletions src/eko/evolution_operator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@
import numpy as np
from scipy import integrate

from .. import anomalous_dimensions as ad
import ekore.anomalous_dimensions.polarized.space_like as ad_ps
import ekore.anomalous_dimensions.polarized.time_like as ad_pt
import ekore.anomalous_dimensions.unpolarized.space_like as ad_us
import ekore.anomalous_dimensions.unpolarized.time_like as ad_ut

from .. import basis_rotation as br
from .. import interpolation, mellin
from .. import scale_variations as sv
Expand Down Expand Up @@ -130,6 +134,8 @@ def quad_ker(
ev_op_max_order,
sv_mode,
is_threshold,
is_polarized,
is_time_like,
):
"""Raw evolution kernel inside quad.

Expand Down Expand Up @@ -168,7 +174,11 @@ def quad_ker(
sv_mode: int, `enum.IntEnum`
scale variation mode, see `eko.scale_variations.Modes`
is_threshold : boolean
is this an itermediate threshold operator?
is this an intermediate threshold operator?
is_polarized : boolean
is polarized evolution ?
is_time_like : boolean
is time-like evolution ?

Returns
-------
Expand All @@ -182,7 +192,16 @@ def quad_ker(

# compute the actual evolution kernel
if ker_base.is_singlet:
gamma_singlet = ad.gamma_singlet(order, ker_base.n, nf)
if is_polarized:
if is_time_like:
gamma_singlet = ad_pt.gamma_singlet(order, ker_base.n, nf)
else:
gamma_singlet = ad_ps.gamma_singlet(order, ker_base.n, nf)
else:
if is_time_like:
gamma_singlet = ad_ut.gamma_singlet(order, ker_base.n, nf)
else:
gamma_singlet = ad_us.gamma_singlet(order, ker_base.n, nf)
# scale var exponentiated is directly applied on gamma
if sv_mode == sv.Modes.exponentiated:
gamma_singlet = sv.exponentiated.gamma_variation(
Expand All @@ -205,7 +224,16 @@ def quad_ker(
) @ np.ascontiguousarray(ker)
ker = select_singlet_element(ker, mode0, mode1)
else:
gamma_ns = ad.gamma_ns(order, mode0, ker_base.n, nf)
if is_polarized:
if is_time_like:
gamma_ns = ad_pt.gamma_ns(order, mode0, ker_base.n, nf)
else:
gamma_ns = ad_ps.gamma_ns(order, mode0, ker_base.n, nf)
else:
if is_time_like:
gamma_ns = ad_ut.gamma_ns(order, mode0, ker_base.n, nf)
else:
gamma_ns = ad_us.gamma_ns(order, mode0, ker_base.n, nf)
if sv_mode == sv.Modes.exponentiated:
gamma_ns = sv.exponentiated.gamma_variation(gamma_ns, order, nf, L)
ker = ns.dispatcher(
Expand Down Expand Up @@ -382,6 +410,8 @@ def quad_ker(self, label, logx, areas):
ev_op_max_order=tuple(self.config["ev_op_max_order"]),
sv_mode=self.sv_mode,
is_threshold=self.is_threshold,
is_polarized=self.config["polarized"],
is_time_like=self.config["time_like"],
)

def initialize_op_members(self):
Expand Down
12 changes: 7 additions & 5 deletions src/eko/evolution_operator/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
import numpy as np
import numpy.typing as npt

from .. import matching_conditions, member
from .. import member
from .. import scale_variations as sv
from ..io.runcards import Configs, Debug
from ..matching_conditions.operator_matrix_element import OperatorMatrixElement
from ..thresholds import flavor_shift, is_downward_path
from . import Operator, flavors, physical
from . import Operator, flavors, matching_condition, physical
from .operator_matrix_element import OperatorMatrixElement

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -89,6 +89,8 @@ def __init__(
config["n_integration_cores"] = configs.n_integration_cores
config["debug_skip_singlet"] = debug.skip_singlet
config["debug_skip_non_singlet"] = debug.skip_non_singlet
config["polarized"] = configs.polarized
config["time_like"] = configs.time_like

if method not in [
"iterate-exact",
Expand Down Expand Up @@ -244,7 +246,7 @@ def generate(self, q2):

# join with the basis rotation, since matching requires c+ (or likewise)
if is_downward:
matching = matching_conditions.MatchingCondition.split_ad_to_evol_map(
matching = matching_condition.MatchingCondition.split_ad_to_evol_map(
self._matching_operators[op.q2_to],
op.nf - 1,
op.q2_to,
Expand All @@ -255,7 +257,7 @@ def generate(self, q2):
)
final_op = final_op @ matching @ invrot @ phys_op
else:
matching = matching_conditions.MatchingCondition.split_ad_to_evol_map(
matching = matching_condition.MatchingCondition.split_ad_to_evol_map(
self._matching_operators[op.q2_to],
op.nf,
op.q2_to,
Expand Down
Loading