kernelforge 0.0.0__cp313-cp313-macosx_15_0_arm64.whl

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.
Binary file
@@ -0,0 +1,8 @@
1
+ """KernelForge - Optimized kernels for machine learning."""
2
+
3
+ try:
4
+ from importlib.metadata import version
5
+
6
+ __version__ = version("kernelforge")
7
+ except Exception:
8
+ __version__ = "unknown"
kernelforge/cli.py ADDED
@@ -0,0 +1,415 @@
1
+ import argparse
2
+ import sys
3
+ import tempfile
4
+ import time
5
+ import urllib.request
6
+ import zipfile
7
+ from importlib.metadata import version
8
+ from pathlib import Path
9
+
10
+ import numpy as np
11
+
12
+ from kernelforge._fchl19 import (
13
+ fgdml_kernel,
14
+ fgdml_kernel_symm,
15
+ flocal_kernel,
16
+ flocal_kernel_symm,
17
+ generate_fchl_acsf,
18
+ generate_fchl_acsf_and_gradients,
19
+ )
20
+
21
+ PROGRAM_NAME = "KernelForge Benchmarks"
22
+
23
+ # Data cache directory for downloaded datasets
24
+ CACHE_DIR = Path.home() / ".kernelforge" / "datasets"
25
+ CACHE_DIR.mkdir(parents=True, exist_ok=True)
26
+
27
+
28
+ def load_ethanol_raw_data() -> np.ndarray:
29
+ """Load raw ethanol data from sgdml.org. Auto-downloads if needed."""
30
+ npz_path = CACHE_DIR / "ethanol_ccsd_t-train.npz"
31
+
32
+ if not npz_path.exists():
33
+ url = "https://sgdml.org/secure_proxy.php?file=data/npz/ethanol_ccsd_t.zip"
34
+ print(" [Downloading ethanol dataset...]")
35
+
36
+ try:
37
+ with tempfile.TemporaryDirectory() as tmpdir:
38
+ zip_path = Path(tmpdir) / "ethanol.zip"
39
+ req = urllib.request.Request(url)
40
+ with urllib.request.urlopen(req) as response:
41
+ if response.status != 200:
42
+ raise RuntimeError(f"HTTP {response.status}: Failed to download from {url}")
43
+ with open(zip_path, "wb") as f:
44
+ f.write(response.read())
45
+
46
+ with zipfile.ZipFile(zip_path) as z:
47
+ z.extractall(tmpdir)
48
+ extracted = list(Path(tmpdir).glob("*.npz"))[0]
49
+ extracted.rename(npz_path)
50
+ except Exception as e:
51
+ print(f" [Error downloading ethanol: {e}]", file=sys.stderr)
52
+ raise
53
+
54
+ return np.load(npz_path, allow_pickle=True)
55
+
56
+
57
+ def load_qm7b_raw_data() -> np.ndarray:
58
+ """Load raw QM7b data from GitHub release. Auto-downloads if needed."""
59
+ npz_path = CACHE_DIR / "qm7b_complete.npz"
60
+
61
+ if not npz_path.exists():
62
+ url = "https://github.com/andersx/kernelforge/releases/download/dataset-qm7b-v1.0/qm7b_complete.npz"
63
+ print(" [Downloading QM7b dataset...]")
64
+
65
+ try:
66
+ req = urllib.request.Request(url)
67
+ with urllib.request.urlopen(req) as response:
68
+ if response.status != 200:
69
+ raise RuntimeError(f"HTTP {response.status}: Failed to download from {url}")
70
+ with open(npz_path, "wb") as f:
71
+ f.write(response.read())
72
+ except Exception as e:
73
+ print(f" [Error downloading QM7b: {e}]", file=sys.stderr)
74
+ raise
75
+
76
+ return np.load(npz_path, allow_pickle=True)
77
+
78
+
79
+ def prepare_ethanol_fchl19(n_structures: int = 100) -> dict:
80
+ """Prepare FCHL19 representations and gradients for ethanol."""
81
+ data = load_ethanol_raw_data()
82
+ R = data["R"][:n_structures]
83
+ z = data["z"]
84
+ elements = [1, 6, 8]
85
+
86
+ X = []
87
+ dX = []
88
+ for r in R:
89
+ rep, grad = generate_fchl_acsf_and_gradients(r, z, elements=elements)
90
+ X.append(rep)
91
+ dX.append(grad)
92
+
93
+ X = np.asarray(X)
94
+ dX = np.asarray(dX)
95
+ N = np.asarray([len(z) for _ in range(n_structures)], dtype=np.int32)
96
+ Q = np.asarray([z for _ in range(n_structures)], dtype=np.int32)
97
+
98
+ return {"X": X, "dX": dX, "N": N, "Q": Q, "z": z}
99
+
100
+
101
+ def prepare_qm7b_fchl19(n_structures: int = 100) -> dict:
102
+ """Prepare FCHL19 representations for QM7b."""
103
+ data = load_qm7b_raw_data()
104
+ R = data["R"][:n_structures]
105
+ z_list = data["z"][:n_structures]
106
+ elements = [1, 6, 7, 8, 16, 17]
107
+
108
+ X_list = []
109
+ N = []
110
+ Q_list = []
111
+ for i, r in enumerate(R):
112
+ rep = generate_fchl_acsf(r, z_list[i], elements=elements)
113
+ X_list.append(rep)
114
+ N.append(len(rep))
115
+ Q_list.append(z_list[i])
116
+
117
+ N = np.asarray(N, dtype=np.int32)
118
+ max_atoms = max(N)
119
+ rep_dim = X_list[0].shape[1]
120
+
121
+ # Pad to max_atoms
122
+ X = np.zeros((len(X_list), max_atoms, rep_dim), dtype=np.float64)
123
+ Q = np.zeros((len(Q_list), max_atoms), dtype=np.int32)
124
+
125
+ for i, (x_i, q_i) in enumerate(zip(X_list, Q_list)):
126
+ n_atoms = len(x_i)
127
+ X[i, :n_atoms, :] = x_i
128
+ Q[i, :n_atoms] = q_i
129
+
130
+ return {"X": X, "N": N, "Q": Q}
131
+
132
+
133
+ def benchmark_ethanol_fchl19_representations() -> tuple[float, str]:
134
+ """Benchmark FCHL19 representation generation on ethanol (N=1000)."""
135
+ data = load_ethanol_raw_data()
136
+ n = 10000
137
+ R = data["R"][:n]
138
+ z = data["z"]
139
+ elements = [1, 6, 8]
140
+
141
+ start = time.perf_counter()
142
+ for r in R:
143
+ _ = generate_fchl_acsf(r, z, elements=elements)
144
+ elapsed = (time.perf_counter() - start) * 1000
145
+
146
+ return elapsed, f"Ethanol FCHL19 representations (N={n})"
147
+
148
+
149
+ def benchmark_ethanol_fchl19_gradients() -> tuple[float, str]:
150
+ """Benchmark FCHL19 gradient computation on ethanol (N=1000)."""
151
+ data = load_ethanol_raw_data()
152
+ n = 10000
153
+ R = data["R"][:n]
154
+ z = data["z"]
155
+ elements = [1, 6, 8]
156
+
157
+ start = time.perf_counter()
158
+ for r in R:
159
+ _, _ = generate_fchl_acsf_and_gradients(r, z, elements=elements)
160
+ elapsed = (time.perf_counter() - start) * 1000
161
+
162
+ return elapsed, f"Ethanol FCHL19 gradients (N={n})"
163
+
164
+
165
+ def benchmark_qm7b_fchl19_representations() -> tuple[float, str]:
166
+ """Benchmark FCHL19 representation generation on QM7b (N=7211)."""
167
+ data = load_qm7b_raw_data()
168
+ R = data["R"]
169
+ z_list = data["z"]
170
+ elements = [1, 6, 7, 8, 16, 17]
171
+
172
+ start = time.perf_counter()
173
+ for i, r in enumerate(R):
174
+ _ = generate_fchl_acsf(r, z_list[i], elements=elements)
175
+ elapsed = (time.perf_counter() - start) * 1000
176
+
177
+ return elapsed, f"QM7b FCHL19 representations (N={len(R)})"
178
+
179
+
180
+ def benchmark_qm7b_fchl19_gradients() -> tuple[float, str]:
181
+ """Benchmark FCHL19 gradient computation on QM7b (N=7211)."""
182
+ data = load_qm7b_raw_data()
183
+ R = data["R"]
184
+ z_list = data["z"]
185
+ elements = [1, 6, 7, 8, 16, 17]
186
+
187
+ start = time.perf_counter()
188
+ for r, z in zip(R, z_list):
189
+ _, _ = generate_fchl_acsf_and_gradients(r, z, elements=elements)
190
+ elapsed = (time.perf_counter() - start) * 1000
191
+
192
+ return elapsed, "QM7b FCHL19 gradients (N=7211)"
193
+
194
+
195
+ def benchmark_kernel_symm_ethanol() -> tuple[float, str]:
196
+ """Benchmark symmetric local kernel on ethanol (N=100)."""
197
+ data = prepare_ethanol_fchl19(100)
198
+ X = data["X"][:100]
199
+ Q = data["Q"][:100]
200
+ N = data["N"][:100]
201
+ sigma = 2.0
202
+
203
+ start = time.perf_counter()
204
+ K = flocal_kernel_symm(X, Q, N, sigma)
205
+ elapsed = (time.perf_counter() - start) * 1000
206
+
207
+ return elapsed, "Local kernel symmetric (Ethanol, N=100)"
208
+
209
+
210
+ def benchmark_kernel_asymm_ethanol() -> tuple[float, str]:
211
+ """Benchmark asymmetric local kernel on ethanol (N=20, train-test split)."""
212
+ data = prepare_ethanol_fchl19(20)
213
+ X = data["X"][:20]
214
+ Q = data["Q"][:20]
215
+ N = data["N"][:20]
216
+ sigma = 2.0
217
+
218
+ n_train = 16
219
+ X_train, X_test = X[:n_train], X[n_train:]
220
+ Q_train, Q_test = Q[:n_train], Q[n_train:]
221
+ N_train, N_test = N[:n_train], N[n_train:]
222
+
223
+ start = time.perf_counter()
224
+ K = flocal_kernel(X_train, X_test, Q_train, Q_test, N_train, N_test, sigma)
225
+ elapsed = (time.perf_counter() - start) * 1000
226
+
227
+ return elapsed, "Local kernel asymmetric (Ethanol, N=20)"
228
+
229
+
230
+ def benchmark_kernel_symm_qm7b() -> tuple[float, str]:
231
+ """Benchmark symmetric local kernel on QM7b (N=100)."""
232
+ data = prepare_qm7b_fchl19(100)
233
+ X = data["X"][:100]
234
+ Q = data["Q"][:100]
235
+ N = data["N"][:100]
236
+ sigma = 2.0
237
+
238
+ start = time.perf_counter()
239
+ K = flocal_kernel_symm(X, Q, N, sigma)
240
+ elapsed = (time.perf_counter() - start) * 1000
241
+
242
+ return elapsed, "Local kernel symmetric (QM7b, N=100)"
243
+
244
+
245
+ def benchmark_kernel_asymm_qm7b() -> tuple[float, str]:
246
+ """Benchmark asymmetric local kernel on QM7b (N=100, train-test split)."""
247
+ data = prepare_qm7b_fchl19(100)
248
+ X = data["X"][:100]
249
+ Q = data["Q"][:100]
250
+ N = data["N"][:100]
251
+ sigma = 2.0
252
+
253
+ n_train = 80
254
+ X_train, X_test = X[:n_train], X[n_train:]
255
+ Q_train, Q_test = Q[:n_train], Q[n_train:]
256
+ N_train, N_test = N[:n_train], N[n_train:]
257
+
258
+ start = time.perf_counter()
259
+ K = flocal_kernel(X_train, X_test, Q_train, Q_test, N_train, N_test, sigma)
260
+ elapsed = (time.perf_counter() - start) * 1000
261
+
262
+ return elapsed, "Local kernel asymmetric (QM7b, N=100)"
263
+
264
+
265
+ def benchmark_kernel_gdml_ethanol() -> tuple[float, str]:
266
+ """Benchmark symmetric GDML kernel on ethanol (N=100)."""
267
+ n = 200
268
+ data = prepare_ethanol_fchl19(n)
269
+ X = data["X"][:n]
270
+ dX = data["dX"][:n]
271
+ Q = data["Q"][:n]
272
+ N = data["N"][:n]
273
+ sigma = 2.5
274
+
275
+ start = time.perf_counter()
276
+ K = fgdml_kernel(X, X, dX, dX, Q, Q, N, N, sigma)
277
+ elapsed = (time.perf_counter() - start) * 1000
278
+
279
+ return elapsed, "GDML kernel symmetric (Ethanol, N=n)"
280
+
281
+
282
+ def benchmark_kernel_gdml_symm_ethanol() -> tuple[float, str]:
283
+ """Benchmark symmetric GDML kernel on ethanol (N=100)."""
284
+ n = 200
285
+ data = prepare_ethanol_fchl19(n)
286
+ X = data["X"][:n]
287
+ dX = data["dX"][:n]
288
+ Q = data["Q"][:n]
289
+ N = data["N"][:n]
290
+ sigma = 2.5
291
+
292
+ start = time.perf_counter()
293
+ K = fgdml_kernel_symm(X, dX, Q, N, sigma)
294
+ elapsed = (time.perf_counter() - start) * 1000
295
+
296
+ return elapsed, "GDML kernel symmetric (Ethanol, N=n)"
297
+
298
+
299
+ BENCHMARKS = {
300
+ "ethanol_fchl19_repr": benchmark_ethanol_fchl19_representations,
301
+ "ethanol_fchl19_grad": benchmark_ethanol_fchl19_gradients,
302
+ "qm7b_fchl19_repr": benchmark_qm7b_fchl19_representations,
303
+ "qm7b_fchl19_grad": benchmark_qm7b_fchl19_gradients,
304
+ "kernel_symm_ethanol": benchmark_kernel_symm_ethanol,
305
+ "kernel_asymm_ethanol": benchmark_kernel_asymm_ethanol,
306
+ "kernel_symm_qm7b": benchmark_kernel_symm_qm7b,
307
+ "kernel_asymm_qm7b": benchmark_kernel_asymm_qm7b,
308
+ "kernel_gdml_ethanol": benchmark_kernel_gdml_ethanol,
309
+ "kernel_gdml_symm_ethanol": benchmark_kernel_gdml_symm_ethanol,
310
+ }
311
+
312
+ # Named benchmark suites
313
+ SUITES = {
314
+ "representations": [
315
+ "ethanol_fchl19_repr",
316
+ "ethanol_fchl19_grad",
317
+ "qm7b_fchl19_repr",
318
+ "qm7b_fchl19_grad",
319
+ ],
320
+ "ethanol-kernels": [
321
+ "kernel_symm_ethanol",
322
+ "kernel_asymm_ethanol",
323
+ ],
324
+ "qm7b-kernels": [
325
+ "kernel_symm_qm7b",
326
+ "kernel_asymm_qm7b",
327
+ ],
328
+ "gdml-kernels": [
329
+ "kernel_gdml_ethanol",
330
+ "kernel_gdml_symm_ethanol",
331
+ ],
332
+ }
333
+
334
+ SUITES["all"] = []
335
+ for suite_name, suite_benchmarks in SUITES.items():
336
+ if suite_name != "all":
337
+ SUITES["all"].extend(suite_benchmarks)
338
+
339
+
340
+ def print_header(suite_name: str) -> None:
341
+ """Print the benchmark header."""
342
+ title = f"{PROGRAM_NAME} v{version('kernelforge')} | Suite: {suite_name}"
343
+ print()
344
+ print("-" * 80)
345
+ print(title)
346
+ print("-" * 80)
347
+ print()
348
+
349
+
350
+ def print_result(bench_name: str, elapsed_ms: float, description: str) -> None:
351
+ """Print a single benchmark result."""
352
+ elapsed_s = elapsed_ms / 1000.0
353
+ print(f" {description:<50} {elapsed_s:>8.4f} s")
354
+
355
+
356
+ def print_footer(total_ms: float, count: int) -> None:
357
+ """Print the footer with summary."""
358
+ total_s = total_ms / 1000.0
359
+ print()
360
+ print("-" * 80)
361
+ print()
362
+ print(f" Total time: {total_s:.4f} s")
363
+ print(f" Benchmarks: {count}")
364
+ print(" Status: OK ✓")
365
+ print()
366
+
367
+
368
+ def run(suite: str):
369
+ """Run KernelForge benchmarks."""
370
+ if suite not in SUITES:
371
+ print(f"Error: Unknown suite '{suite}'", file=sys.stderr)
372
+ print(f"Available suites: {', '.join(SUITES.keys())}", file=sys.stderr)
373
+ sys.exit(1)
374
+
375
+ suite_benchmarks = SUITES[suite]
376
+ if not suite_benchmarks:
377
+ print("Error: Empty suite", file=sys.stderr)
378
+ sys.exit(1)
379
+
380
+ print_header(suite)
381
+
382
+ total_ms = 0
383
+ results = []
384
+
385
+ for bench_name in suite_benchmarks:
386
+ bench_func = BENCHMARKS[bench_name]
387
+ elapsed_ms, description = bench_func()
388
+ print_result(bench_name, elapsed_ms, description)
389
+ total_ms += elapsed_ms
390
+ results.append((bench_name, elapsed_ms, description))
391
+
392
+ # Print footer
393
+ print_footer(total_ms, len(results))
394
+
395
+
396
+ def main():
397
+ """Main entry point for the qmlbench command."""
398
+ parser = argparse.ArgumentParser(
399
+ prog="qmlbench",
400
+ description=f"{PROGRAM_NAME} - Single-run benchmark suite for KernelForge",
401
+ )
402
+ parser.add_argument(
403
+ "suite",
404
+ nargs="?",
405
+ default="all",
406
+ choices=list(SUITES.keys()),
407
+ help="Benchmark suite to run (default: all)",
408
+ )
409
+
410
+ args = parser.parse_args()
411
+ run(args.suite)
412
+
413
+
414
+ if __name__ == "__main__":
415
+ main()
@@ -0,0 +1,194 @@
1
+ Metadata-Version: 2.2
2
+ Name: kernelforge
3
+ Version: 0.0.0
4
+ Summary: Optimized Kernels for ML
5
+ Author: Anders Christensen
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/andersx/kernelforge
8
+ Project-URL: Issues, https://github.com/andersx/kernelforge/issues
9
+ Requires-Python: >=3.11
10
+ Requires-Dist: numpy>=2.00
11
+ Provides-Extra: test
12
+ Requires-Dist: pytest>=8; extra == "test"
13
+ Requires-Dist: pytest-xdist; extra == "test"
14
+ Requires-Dist: pytest-cov; extra == "test"
15
+ Requires-Dist: pytest-timeout; extra == "test"
16
+ Provides-Extra: dev
17
+ Requires-Dist: black>=24.0.0; extra == "dev"
18
+ Requires-Dist: isort>=5.13.0; extra == "dev"
19
+ Requires-Dist: ruff>=0.3.0; extra == "dev"
20
+ Requires-Dist: mypy>=1.9.0; extra == "dev"
21
+ Requires-Dist: pre-commit>=3.6.0; extra == "dev"
22
+ Description-Content-Type: text/markdown
23
+
24
+ # KernelForge - Optimized Kernels for ML
25
+
26
+ I really only care about writing optimized kernel code, so this project will be completed as I find additional time... XD
27
+
28
+ I'm reviving this project to finish an old project using random Fourier features for kernel ML.
29
+
30
+
31
+ # Installation
32
+
33
+ ```bash
34
+ conda env create -f environments/environment-dev.yml
35
+ pip install -e .
36
+ pytest -v -s
37
+ ```
38
+ ## PyPI installation
39
+
40
+ Install the requirements (e.g. the conda env above) and install from PyPI.
41
+ This should work on both MacOS and Linux/PC:
42
+
43
+ ```bash
44
+ conda activate kernelforge-dev
45
+ pip install kernelforge
46
+ ```
47
+ This will install pre-compiled wheels with gfortran and linked againts OpenBLAS on Linux and Accelerate on MacOS.
48
+ If you want to use MKL or other BLAS/LAPACK libraries, you need to compile from source, see below.
49
+
50
+
51
+ ## Intel compilers and MKL
52
+
53
+ It is 2025 so you can `sudo apt get install intel-basekit` on Linux/PC to get the compilers and MKL.
54
+ Then set up the environment variables:
55
+ ```bash
56
+ source /opt/intel/oneapi/setvars.sh
57
+ ```
58
+ In this case, MKL will be autodetected by some CMake magic. If you additionally want to compile with Intel compilers, you can set the environment variables when running `pip install`:
59
+ ```bash
60
+ CC=icx CXX=icpx FC=ifx make install
61
+ ```
62
+
63
+ In my experience, GCC/G++/GFortran with OpenBLAS is very similar to Intel API alternatives in terms of performance, perhaps even better.
64
+ On MacOS, GNU compilers with `-framework Accelerate` for BLAS/LAPACK is the default and is very fast on M-series macs.
65
+
66
+ ## Timings
67
+ I've rewritten a few of the kernels from the original QML code completely in C++.
68
+ There are performance gains in most cases.
69
+ These are primarily due to better use of BLAS routines for calculating, for example, Gramian sub-matrices with chunked DGEMM/DSYRK calls, etc.
70
+ In the gradient and Hessian matrices there are also some algorithmic improvement and pre-computed terms.
71
+ Memory usage might be a bit higher, but this could be optimized with more fine-graind chunking if needed.
72
+ More is coming as I find the time ...
73
+
74
+ Some speedups vs the original QML code are shown below:
75
+
76
+ | Benchmark | QML [s] | Kernelforge [s] |
77
+ |:---------------|------------:|--------------------:|
78
+ | Upper triangle Gaussian kernel (16K x 16K) | 1.82 | 0.64 |
79
+ | 1K FCHL19 descriptors (1K) | ? | 0.43 |
80
+ | 1K FCHL19 descriptors+jacobian (1K) | ? | 0.62 |
81
+ | FCHL19 Local Gaussian scalar kernel (10K x 10K) | 76.81 | 18.15 |
82
+ | FCHL19 Local Gaussian gradient kernel (1K x 2700K) | 32.54 | 1.52 |
83
+ | FCHL19 Local Gaussian Hessian kernel (5400K x 5400K) | 29.68 | 2.05 |
84
+
85
+ ## TODO list
86
+
87
+ The goal is to remove pain-points of existing QML libraries
88
+ - Removal of Fortran dependencies
89
+ - No Fortran-ordered arrays
90
+ - No Fortran compilers needed
91
+ - Simplified build system
92
+ - No cooked F2PY/Meson build system, just CMake and Pybind11
93
+ - Improved use of BLAS routines, with built-in chunking to avoid memory explosions
94
+ - Better use of pre-computed terms for single-point inference/MD kernels
95
+ - Low overhead with Pybind11 shims and better aligned memory?
96
+ - Simplified entrypoints that are compatible with RDKit, ASE, Scikit-learn, etc.
97
+ - A few high-level functions that do the most common tasks efficiently and correctly
98
+ - Efficient FCHL19 out-of-the-box
99
+ - Fast training with random Fourier features
100
+ - With derivatives
101
+
102
+
103
+ ## Priority list for the next months:
104
+
105
+ - [x] Finish the inverse-distance kernel and its Jacobian
106
+ - [x] Make Pybind11 interface
107
+ - [ ] Finalize the C++ interface
108
+ - [x] Finish the Gaussian kernel
109
+ - [x] Notebook with rMD17 example
110
+ - [x] Finish the Jacobian and Hessian kernels
111
+ - [x] Notebook with rMD17 forces example
112
+ - FCHL19 support:
113
+ - [x] Add FCHL19 descriptors
114
+ - [x] Add FCHL19 kernels (local/elemental)
115
+ - [x] Add FCHL19 descriptor with derivatives
116
+ - [x] Add FCHL19 kernel Jacobian
117
+ - [x] Add FCHL19 kernel Hessian (GDML-style)
118
+ - [ ] Improve FCHL19 kernel Jacobian performance (its poor)
119
+ - Finish the random Fourier features kernel and its Jacobian
120
+ - [ ] Parallel random basis sampler
121
+ - [ ] RFF kernel for global descriptors
122
+ - [ ] SVD and QR solvers for rectangular matrices
123
+ - [ ] RFF kernel for local descriptors (FCHL19)
124
+ - [ ] RFF kernels with Cholesky solver and chunked DSYRK kernel updates
125
+ - [ ] RFF kernels with RFP format with chunked DSFRK kernel updates
126
+ - [ ] RFF kernel Jacobian for global descriptors
127
+ - [ ] RFF kernel Jacobian for local descriptors (FCHL19)
128
+ - [ ] Notebook with rMD17 random Fourier features examples
129
+
130
+ - Science:
131
+ - Benchmark full kernel vs RFF on rMD17 and QM7b and QM9
132
+ - Both FCHL19 and inverse-distance matrix
133
+
134
+ #### Todos:
135
+ - Houskeeping:
136
+ - [x] Pybind11 bindings and CMake build system
137
+ - [x] Setup CI with GitHub Actions
138
+ - [x] Rewrite existing kernels to C++ (no Fortran)
139
+ - [x] Setup GHA to build PyPI wheels
140
+ - [x] Test Linux build matrices
141
+ - [x] Test MacOS build matrices
142
+ - [ ] Test Windows build matrices
143
+ - [x] Add build for all Python version >=3.11
144
+ - [ ] Plan structure for saving models for inference as `.npz` files
145
+ - Ensure correct linking with optimized BLAS/LAPACK libraries:
146
+ - [x] OpenBLAS (Linux) <- also used in wheels
147
+ - [x] MKL (Linux)
148
+ - [x] Accelerate (MacOS)
149
+ - Add global kernels:
150
+ - [x] Gaussian kernel
151
+ - [x] Jacobian/gradient kernel
152
+ - [ ] Optimized Jacobian kernel for single inference
153
+ - [x] Hessian kernel
154
+ - [x] GDML-like kernel
155
+ - [ ] Full GPR kernel
156
+ - Add local kernels:
157
+ - [x] Gaussian kernel
158
+ - [x] Jacobian/gradient kernel
159
+ - [x] Optimized Jacobian kernel for single inference
160
+ - [x] Hessian kernel (GDML-style)
161
+ - [ ] Full GPR kernel
162
+ - [ ] Optimized GPR kernel with pre-computed terms for single inference/MD
163
+ - Add random Fourier features kernel code:
164
+ - [ ] Fourier-basis sampler
165
+ - [ ] RFF kernel
166
+ - [ ] RFF gradient kernel
167
+ - [ ] RFF chunked DSYRK kernel
168
+ - [ ] Optimized RFF gradient kernel for single inference/MD
169
+ - The same as above, just for Hadamard features when I find the time?
170
+ - GDML and sGDML kernels:
171
+ - [x] Inverse-distance matrix descriptor
172
+ - [ ] Packed Jacobian for inverse-distance matrix
173
+ - [x] GDML kernel (brute-force implemented)
174
+ - [ ] sGDML kernel (brute-force implemented)
175
+ - [ ] Full GPR kernel
176
+ - [ ] Optimized GPR kernel with pre-computed terms for single inference/MD
177
+ - FCHL18 support:
178
+ - [ ] Complete rewrite of FCHL18 analytical scalar kernel in C++
179
+ - [ ] Stretch goal 1: Add new analytical FCHL18 kernel Jacobian
180
+ - [ ] Stretch goal 2: Add new analytical FCHL18 kernel Hessian (+GPR/GDML-style)
181
+ - [ ] Stretch goal 3: Attempt to optimize hyperparameters and cut-off functions
182
+ - Add standard solvers:
183
+ - [x] Cholesky in-place solver
184
+ - [x] L2-reg kwarg
185
+ - [x] Toggle destructive vs non-destructive
186
+ - [ ] QR and/or SVD for non-square matrices
187
+ - Add moleular descriptors with derivatives:
188
+ - [ ] Coulomb matrix + misc variants without derivatives
189
+ - [x] FCHL19 + derivatives
190
+ - [x] GDML-like inverse-distance matrix + derivatives
191
+ #### Stretch goals:
192
+ - [ ] Plan RDKit interface
193
+ - [ ] Plan Scikit-learn interface
194
+ - [ ] Plan ASE interface
@@ -0,0 +1,12 @@
1
+ kernelforge/_fchl19.cpython-313-darwin.so,sha256=IM_WAguu1NxKgsDBh8j7nEn9eMr7vZQEsYq9DpFZEpY,306224
2
+ kernelforge/_invdist.cpython-313-darwin.so,sha256=01odvzIaNW6oWqo1ATAW8Joo37-my6HEIyvFE14a0UE,184512
3
+ kernelforge/__init__.py,sha256=tsj3sWP6mfzRi_YORCuSfhOhWB7m7m7C4mBl5BHdpcg,197
4
+ kernelforge/_kernels.cpython-313-darwin.so,sha256=l18nNBoVSWEzn56wTJtva1xkhsA8Aq2xbTbiDah2Eo8,219392
5
+ kernelforge/cli.py,sha256=0jCxTKuj6X9kRUSL4rQW8sa8Qai4qDnnSNBJEQhiaCo,12507
6
+ kernelforge/_cholesky.cpython-313-darwin.so,sha256=UZzxfPlhgDVtC0EuUFwyFDmKl1z5MTAIEuPHSuXNfNw,201664
7
+ kernelforge/.dylibs/libomp.dylib,sha256=RenjWTYIlAk4D_E1-55rDgZ0NewKC1ysiAnP2cOzJzM,743200
8
+ kernelforge-0.0.0.dist-info/RECORD,,
9
+ kernelforge-0.0.0.dist-info/WHEEL,sha256=_Fb8-ydQXDLVs5LO-8i0dmGnvu1Osho0yB_dV-fAWsk,141
10
+ kernelforge-0.0.0.dist-info/entry_points.txt,sha256=QvFoX5Ov8SBjAM-u4qAblSCHZcXtrOfzisANJG7LMq8,51
11
+ kernelforge-0.0.0.dist-info/METADATA,sha256=8STli96bZBKq7bLkfULPsHjeloH3j2yyCwDTTy6QSjc,7817
12
+ kernelforge-0.0.0.dist-info/licenses/LICENSE,sha256=yGiQhg840NPE4sgJ-kj7n-DC86zxDds2HktJYDSvpCY,1081
@@ -0,0 +1,6 @@
1
+ Wheel-Version: 1.0
2
+ Generator: scikit-build-core 0.11.6
3
+ Root-Is-Purelib: false
4
+ Tag: cp313-cp313-macosx_15_0_arm64
5
+ Generator: delocate 0.13.0
6
+
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ qmlbench = kernelforge.cli:main
3
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Anders Steen Christensen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.