interpn 0.6.3__tar.gz → 0.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. {interpn-0.6.3 → interpn-0.7.0}/.github/workflows/test-python.yml +17 -14
  2. {interpn-0.6.3 → interpn-0.7.0}/CHANGELOG.md +47 -0
  3. {interpn-0.6.3 → interpn-0.7.0}/Cargo.lock +34 -23
  4. {interpn-0.6.3 → interpn-0.7.0}/Cargo.toml +3 -3
  5. {interpn-0.6.3 → interpn-0.7.0}/PKG-INFO +10 -23
  6. {interpn-0.6.3 → interpn-0.7.0}/README.md +4 -3
  7. {interpn-0.6.3 → interpn-0.7.0}/benches/bench.rs +67 -36
  8. {interpn-0.6.3 → interpn-0.7.0}/benches/bench_cpu.py +56 -2
  9. {interpn-0.6.3 → interpn-0.7.0}/benches/bench_mem.py +12 -8
  10. {interpn-0.6.3 → interpn-0.7.0}/docs/1d_quality_of_fit_Rectilinear.svg +147 -147
  11. {interpn-0.6.3 → interpn-0.7.0}/docs/1d_quality_of_fit_Regular.svg +144 -144
  12. {interpn-0.6.3 → interpn-0.7.0}/docs/2d_quality_of_fit_Rectilinear.svg +247 -247
  13. {interpn-0.6.3 → interpn-0.7.0}/docs/2d_quality_of_fit_Regular.svg +244 -244
  14. {interpn-0.6.3 → interpn-0.7.0}/docs/3d_throughput_vs_nobs.svg +507 -401
  15. {interpn-0.6.3 → interpn-0.7.0}/docs/3d_throughput_vs_nobs_prealloc.svg +509 -403
  16. {interpn-0.6.3 → interpn-0.7.0}/docs/4d_throughput_vs_nobs.svg +513 -400
  17. {interpn-0.6.3 → interpn-0.7.0}/docs/4d_throughput_vs_nobs_prealloc.svg +522 -402
  18. interpn-0.7.0/docs/nearest_quality_of_fit.svg +6053 -0
  19. {interpn-0.6.3 → interpn-0.7.0}/docs/perf.md +6 -1
  20. interpn-0.7.0/docs/requirements.txt +1 -0
  21. {interpn-0.6.3 → interpn-0.7.0}/docs/throughput_vs_dims_1000_obs.svg +332 -230
  22. {interpn-0.6.3 → interpn-0.7.0}/docs/throughput_vs_dims_1_obs.svg +298 -210
  23. interpn-0.7.0/examples/nearest_comparison.py +120 -0
  24. {interpn-0.6.3 → interpn-0.7.0}/pyproject.toml +16 -6
  25. {interpn-0.6.3 → interpn-0.7.0}/scripts/distr_pgo_install.sh +2 -2
  26. {interpn-0.6.3 → interpn-0.7.0}/scripts/distr_pgo_profile.sh +1 -1
  27. {interpn-0.6.3 → interpn-0.7.0}/scripts/native_pgo_install.sh +1 -1
  28. interpn-0.7.0/scripts/pgo-profiles/pgo.profdata +0 -0
  29. {interpn-0.6.3 → interpn-0.7.0}/scripts/profile_workload.py +6 -0
  30. interpn-0.7.0/src/interpn/__init__.py +199 -0
  31. interpn-0.7.0/src/interpn/nearest_rectilinear.py +198 -0
  32. interpn-0.7.0/src/interpn/nearest_regular.py +213 -0
  33. {interpn-0.6.3 → interpn-0.7.0}/src/interpn/raw.py +8 -0
  34. interpn-0.7.0/src/interpn/raw.pyi +147 -0
  35. {interpn-0.6.3 → interpn-0.7.0}/src/interpn/serialization.py +2 -2
  36. {interpn-0.6.3 → interpn-0.7.0}/src/lib.rs +23 -0
  37. {interpn-0.6.3 → interpn-0.7.0}/src/multicubic/rectilinear.rs +2 -15
  38. {interpn-0.6.3 → interpn-0.7.0}/src/multicubic/regular.rs +2 -15
  39. {interpn-0.6.3 → interpn-0.7.0}/src/multilinear/rectilinear.rs +3 -16
  40. {interpn-0.6.3 → interpn-0.7.0}/src/multilinear/rectilinear_recursive.rs +1 -1
  41. {interpn-0.6.3 → interpn-0.7.0}/src/multilinear/regular.rs +3 -20
  42. {interpn-0.6.3 → interpn-0.7.0}/src/multilinear/regular_recursive.rs +1 -1
  43. interpn-0.7.0/src/nearest/mod.rs +8 -0
  44. interpn-0.7.0/src/nearest/rectilinear.rs +392 -0
  45. interpn-0.7.0/src/nearest/regular.rs +418 -0
  46. {interpn-0.6.3 → interpn-0.7.0}/src/python.rs +67 -1
  47. interpn-0.7.0/test/test_interpn.py +58 -0
  48. {interpn-0.6.3 → interpn-0.7.0}/test/test_multicubic_rectilinear.py +10 -0
  49. {interpn-0.6.3 → interpn-0.7.0}/test/test_multicubic_regular.py +11 -0
  50. {interpn-0.6.3 → interpn-0.7.0}/test/test_multilinear_rectilinear.py +11 -0
  51. {interpn-0.6.3 → interpn-0.7.0}/test/test_multilinear_regular.py +12 -0
  52. interpn-0.7.0/test/test_nearest_rectilinear.py +79 -0
  53. interpn-0.7.0/test/test_nearest_regular.py +90 -0
  54. {interpn-0.6.3 → interpn-0.7.0}/uv.lock +59 -536
  55. interpn-0.6.3/docs/requirements.txt +0 -1
  56. interpn-0.6.3/scripts/pgo-profiles/pgo.profdata +0 -0
  57. interpn-0.6.3/src/interpn/__init__.py +0 -25
  58. {interpn-0.6.3 → interpn-0.7.0}/.cargo/config.toml +0 -0
  59. {interpn-0.6.3 → interpn-0.7.0}/.github/workflows/release-python.yml +0 -0
  60. {interpn-0.6.3 → interpn-0.7.0}/.github/workflows/release-rust.yml +0 -0
  61. {interpn-0.6.3 → interpn-0.7.0}/.github/workflows/test-rust.yml +0 -0
  62. {interpn-0.6.3 → interpn-0.7.0}/.gitignore +0 -0
  63. {interpn-0.6.3 → interpn-0.7.0}/.readthedocs.yml +0 -0
  64. {interpn-0.6.3 → interpn-0.7.0}/LICENSE-APACHE +0 -0
  65. {interpn-0.6.3 → interpn-0.7.0}/LICENSE-MIT +0 -0
  66. {interpn-0.6.3 → interpn-0.7.0}/docs/API_Docs.md +0 -0
  67. {interpn-0.6.3 → interpn-0.7.0}/docs/index.md +0 -0
  68. {interpn-0.6.3 → interpn-0.7.0}/docs/ram_vs_dims.svg +0 -0
  69. {interpn-0.6.3 → interpn-0.7.0}/examples/cubic_comparison.py +0 -0
  70. {interpn-0.6.3 → interpn-0.7.0}/mkdocs.yml +0 -0
  71. {interpn-0.6.3 → interpn-0.7.0}/scripts/distr_pgo.sh +0 -0
  72. {interpn-0.6.3 → interpn-0.7.0}/scripts/native_pgo.sh +0 -0
  73. {interpn-0.6.3 → interpn-0.7.0}/scripts/native_pgo_profile.sh +0 -0
  74. {interpn-0.6.3 → interpn-0.7.0}/src/interpn/multicubic_rectilinear.py +0 -0
  75. {interpn-0.6.3 → interpn-0.7.0}/src/interpn/multicubic_regular.py +0 -0
  76. {interpn-0.6.3 → interpn-0.7.0}/src/interpn/multilinear_rectilinear.py +0 -0
  77. {interpn-0.6.3 → interpn-0.7.0}/src/interpn/multilinear_regular.py +0 -0
  78. {interpn-0.6.3 → interpn-0.7.0}/src/interpn/py.typed +0 -0
  79. {interpn-0.6.3 → interpn-0.7.0}/src/multicubic/mod.rs +0 -0
  80. {interpn-0.6.3 → interpn-0.7.0}/src/multicubic/rectilinear_recursive.rs +0 -0
  81. {interpn-0.6.3 → interpn-0.7.0}/src/multicubic/regular_recursive.rs +0 -0
  82. {interpn-0.6.3 → interpn-0.7.0}/src/multilinear/mod.rs +0 -0
  83. {interpn-0.6.3 → interpn-0.7.0}/src/one_dim/hold.rs +0 -0
  84. {interpn-0.6.3 → interpn-0.7.0}/src/one_dim/linear.rs +0 -0
  85. {interpn-0.6.3 → interpn-0.7.0}/src/one_dim/mod.rs +0 -0
  86. {interpn-0.6.3 → interpn-0.7.0}/src/testing.rs +0 -0
  87. {interpn-0.6.3 → interpn-0.7.0}/src/utils.rs +0 -0
  88. {interpn-0.6.3 → interpn-0.7.0}/test/test_docs.py +0 -0
  89. {interpn-0.6.3 → interpn-0.7.0}/test/test_examples.py +0 -0
@@ -12,33 +12,38 @@ jobs:
12
12
  matrix:
13
13
  target: [x86_64]
14
14
  python-version:
15
- - "3.9"
16
15
  - "3.10"
17
16
  - "3.11"
18
17
  - "3.12"
19
18
  - "3.13"
20
19
  - "3.14"
20
+ sync-args: [--locked]
21
+
22
+ include:
23
+ - target: x86_64
24
+ python-version: "3.10.0"
25
+ sync-args: --resolution=lowest-direct
26
+
21
27
  steps:
22
28
  - uses: actions/checkout@v3
23
29
  - name: Install uv
24
- uses: astral-sh/setup-uv@v5
30
+ uses: astral-sh/setup-uv@v7
25
31
  with:
26
32
  python-version: ${{ matrix.python-version }}
27
33
 
28
34
  - name: Install
29
- run: |
30
- uv venv
31
- uv pip install -e .[test,bench]
35
+ run: uv sync --extra pydantic --group test --group bench ${{ matrix.sync-args }}
32
36
 
33
37
  - name: Format
34
- run: uv run ruff check; uv run ruff format --check
38
+ run: |
39
+ uv run --no-sync ruff check
40
+ uv run --no-sync ruff format --check
35
41
 
36
42
  - name: Static typing
37
- run: uv run pyright ./src
43
+ run: uv run --no-sync pyright ./src
38
44
 
39
45
  - name: Test (without PGO)
40
- run: |
41
- uv run pytest .
46
+ run: uv run --no-sync pytest
42
47
 
43
48
  test_pgo:
44
49
  runs-on: ${{ matrix.platform.runner }}
@@ -50,18 +55,16 @@ jobs:
50
55
  - runner: ubuntu-24.04-arm # aarch64
51
56
  - runner: macos-15-intel # x86_64
52
57
  - runner: macos-14 # aarch64
53
- python-version: ["3.9"]
54
58
  steps:
55
59
  - uses: actions/checkout@v3
56
60
  - name: Install uv
57
- uses: astral-sh/setup-uv@v5
61
+ uses: astral-sh/setup-uv@v7
58
62
  with:
59
- python-version: ${{ matrix.python-version }}
63
+ python-version: "3.10"
60
64
 
61
65
  - name: Install
62
66
  run: |
63
- uv venv
64
- uv pip install .[test,bench]
67
+ uv sync --locked --no-editable --extra pydantic --group test --group bench
65
68
  rustup component add llvm-tools-preview
66
69
 
67
70
  - name: Profile-Guided Optimization (PGO)
@@ -1,5 +1,52 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.7.0 2025-10-25
4
+
5
+ Implement `interpn` convenience function that defers directly
6
+ to `raw` functions without serializable wrapper classes.
7
+
8
+ This enables use without pydantic for dep-constrained environments.
9
+
10
+ Contributions
11
+ * [Clément Robert](https://github.com/neutrinoceros)
12
+ * #40
13
+ * #41
14
+ * #42
15
+ * #44
16
+ * #45
17
+ * #46
18
+
19
+ ### Added
20
+
21
+ * Python
22
+ * Add type stubs for `raw` module
23
+ * Add `interpn` function that defers directly to `raw` functions without serializable wrapper classes
24
+
25
+ ### Changed
26
+
27
+ * Python
28
+ * !Move pydantic dep to `serde` optional group
29
+ * !Move optional dev dep groups to dependency groups (no longer installable via `.[dep]` syntax)
30
+ * !Import serializable wrapper classes into top level module only if pydantic is found
31
+ * !Drop support for python 3.9, which is leaving long-term support soon
32
+ * Update PGO profile data
33
+ * Rust
34
+ * Use abi3-py310 for python bindings
35
+
36
+ ## 0.6.4 2025-10-24
37
+
38
+ Implement N-dimensional nearest-neighbor interpolation on regular and rectilinear grids.
39
+
40
+ ### Added
41
+
42
+ * Rust
43
+ * Add `nearest` module with regular- and rectilinear- grid methods in up to 6 dimensions
44
+ * Reduce code duplication for fixed-dim array indexing
45
+ * Update pyo3 and numpy rust deps
46
+ * Python
47
+ * Add bindings, tests, benchmarks, and quality-of-fit plots for `NearestRegular` and `NearestRectilinear`
48
+ * Update PGO profile data to include new functions
49
+
3
50
  ## 0.6.3 2025-10-22
4
51
 
5
52
  Unpin max supported python version due to use of stable ABI3,
@@ -221,7 +221,7 @@ checksum = "b248f5224d1d606005e02c97f5aa4e88eeb230488bcc03bc9ca4d7991399f2b5"
221
221
 
222
222
  [[package]]
223
223
  name = "interpn"
224
- version = "0.6.2"
224
+ version = "0.7.0"
225
225
  dependencies = [
226
226
  "criterion",
227
227
  "crunchy",
@@ -355,9 +355,9 @@ dependencies = [
355
355
 
356
356
  [[package]]
357
357
  name = "numpy"
358
- version = "0.26.0"
358
+ version = "0.27.0"
359
359
  source = "registry+https://github.com/rust-lang/crates.io-index"
360
- checksum = "9b2dba356160b54f5371b550575b78130a54718b4c6e46b3f33a6da74a27e78b"
360
+ checksum = "0fa24ffc88cf9d43f7269d6b6a0d0a00010924a8cc90604a21ef9c433b66998d"
361
361
  dependencies = [
362
362
  "libc",
363
363
  "ndarray",
@@ -435,18 +435,18 @@ dependencies = [
435
435
 
436
436
  [[package]]
437
437
  name = "proc-macro2"
438
- version = "1.0.86"
438
+ version = "1.0.103"
439
439
  source = "registry+https://github.com/rust-lang/crates.io-index"
440
- checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77"
440
+ checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
441
441
  dependencies = [
442
442
  "unicode-ident",
443
443
  ]
444
444
 
445
445
  [[package]]
446
446
  name = "pyo3"
447
- version = "0.26.0"
447
+ version = "0.27.1"
448
448
  source = "registry+https://github.com/rust-lang/crates.io-index"
449
- checksum = "7ba0117f4212101ee6544044dae45abe1083d30ce7b29c4b5cbdfa2354e07383"
449
+ checksum = "37a6df7eab65fc7bee654a421404947e10a0f7085b6951bf2ea395f4659fb0cf"
450
450
  dependencies = [
451
451
  "indoc",
452
452
  "libc",
@@ -461,9 +461,9 @@ dependencies = [
461
461
 
462
462
  [[package]]
463
463
  name = "pyo3-build-config"
464
- version = "0.26.0"
464
+ version = "0.27.1"
465
465
  source = "registry+https://github.com/rust-lang/crates.io-index"
466
- checksum = "4fc6ddaf24947d12a9aa31ac65431fb1b851b8f4365426e182901eabfb87df5f"
466
+ checksum = "f77d387774f6f6eec64a004eac0ed525aab7fa1966d94b42f743797b3e395afb"
467
467
  dependencies = [
468
468
  "python3-dll-a",
469
469
  "target-lexicon",
@@ -471,9 +471,9 @@ dependencies = [
471
471
 
472
472
  [[package]]
473
473
  name = "pyo3-ffi"
474
- version = "0.26.0"
474
+ version = "0.27.1"
475
475
  source = "registry+https://github.com/rust-lang/crates.io-index"
476
- checksum = "025474d3928738efb38ac36d4744a74a400c901c7596199e20e45d98eb194105"
476
+ checksum = "2dd13844a4242793e02df3e2ec093f540d948299a6a77ea9ce7afd8623f542be"
477
477
  dependencies = [
478
478
  "libc",
479
479
  "pyo3-build-config",
@@ -481,9 +481,9 @@ dependencies = [
481
481
 
482
482
  [[package]]
483
483
  name = "pyo3-macros"
484
- version = "0.26.0"
484
+ version = "0.27.1"
485
485
  source = "registry+https://github.com/rust-lang/crates.io-index"
486
- checksum = "2e64eb489f22fe1c95911b77c44cc41e7c19f3082fc81cce90f657cdc42ffded"
486
+ checksum = "eaf8f9f1108270b90d3676b8679586385430e5c0bb78bb5f043f95499c821a71"
487
487
  dependencies = [
488
488
  "proc-macro2",
489
489
  "pyo3-macros-backend",
@@ -493,9 +493,9 @@ dependencies = [
493
493
 
494
494
  [[package]]
495
495
  name = "pyo3-macros-backend"
496
- version = "0.26.0"
496
+ version = "0.27.1"
497
497
  source = "registry+https://github.com/rust-lang/crates.io-index"
498
- checksum = "100246c0ecf400b475341b8455a9213344569af29a3c841d29270e53102e0fcf"
498
+ checksum = "70a3b2274450ba5288bc9b8c1b69ff569d1d61189d4bff38f8d22e03d17f932b"
499
499
  dependencies = [
500
500
  "heck",
501
501
  "proc-macro2",
@@ -641,18 +641,28 @@ dependencies = [
641
641
 
642
642
  [[package]]
643
643
  name = "serde"
644
- version = "1.0.210"
644
+ version = "1.0.228"
645
+ source = "registry+https://github.com/rust-lang/crates.io-index"
646
+ checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
647
+ dependencies = [
648
+ "serde_core",
649
+ "serde_derive",
650
+ ]
651
+
652
+ [[package]]
653
+ name = "serde_core"
654
+ version = "1.0.228"
645
655
  source = "registry+https://github.com/rust-lang/crates.io-index"
646
- checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a"
656
+ checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
647
657
  dependencies = [
648
658
  "serde_derive",
649
659
  ]
650
660
 
651
661
  [[package]]
652
662
  name = "serde_derive"
653
- version = "1.0.210"
663
+ version = "1.0.228"
654
664
  source = "registry+https://github.com/rust-lang/crates.io-index"
655
- checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f"
665
+ checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
656
666
  dependencies = [
657
667
  "proc-macro2",
658
668
  "quote",
@@ -661,14 +671,15 @@ dependencies = [
661
671
 
662
672
  [[package]]
663
673
  name = "serde_json"
664
- version = "1.0.143"
674
+ version = "1.0.145"
665
675
  source = "registry+https://github.com/rust-lang/crates.io-index"
666
- checksum = "d401abef1d108fbd9cbaebc3e46611f4b1021f714a0597a71f41ee463f5f4a5a"
676
+ checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c"
667
677
  dependencies = [
668
678
  "itoa",
669
679
  "memchr",
670
680
  "ryu",
671
681
  "serde",
682
+ "serde_core",
672
683
  ]
673
684
 
674
685
  [[package]]
@@ -679,9 +690,9 @@ checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
679
690
 
680
691
  [[package]]
681
692
  name = "syn"
682
- version = "2.0.75"
693
+ version = "2.0.108"
683
694
  source = "registry+https://github.com/rust-lang/crates.io-index"
684
- checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9"
695
+ checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917"
685
696
  dependencies = [
686
697
  "proc-macro2",
687
698
  "quote",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "interpn"
3
- version = "0.6.2"
3
+ version = "0.7.0"
4
4
  edition = "2024"
5
5
  authors = ["James Logan <jlogan03@gmail.com>"]
6
6
  license = "MIT OR Apache-2.0"
@@ -20,8 +20,8 @@ num-traits = { version = "0.2.19", default-features = false, features = ["libm"]
20
20
  crunchy = { version = "0.2.4", default-features = false, features = ["limit_256"] }
21
21
 
22
22
  # Python bindings
23
- pyo3 = { version = "0.26.0", features = ["extension-module", "abi3-py39", "generate-import-lib"], optional = true }
24
- numpy = { version = "0.26.0", optional = true }
23
+ pyo3 = { version = "0.27.1", features = ["extension-module", "abi3-py310", "generate-import-lib"], optional = true }
24
+ numpy = { version = "0.27.0", optional = true }
25
25
 
26
26
  # Test-only utils
27
27
  itertools = { version = "0.14.0", optional = true }
@@ -1,37 +1,23 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: interpn
3
- Version: 0.6.3
3
+ Version: 0.7.0
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
7
- Requires-Dist: numpy>=2
8
- Requires-Dist: pydantic>=2.12
9
- Requires-Dist: pytest>=8.4.2 ; extra == 'test'
10
- Requires-Dist: pytest-cov>=7.0.0 ; extra == 'test'
11
- Requires-Dist: ruff>=0.13.3 ; extra == 'test'
12
- Requires-Dist: pyright==1.1.337 ; extra == 'test'
13
- Requires-Dist: mktestdocs>=0.2.1 ; extra == 'test'
14
- Requires-Dist: scipy>=1.11.4 ; extra == 'test'
15
- Requires-Dist: matplotlib>=3.8 ; extra == 'test'
16
- Requires-Dist: scipy>=1.11.4 ; extra == 'bench'
17
- Requires-Dist: matplotlib>=3.8 ; extra == 'bench'
18
- Requires-Dist: memory-profiler>=0.61.0 ; extra == 'bench'
19
- Requires-Dist: mkdocs>=1.5.3 ; extra == 'doc'
20
- Requires-Dist: mkdocstrings-python>=1.7.5 ; extra == 'doc'
21
- Requires-Dist: mkdocs-material>=9.4.10 ; extra == 'doc'
22
- Provides-Extra: test
23
- Provides-Extra: bench
24
- Provides-Extra: doc
7
+ Requires-Dist: numpy>=1.21.2
8
+ Requires-Dist: pydantic>=2.2.0 ; extra == 'pydantic'
9
+ Provides-Extra: pydantic
25
10
  License-File: LICENSE-MIT
26
11
  License-File: LICENSE-APACHE
27
12
  Summary: N-dimensional interpolation/extrapolation methods
28
13
  Home-Page: https://github.com/jlogan03/interpn/
29
14
  Author-email: James Logan <jlogan03@gmail.com>
30
15
  License-Expression: MIT OR Apache-2.0
31
- Requires-Python: >=3.9
16
+ Requires-Python: >=3.10
32
17
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
33
18
  Project-URL: repository, https://github.com/jlogan03/interpn
34
19
  Project-URL: documentation, https://interpn.readthedocs.io/
20
+ Project-URL: changelog, https://github.com/jlogan03/interpn/blob/main/CHANGELOG.md
35
21
 
36
22
  # InterpN
37
23
 
@@ -53,6 +39,7 @@ effective when examining small numbers of observation points. See the
53
39
 
54
40
  | Feature →<br>↓ Interpolant Method | Regular<br>Grid | Rectilinear<br>Grid | Json<br>Serialization |
55
41
  |-----------------------------------|-----------------|---------------------|-----------------------|
42
+ | Nearest-Neighbor | ✅ | ✅ | ✅ |
56
43
  | Linear | ✅ | ✅ | ✅ |
57
44
  | Cubic | ✅ | ✅ | ✅ |
58
45
 
@@ -77,9 +64,9 @@ pip install interpn
77
64
 
78
65
  ## Profile-Guided Optimization
79
66
 
80
- To build the extension with profile-guided optimization using pre-built profiles, do `sh ./scripts/pgo_install.sh`.
81
- You can also generate your own PGO profiles like `sh ./scripts/pgo_profile.sh`.
82
- after installing these extra compiler dependencies:
67
+ To build the extension with profile-guided optimization using pre-built profiles, do `sh ./scripts/distr_pgo_install.sh`.
68
+ You can also generate your own PGO profiles like `sh ./scripts/distr_pgo_profile.sh`.
69
+ after installing this extra compiler dependency:
83
70
 
84
71
  ```bash
85
72
  rustup component add llvm-tools-preview
@@ -18,6 +18,7 @@ effective when examining small numbers of observation points. See the
18
18
 
19
19
  | Feature →<br>↓ Interpolant Method | Regular<br>Grid | Rectilinear<br>Grid | Json<br>Serialization |
20
20
  |-----------------------------------|-----------------|---------------------|-----------------------|
21
+ | Nearest-Neighbor | ✅ | ✅ | ✅ |
21
22
  | Linear | ✅ | ✅ | ✅ |
22
23
  | Cubic | ✅ | ✅ | ✅ |
23
24
 
@@ -42,9 +43,9 @@ pip install interpn
42
43
 
43
44
  ## Profile-Guided Optimization
44
45
 
45
- To build the extension with profile-guided optimization using pre-built profiles, do `sh ./scripts/pgo_install.sh`.
46
- You can also generate your own PGO profiles like `sh ./scripts/pgo_profile.sh`.
47
- after installing these extra compiler dependencies:
46
+ To build the extension with profile-guided optimization using pre-built profiles, do `sh ./scripts/distr_pgo_install.sh`.
47
+ You can also generate your own PGO profiles like `sh ./scripts/distr_pgo_profile.sh`.
48
+ after installing this extra compiler dependency:
48
49
 
49
50
  ```bash
50
51
  rustup component add llvm-tools-preview
@@ -3,8 +3,8 @@
3
3
  use criterion::*;
4
4
  use gridgen::*;
5
5
  use interpn::{
6
- Linear1D, LinearHoldLast1D, MultilinearRegular, RectilinearGrid1D, RegularGrid1D, multicubic,
7
- multilinear,
6
+ Linear1D, LinearHoldLast1D, MultilinearRegular, NearestRectilinear, NearestRegular,
7
+ RectilinearGrid1D, RegularGrid1D, multicubic, multilinear, nearest,
8
8
  one_dim::{
9
9
  Interp1D,
10
10
  hold::{Left1D, Nearest1D},
@@ -135,6 +135,70 @@ macro_rules! bench_interp_specific {
135
135
  },
136
136
  );
137
137
 
138
+ $group.bench_with_input(
139
+ BenchmarkId::new(
140
+ format!(
141
+ "Nearest Regular {}x{}D, {}",
142
+ $gridsize, $ndims, scan_or_shuffle
143
+ ),
144
+ $size,
145
+ ),
146
+ $size,
147
+ |b, &size| {
148
+ let (grids, z) = gen_grid($ndims, $gridsize, 0.0);
149
+ let m: usize = ((size as f64).powf(1.0 / ($ndims as f64)) + 2.0) as usize;
150
+ let gridobs_t = match $kind {
151
+ Kind::Interp => gen_interp_obs_grid(&grids, m, true),
152
+ Kind::Extrap => gen_extrap_obs_grid(&grids, m, true),
153
+ };
154
+ let obs: Vec<&[f64]> = gridobs_t.iter().map(|x| &x[..size]).collect();
155
+ let mut out = vec![0.0; size];
156
+
157
+ let dims = [$gridsize; $ndims];
158
+ let mut starts = [0.0; $ndims];
159
+ let mut steps = [0.0; $ndims];
160
+ (0..$ndims).for_each(|i| starts[i] = grids[i][0]);
161
+ (0..$ndims).for_each(|i| steps[i] = grids[i][1] - grids[i][0]);
162
+
163
+ b.iter(|| {
164
+ black_box({
165
+ nearest::regular::interpn(&dims, &starts, &steps, &z, &obs[..], &mut out)
166
+ .unwrap()
167
+ })
168
+ });
169
+ },
170
+ );
171
+
172
+ $group.bench_with_input(
173
+ BenchmarkId::new(
174
+ format!(
175
+ "Nearest Rectilinear {}x{}D, {}",
176
+ $gridsize, $ndims, scan_or_shuffle
177
+ ),
178
+ $size,
179
+ ),
180
+ $size,
181
+ |b, &size| {
182
+ let (grids, z) = gen_grid($ndims, $gridsize, 1e-3);
183
+
184
+ let m: usize = ((size as f64).powf(1.0 / ($ndims as f64)) + 2.0) as usize;
185
+ let gridobs_t = match $kind {
186
+ Kind::Interp => gen_interp_obs_grid(&grids, m, true),
187
+ Kind::Extrap => gen_extrap_obs_grid(&grids, m, true),
188
+ };
189
+ let obs: Vec<&[f64]> = gridobs_t.iter().map(|x| &x[..size]).collect();
190
+ let mut out = vec![0.0; size];
191
+
192
+ let gridslice: Vec<&[f64]> = grids.iter().map(|x| &x[..]).collect();
193
+
194
+ b.iter(|| {
195
+ black_box(
196
+ nearest::rectilinear::interpn(&gridslice, &z, &obs, &mut out).unwrap(),
197
+ )
198
+ });
199
+ },
200
+ );
201
+
138
202
  $group.bench_with_input(
139
203
  BenchmarkId::new(
140
204
  format!(
@@ -426,41 +490,8 @@ fn bench_interp(c: &mut Criterion) {
426
490
  }
427
491
  }
428
492
 
429
- fn bench_extrap(c: &mut Criterion) {
430
- //
431
- // Shuffled (un-ordered observation points)
432
- //
433
- for gridsize in [10] {
434
- let mut group = c.benchmark_group(format!("Extrap_1D_Shuffled_{gridsize}-grid"));
435
- for size in [1, 100, 1_000_000].iter() {
436
- group.throughput(Throughput::Elements(*size as u64));
437
- bench_interp_specific!(group, 1, gridsize, size, Kind::Extrap);
438
- }
439
- group.finish();
440
- }
441
-
442
- for gridsize in [10] {
443
- let mut group = c.benchmark_group(format!("Extrap_2D_Shuffled_{gridsize}-grid"));
444
- for size in [1, 100, 1_000_000].iter() {
445
- group.throughput(Throughput::Elements(*size as u64));
446
- bench_interp_specific!(group, 2, gridsize, size, Kind::Extrap);
447
- }
448
- group.finish();
449
- }
450
-
451
- for gridsize in [10] {
452
- let mut group = c.benchmark_group(format!("Extrap_3D_Shuffled_{gridsize}-grid"));
453
- for size in [1, 100, 1_000_000].iter() {
454
- group.throughput(Throughput::Elements(*size as u64));
455
- bench_interp_specific!(group, 3, gridsize, size, Kind::Extrap);
456
- }
457
- group.finish();
458
- }
459
- }
460
-
461
493
  criterion_group!(benches_interp, bench_interp);
462
- criterion_group!(benches_extrap, bench_extrap);
463
- criterion_main!(benches_interp, benches_extrap,);
494
+ criterion_main!(benches_interp);
464
495
 
465
496
  mod randn {
466
497
  use rand::Rng;