Skip to content

Commit 7263cc0

Browse files
Update documentations
1 parent e0b16d0 commit 7263cc0

File tree

4 files changed

+76
-26
lines changed

4 files changed

+76
-26
lines changed

docs/cli-tutorials.md

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ neopdf read num_subgrids --pdf-name NNPDF40_nnlo_as_01180
6464
To get the knot values for a given subgrid:
6565

6666
```bash
67-
neopdf read subgrid_info --pdf-name NNPDF40_nnlo_as_01180 --member 0 --subgrid-index 1
67+
neopdf read subgrid-info --pdf-name NNPDF40_nnlo_as_01180 --member 0 --subgrid-index 1
6868
```
6969

7070
- `--pdf-name`: Name of the PDF set.
@@ -74,13 +74,18 @@ neopdf read subgrid_info --pdf-name NNPDF40_nnlo_as_01180 --member 0 --subgrid-i
7474
The above command will print out the following output:
7575

7676
```yaml
77-
Nucleon Numbers A: [1.0], shape=[1], strides=[1], layout=CFcf (0xf), const ndim=1
78-
Alphas values: [0.118], shape=[1], strides=[1], layout=CFcf (0xf), const ndim=1
77+
Nucleon Numbers A: [0.0], shape=[1], strides=[1], layout=CFcf (0xf), const ndim=1
78+
Alphas values: [0.0], shape=[1], strides=[1], layout=CFcf (0xf), const ndim=1
7979
kT values: [0.0], shape=[1], strides=[1], layout=CFcf (0xf), const ndim=1
8080
x values: [1e-9, 1.2970848e-9, ...], shape=[196], strides=[1], layout=CFcf (0xf), const ndim=1
8181
Q2 values: [2.7224999999999997, ...], shape=[12], strides=[1], layout=CFcf (0xf), const ndim=1
8282
```
8383
84+
!!! note
85+
86+
Note that the values of `A` and `alphas` are set to zero by default as there is no
87+
proper way to extract their values from LHAPDF.
88+
8489
### Updating Grid Metadata
8590

8691
The metadata of a given `NeoPDF` grid can be updated by running the following command:
@@ -242,3 +247,39 @@ neopdf compute xfx_q2 --pdf-name NNPDF40_nnlo.neopdf.lz4 --member 0 --pid 21 0.1
242247
```
243248

244249
This approach is not fullproof and some PDF sets might not be supported at all.
250+
251+
---
252+
253+
## Inspecting subgrid contents
254+
255+
The contents of the subgrids can be printed into human-readable format. Given that a set might contain
256+
multiple subgrids (as we have seen before using the `subgrid-info` command), it is instructive to check
257+
first how many subgrids a given set member contains.
258+
259+
```bash
260+
> neopdf read num_subgrids --pdf-name NNPDF40_nnlo_as_01180.neopdf.lz4
261+
262+
2
263+
```
264+
265+
We can look at the contents of the first subgrid for the **gluon** PDF:
266+
267+
```bash
268+
> neopdf read subgrid --pdf-name NNPDF40_nnlo_as_01180.neopdf.lz4 --member 0 --subgrid-index 0 --pid 21
269+
270+
[x | Q2] 2.72250e0 3.19494e0 3.77488e0 4.49175e0 5.38430e0 6.50400e0 7.91974e0
271+
1.00000e-9 1.48441e-1 -1.47266e0 -3.42816e0 -5.57841e0 -7.73893e0 -9.65268e0 -1.10375e1
272+
1.29708e-9 1.53954e-1 -1.36579e0 -3.16487e0 -5.10066e0 -6.98714e0 -8.57386e0 -9.57904e0
273+
1.68243e-9 1.59670e-1 -1.26122e0 -2.90961e0 -4.64076e0 -6.26809e0 -7.54804e0 -8.20073e0
274+
2.18225e-9 1.65601e-1 -1.15891e0 -2.66220e0 -4.19823e0 -5.58080e0 -6.57342e0 -6.89951e0
275+
2.83057e-9 1.71754e-1 -1.05882e0 -2.42248e0 -3.77263e0 -4.92430e0 -5.64825e0 -5.67242e0
276+
3.67149e-9 1.78142e-1 -9.60911e-1 -2.19028e0 -3.36352e0 -4.29764e0 -4.77083e0 -4.51658e0
277+
...
278+
[x | Q2] 9.72449e0 1.20449e1 1.50550e1 1.89961e1 2.42064e1
279+
1.00000e-9 -1.15252e1 -1.06011e1 -7.88260e0 -2.66303e0 5.44604e0
280+
1.29708e-9 -9.64489e0 -8.29955e0 -5.12278e0 5.21491e-1 8.89615e0
281+
1.68243e-9 -7.87939e0 -6.15103e0 -2.56742e0 3.44402e0 1.20386e1
282+
2.18225e-9 -6.22381e0 -4.14868e0 -2.06304e-1 6.11881e0 1.48905e1
283+
2.83057e-9 -4.67345e0 -2.28589e0 1.97036e0 8.55949e0 1.74680e1
284+
...
285+
```

docs/custom.css

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,10 @@ div.highlight pre,
9999
pre {
100100
font-size: 1.06em !important;
101101
}
102+
103+
.center-medium {
104+
display: block;
105+
margin: 0 auto;
106+
width: 75%;
107+
height: auto;
108+
}

docs/design-and-features.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ and future plans.
3232
</tr>
3333
<tr>
3434
<td style="border: 1px solid #888;">Fortran API</td>
35-
<td style="border: 1px solid #888;"></td>
36-
<td style="border: 1px solid #888;">Not yet implemented</td>
35+
<td style="border: 1px solid #888;"></td>
36+
<td style="border: 1px solid #888;">Fully supported</td>
3737
</tr>
3838
<tr>
3939
<td rowspan="7" style="text-align: center; vertical-align: middle; border: 1px solid #888;">Features</td>
@@ -242,22 +242,6 @@ into diverse computational workflows:
242242
This compatibility is crucial for the physics community, as it allows for immediate adoption
243243
without requiring extensive code rewrites or validation efforts.
244244

245-
### Thread and Memory Safety
246-
247-
`NeoPDF` leverages Rust's safety guarantees for robust multi-threaded applications:
248-
249-
- **Memory Safety**:
250-
Rust's ownership system prevents common memory errors (use-after-free, double-free, data races)
251-
that could lead to incorrect physics results or program crashes.
252-
253-
- **Thread Safety**:
254-
Built-in support for safe concurrent access to PDF objects, essential for parallel event
255-
generation and Monte Carlo simulations.
256-
257-
- **FFI Safety**:
258-
Careful design of the foreign function interface ensures that safety guarantees extend to Python,
259-
C, and C++ code, preventing crashes and undefined behavior.
260-
261245
### Extensible Interpolation
262246

263247
`NeoPDF`'s modular architecture enables easy extension and customization:
@@ -294,6 +278,22 @@ without requiring extensive code rewrites or validation efforts.
294278
Comprehensive benchmarking against LHAPDF ensures that performance improvements don't come at the
295279
cost of accuracy, maintaining the precision required for physics calculations.
296280

281+
### Thread and Memory Safety
282+
283+
`NeoPDF` leverages Rust's safety guarantees for robust multi-threaded applications:
284+
285+
- **Memory Safety**:
286+
Rust's ownership system prevents common memory errors (use-after-free, double-free, data races)
287+
that could lead to incorrect physics results or program crashes.
288+
289+
- **Thread Safety**:
290+
Built-in support for safe concurrent access to PDF objects, essential for parallel event
291+
generation and Monte Carlo simulations.
292+
293+
- **FFI Safety**:
294+
Careful design of the foreign function interface ensures that safety guarantees extend to Python,
295+
C, and C++ code, preventing crashes and undefined behavior.
296+
297297
## Architecture Overview
298298

299299
```mermaid
@@ -321,4 +321,5 @@ Lower-dimensional (bilinear, (log)-tricubic) are also available for performance
321321
The difference between NeoPDF and LHAPDF, using the default interpolation, is **below machine
322322
precision** for floating-point numbers.
323323

324-
![diff_NNPDF40_nnlo_as_01180_flav21](https://github.com/user-attachments/assets/d47bfa13-9930-4247-89fb-f2c2eab68bd7)
324+
![as_x](https://github.com/user-attachments/assets/90faf0ad-bbaf-4917-81e1-fb4edd351766)
325+
![as_q](https://github.com/user-attachments/assets/3cbeecfe-9e12-4900-99ad-dd92d8bcf299)

docs/design.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ respectively.
1818
built for each subgrid and flavor, supporting log-space and linear strategies for high accuracy.
1919

2020
Therefore, using the notations from [[2112.09703](https://arxiv.org/pdf/2112.09703)], the full
21-
`GridArray`, which is a conjunction of $k$ subgrids, can be represented as:
21+
`GridArray` (for 1D grid), which is a conjunction of $k$ subgrids, can be represented as:
2222

2323
$$ \left[ z_0, z_1, \cdots, z_{\mathrm{max}} \right]_{\left( n_1, n_2, \cdots, n_k \right)} \qquad \text{with} \qquad z=A, \alpha_s, k_T, x, Q^2 $$
2424

@@ -28,9 +28,10 @@ points is $n_{\mathrm{pts}} = \sum_i n_i - (k - i)$.
2828

2929
The diagram below schematically summarizes the `NeoPDF` data structure:
3030

31-
![data-structure](https://github.com/user-attachments/assets/dff9a9cd-ce24-485e-a08c-106f2845b437)
31+
![grid](https://github.com/user-attachments/assets/0637f61f-348f-4507-a6f5-08fac127368f){ .center-medium }
3232

33-
where the `GridArray` object represents an instance of a set member.
33+
where the `GridArray` object represents an instance of a set member. The subgrid $S_k$ is a
34+
**hyperrectangle** given by the **Cartesian** product of the dependent variables.
3435

3536
This design enables:
3637

@@ -64,7 +65,7 @@ by half the size of a given LHAPDF PDF set:
6465
| NNPDF4.0 NNLO | 100 | 158 MB | 85 MB |
6566
| NNPDF4.0 NNLO | 1000 | 1.55 GB | 830 MB |
6667
| Combined nNNPDF3.0 | 200 | - | 1.43 GB|
67-
| MAP22 FF @N3LL | 250 | 2.50 GB | 1.65 GB|
68+
| MAP22 FF @N3LL | 250 | 2.50 GB | 950 MB |
6869

6970
!!! info "Note"
7071

0 commit comments

Comments
 (0)