Skip to content

Commit

Permalink
Activate global KaTeX
Browse files Browse the repository at this point in the history
  • Loading branch information
felixhekhorn committed May 16, 2024
1 parent 7339be8 commit a5eb840
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 623 deletions.
3 changes: 3 additions & 0 deletions crates/eko/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name = "eko"
version = "0.1.0"
edition = "2021"

[package.metadata.docs.rs]
rustdoc-args = [ "--html-in-header", "../katex-header.html" ]

[lib]
name = "ekors"
crate-type = ["cdylib"]
Expand Down
3 changes: 3 additions & 0 deletions crates/ekore/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ edition = "2021"
description = "EKO expressions"
license = "GPL-3.0-or-later"

[package.metadata.docs.rs]
rustdoc-args = [ "--html-in-header", "../katex-header.html" ]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
Expand Down
19 changes: 19 additions & 0 deletions crates/katex-header.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" integrity="sha384-wcIxkf4k558AjM3Yz3BBFQUbk/zgIYC2R0QpeeYb+TwlBVMrlgLqwRjRtGZiK7ww" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" integrity="sha384-hIoBPJpTUs74ddyc4bFZSM1TVlQDA60VBbJS0oA934VSz82sBx1X7kSx2ATBDIyd" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js" integrity="sha384-43gviWU0YVjaDtb/GhzOouOXtZMP/7XUzwPTstBeZFe/+rCMvRwr4yROQP43s0Xk" crossorigin="anonymous"></script>
<script>
document.addEventListener("DOMContentLoaded", function() {
renderMathInElement(document.body, {
// customised options
// • auto-render specific keys, e.g.:
delimiters: [
{left: '$$', right: '$$', display: true},
{left: '$', right: '$', display: false},
{left: '\\(', right: '\\)', display: false},
{left: '\\[', right: '\\]', display: true}
],
// • rendering keys, e.g.:
throwOnError : false
});
});
</script>
7 changes: 4 additions & 3 deletions pyproject.toml.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/pyproject.toml b/pyproject.toml
index 31be6cb0..b4ec7c95 100644
index 7404d871..a1e3ae66 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,20 @@
Expand All @@ -25,12 +25,13 @@ index 31be6cb0..b4ec7c95 100644

[tool.poetry]
name = "eko"
@@ -124,6 +138,11 @@ asv-publish = "asv publish --config benchmarks/asv.conf.json"
@@ -124,6 +138,12 @@ asv-publish = "asv publish --config benchmarks/asv.conf.json"
asv-show = "asv show --config benchmarks/asv.conf.json"
asv-clean = { "shell" = "rm -rf benchmarks/env benchmarks/html benchmarks/results" }
asv = ["asv-run", "asv-publish", "asv-preview"]
+compile = "pip install -e crates/eko/"
+rdocs = "cargo doc --workspace --manifest-path crates/Cargo.toml --no-deps"
+rdocs.cmd = "cargo doc --workspace --manifest-path crates/Cargo.toml --no-deps"
+rdocs.env = { RUSTDOCFLAGS = "--html-in-header katex-header.html" }
+rdocs-view = "xdg-open crates/target/doc/ekors/index.html"
+rdocs-clean = "rm -rf crates/target/doc/"
+rtest = "cargo test --workspace --manifest-path crates/Cargo.toml"
Expand Down
6 changes: 5 additions & 1 deletion rustify.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/usr/bin/bash

# git diff --merge-base master pyproject.toml > pyproject.toml.patch
patch -p1 <pyproject.toml.patch

# git diff --merge-base master src/eko/evolution_operator/__init__.py > src/eko/evolution_operator/__init__.py.patch
patch -p1 <src/eko/evolution_operator/__init__.py.patch
patch -p1 <tests/eko/evolution_operator/test_init.py.patch

mv tests/eko/evolution_operator/test_init.py tests/eko/evolution_operator/deactivated_t_e_s_t_init.py
56 changes: 38 additions & 18 deletions src/eko/evolution_operator/__init__.py.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/src/eko/evolution_operator/__init__.py b/src/eko/evolution_operator/__init__.py
index 29e67c19..08e768e3 100644
index 1c759c5c..5eb394d0 100644
--- a/src/eko/evolution_operator/__init__.py
+++ b/src/eko/evolution_operator/__init__.py
@@ -3,15 +3,15 @@ r"""Contains the central operator classes.
Expand All @@ -20,9 +20,9 @@ index 29e67c19..08e768e3 100644

import ekore.anomalous_dimensions.polarized.space_like as ad_ps
import ekore.anomalous_dimensions.unpolarized.space_like as ad_us
@@ -28,92 +28,10 @@ from ..kernels import utils
@@ -27,92 +27,10 @@ from ..kernels import singlet_qed as qed_s
from ..kernels import valence_qed as qed_v
from ..matchings import Segment
from ..matchings import Segment, lepton_number
from ..member import OpMember
+from .quad_ker import cb_quad_ker_qcd

Expand Down Expand Up @@ -114,7 +114,7 @@ index 29e67c19..08e768e3 100644
spec = [
("is_singlet", nb.boolean),
("is_QEDsinglet", nb.boolean),
@@ -185,403 +103,6 @@ class QuadKerBase:
@@ -184,422 +102,6 @@ class QuadKerBase:
return self.path.prefactor * pj * self.path.jac


Expand Down Expand Up @@ -142,6 +142,7 @@ index 29e67c19..08e768e3 100644
- n3lo_ad_variation,
- is_polarized,
- is_time_like,
- use_fhmruvv,
-):
- """Raw evolution kernel inside quad.
-
Expand Down Expand Up @@ -188,11 +189,13 @@ index 29e67c19..08e768e3 100644
- is_threshold : boolean
- is this an intermediate threshold operator?
- n3lo_ad_variation : tuple
- |N3LO| anomalous dimension variation ``(gg_var, gq_var, qg_var, qq_var)``
- |N3LO| anomalous dimension variation ``(gg, gq, qg, qq, nsp, nsm, nsv)``
- is_polarized : boolean
- is polarized evolution ?
- is_time_like : boolean
- is time-like evolution ?
- use_fhmruvv : bool
- if True use the |FHMRUVV| |N3LO| anomalous dimension
-
- Returns
- -------
Expand Down Expand Up @@ -221,6 +224,7 @@ index 29e67c19..08e768e3 100644
- is_polarized,
- is_time_like,
- n3lo_ad_variation,
- use_fhmruvv,
- )
- else:
- ker = quad_ker_qed(
Expand All @@ -241,6 +245,7 @@ index 29e67c19..08e768e3 100644
- sv_mode,
- is_threshold,
- n3lo_ad_variation,
- use_fhmruvv,
- )
-
- # recombine everything
Expand All @@ -265,6 +270,7 @@ index 29e67c19..08e768e3 100644
- is_polarized,
- is_time_like,
- n3lo_ad_variation,
- use_fhmruvv,
-):
- """Raw evolution kernel inside quad.
-
Expand Down Expand Up @@ -297,7 +303,9 @@ index 29e67c19..08e768e3 100644
- is_threshold : boolean
- is this an itermediate threshold operator?
- n3lo_ad_variation : tuple
- |N3LO| anomalous dimension variation ``(gg_var, gq_var, qg_var, qq_var)``
- |N3LO| anomalous dimension variation ``(gg, gq, qg, qq, nsp, nsm, nsv)``
- use_fhmruvv : bool
- if True use the |FHMRUVV| |N3LO| anomalous dimensions
-
- Returns
- -------
Expand All @@ -316,7 +324,7 @@ index 29e67c19..08e768e3 100644
- gamma_singlet = ad_ut.gamma_singlet(order, ker_base.n, nf)
- else:
- gamma_singlet = ad_us.gamma_singlet(
- order, ker_base.n, nf, n3lo_ad_variation
- order, ker_base.n, nf, n3lo_ad_variation, use_fhmruvv
- )
- # scale var exponentiated is directly applied on gamma
- if sv_mode == sv.Modes.exponentiated:
Expand Down Expand Up @@ -349,7 +357,9 @@ index 29e67c19..08e768e3 100644
- 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)
- gamma_ns = ad_us.gamma_ns(
- order, mode0, ker_base.n, nf, n3lo_ad_variation, use_fhmruvv
- )
- if sv_mode == sv.Modes.exponentiated:
- gamma_ns = sv.exponentiated.gamma_variation(gamma_ns, order, nf, L)
- ker = ns.dispatcher(
Expand Down Expand Up @@ -385,6 +395,7 @@ index 29e67c19..08e768e3 100644
- sv_mode,
- is_threshold,
- n3lo_ad_variation,
- use_fhmruvv,
-):
- """Raw evolution kernel inside quad.
-
Expand Down Expand Up @@ -425,7 +436,9 @@ index 29e67c19..08e768e3 100644
- is_threshold : boolean
- is this an itermediate threshold operator?
- n3lo_ad_variation : tuple
- |N3LO| anomalous dimension variation ``(gg_var, gq_var, qg_var, qq_var)``
- |N3LO| anomalous dimension variation ``(gg, gq, qg, qq, nsp, nsm, nsv)``
- use_fhmruvv : bool
- if True use the |FHMRUVV| |N3LO| anomalous dimensions
-
- Returns
- -------
Expand All @@ -434,11 +447,13 @@ index 29e67c19..08e768e3 100644
- """
- # compute the actual evolution kernel for QEDxQCD
- if ker_base.is_QEDsinglet:
- gamma_s = ad_us.gamma_singlet_qed(order, ker_base.n, nf, n3lo_ad_variation)
- gamma_s = ad_us.gamma_singlet_qed(
- order, ker_base.n, nf, n3lo_ad_variation, use_fhmruvv
- )
- # scale var exponentiated is directly applied on gamma
- if sv_mode == sv.Modes.exponentiated:
- gamma_s = sv.exponentiated.gamma_variation_qed(
- gamma_s, order, nf, L, alphaem_running
- gamma_s, order, nf, lepton_number(mu2_to), L, alphaem_running
- )
- ker = qed_s.dispatcher(
- order,
Expand All @@ -462,11 +477,13 @@ index 29e67c19..08e768e3 100644
- ) @ np.ascontiguousarray(ker)
- ker = select_QEDsinglet_element(ker, mode0, mode1)
- elif ker_base.is_QEDvalence:
- gamma_v = ad_us.gamma_valence_qed(order, ker_base.n, nf)
- gamma_v = ad_us.gamma_valence_qed(
- order, ker_base.n, nf, n3lo_ad_variation, use_fhmruvv
- )
- # scale var exponentiated is directly applied on gamma
- if sv_mode == sv.Modes.exponentiated:
- gamma_v = sv.exponentiated.gamma_variation_qed(
- gamma_v, order, nf, L, alphaem_running
- gamma_v, order, nf, lepton_number(mu2_to), L, alphaem_running
- )
- ker = qed_v.dispatcher(
- order,
Expand All @@ -487,11 +504,13 @@ index 29e67c19..08e768e3 100644
- ) @ np.ascontiguousarray(ker)
- ker = select_QEDvalence_element(ker, mode0, mode1)
- else:
- gamma_ns = ad_us.gamma_ns_qed(order, mode0, ker_base.n, nf)
- gamma_ns = ad_us.gamma_ns_qed(
- order, mode0, ker_base.n, nf, n3lo_ad_variation, use_fhmruvv
- )
- # scale var exponentiated is directly applied on gamma
- if sv_mode == sv.Modes.exponentiated:
- gamma_ns = sv.exponentiated.gamma_variation_qed(
- gamma_ns, order, nf, L, alphaem_running
- gamma_ns, order, nf, lepton_number(mu2_to), L, alphaem_running
- )
- ker = qed_ns.dispatcher(
- order,
Expand All @@ -518,7 +537,7 @@ index 29e67c19..08e768e3 100644
class Operator(sv.ModeMixin):
"""Internal representation of a single EKO.

@@ -784,49 +305,6 @@ class Operator(sv.ModeMixin):
@@ -780,50 +282,6 @@ class Operator(sv.ModeMixin):
labels.extend(br.singlet_unified_labels)
return labels

Expand Down Expand Up @@ -563,12 +582,13 @@ index 29e67c19..08e768e3 100644
- n3lo_ad_variation=self.config["n3lo_ad_variation"],
- is_polarized=self.config["polarized"],
- is_time_like=self.config["time_like"],
- use_fhmruvv=self.config["use_fhmruvv"],
- )
-
def initialize_op_members(self):
"""Init all operators with the identity or zeros."""
eye = OpMember(
@@ -849,10 +327,7 @@ class Operator(sv.ModeMixin):
@@ -846,10 +304,7 @@ class Operator(sv.ModeMixin):
else:
self.op_members[n] = zero.copy()

Expand All @@ -580,7 +600,7 @@ index 29e67c19..08e768e3 100644
"""Run the integration for each grid point.

Parameters
@@ -867,18 +342,56 @@ class Operator(sv.ModeMixin):
@@ -864,18 +319,56 @@ class Operator(sv.ModeMixin):
"""
column = []
k, logx = log_grid
Expand Down
Loading

0 comments on commit a5eb840

Please sign in to comment.