Skip to content
Merged

Dev #11

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
e97c7b1
fix(isabelle): lll_rank_preserved C ternary syntax
sergiorandria Sep 6, 2026
5e83bc4
fix: replace magic numbers with macros (powerful, homology) and fix c…
sergiorandria Sep 6, 2026
79d2c14
fix: magic numbers to macros (accelerator, cuda, char, creation)
sergiorandria Sep 7, 2026
d864501
fix(half): Added missing import
sergiorandria Sep 7, 2026
a15b30c
fix(creation_fixed): use CLAUDE correct impl for asanyarray/ascontigu…
sergiorandria Sep 7, 2026
d5dfa5c
fix(ndarray_fixed): include bigint for is_bigint_v standalone compile
sergiorandria Sep 7, 2026
d924191
fix(creation_fixed): detail require with aliases/try_lookup and OWNDA…
sergiorandria Sep 7, 2026
6466848
fix(half): fallback distinct soft half, correct bfloat16 rounding via…
sergiorandria Sep 7, 2026
baa6d1c
fix(gpu): correct f64 AVX512 double-count, forward-declare graph, hea…
sergiorandria Sep 7, 2026
47d6b7f
fix(gpu): dedupe enumerate_devices CUDA driver/runtime and make try_f…
sergiorandria Sep 7, 2026
f16cbaf
fix(threadpool): propagate parallel_for exceptions instead of hanging…
sergiorandria Sep 7, 2026
e79ffdd
fix(cuda): query device compute capability for arch predicates, cache…
sergiorandria Sep 7, 2026
351eb64
fix(ndarray): scope -Wbraced-scalar-init suppression to NDProxy with …
sergiorandria Sep 7, 2026
cb1723c
rename(dtype): _Np_dtype classifiers to dtype_storage, replace magic …
sergiorandria Sep 7, 2026
dd7db22
fix(gpu): prefer CUDA backend over OpenMP offload, require toolkit fo…
sergiorandria Sep 7, 2026
e8f9c32
feat(physics): 3D incompressible Navier-Stokes solver with Chorin pro…
sergiorandria Sep 7, 2026
90ffac2
fix(ndarray): NumPy-parity hardening across indexing, arithmetic and …
sergiorandria Sep 9, 2026
d15b23f
fix(creation): validate dims and Fortran order in (un)ravel
sergiorandria Sep 9, 2026
8990296
fix(indexing): harden putmask broadcast and offsets
sergiorandria Sep 9, 2026
349b24c
fix(concatenate): handle empty inputs in concat/stack
sergiorandria Sep 9, 2026
b5a6fab
perf(emath): contiguous fast paths and single-pass logs
sergiorandria Sep 9, 2026
4f9e9d4
fix(statistics): NumPy-parity ddof and NaN rules
sergiorandria Sep 9, 2026
ae9c097
fix(random): validate domains, drop fake BitGenerators
sergiorandria Sep 9, 2026
5e6959c
fix(quantum): real multi-gate state-vector evolution
sergiorandria Sep 9, 2026
d890e19
fix(io): little-endian npy lens and strict truncation
sergiorandria Sep 9, 2026
aa7a0ed
fix(linalg): axis-aware norm dispatch
sergiorandria Sep 9, 2026
386c58d
fix(padic): exact bigint paths and true p-adic volume/norm
sergiorandria Sep 9, 2026
9fd8208
fix(fft): thread-safe twiddle cache and length validation
sergiorandria Sep 9, 2026
6fa7647
fix(masked-array): count/dot/put correctness
sergiorandria Sep 9, 2026
5471bc9
fix(homology): polynomial Kannan-Bachem SNF
sergiorandria Sep 9, 2026
d0028b0
feat(cohomology): exact rational cup product and cup-aware homotopy
sergiorandria Sep 9, 2026
14ef090
feat(manifold): new spaces, Kuenneth torsion, curvature and S0 fixes
sergiorandria Sep 9, 2026
e366498
fix(spectral): compute exactness, gate Leray-Serre collapse
sergiorandria Sep 9, 2026
4632346
fix(lattice,differential): honesty renames and type and bound fixes
sergiorandria Sep 9, 2026
3824276
feat(memristor): hardware-aware analog crossbar simulation
sergiorandria Sep 9, 2026
5a80397
fix(neuromorphic): replace fake hardware backends with LIF simulation
sergiorandria Sep 9, 2026
a6e89eb
refactor(hw): honest backend names and simulated paths
sergiorandria Sep 9, 2026
4125ee6
fix(threadpool): wait observes in-flight tasks
sergiorandria Sep 9, 2026
80e4ddb
refactor(powerful): constexpr tune constants and cached topology probes
sergiorandria Sep 9, 2026
40b0d93
feat(gpu): real cuBLAS/cuFFT dlopen backend with status plumbing
sergiorandria Sep 9, 2026
f1602a3
feat(physics): expand solvers, constants and analytic physics
sergiorandria Sep 9, 2026
bd66a03
feat(modular): exact Bernoulli to B30, real j-series, eigenform fix
sergiorandria Sep 9, 2026
e211d54
docs(api,examples): honesty pass for backend capabilities
sergiorandria Sep 9, 2026
c482c9c
fix(memristor): never construct normal_distribution with zero stddev
sergiorandria Sep 10, 2026
9fd15b0
fix(datetime,cuda): document intentional catch fallbacks
sergiorandria Sep 10, 2026
548cf03
docs: honesty sweep follow-through, CI enforcement and changelog
sergiorandria Sep 10, 2026
73b766f
style: clang-format clean tree for the CI check job
sergiorandria Sep 10, 2026
1209747
fix(linalg): drop dead bigint-solve pre-conversion
sergiorandria Sep 10, 2026
f90c2e7
docs(bundle,math): correct euler comment, NOTE-ify SIMD remark
sergiorandria Sep 10, 2026
c6d0bd2
chore: ignore root Testing/ CTest artifacts
sergiorandria Sep 10, 2026
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
20 changes: 15 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DNP_WERROR=ON
- name: Build
run: cmake --build build -j8
- name: Test 38/38
- name: Test 49/49
run: ctest --test-dir build --output-on-failure
- name: Bench hardware (smoke)
run: ./build/tests/bench_hardware || true
Expand All @@ -36,7 +36,7 @@ jobs:
cmake_args: -DNP_ENABLE_SANITIZERS=ON -DNP_ENABLE_TSAN=OFF
name: Undefined
- sanitizer: tsan
cmake_args: -DNP_ENABLE_TSAN=ON -DNP_ENABLE_SANITIZERS=OFF -DNP_ENABLE_PQC=OFF -DNP_WERROR=OFF -DCMAKE_CXX_FLAGS="-Wno-error=tsan -Wno-error"
cmake_args: -DNP_ENABLE_TSAN=ON -DNP_ENABLE_SANITIZERS=OFF -DNP_ENABLE_PQC=OFF
name: Thread
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -68,15 +68,25 @@ jobs:

lint:
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Install deps
run: sudo apt-get update && sudo apt-get install -y clang-tidy libboost-all-dev
- name: Configure (clang-tidy)
run: cmake -S . -B build-tidy -DCMAKE_BUILD_TYPE=Release -DNP_ENABLE_TIDY=ON -DNP_WERROR=ON
- name: Build (tidy)
run: cmake --build build-tidy -j8 2>&1 | tee tidy.log; test ${PIPESTATUS[0]} -eq 0 || echo "tidy warnings (non-blocking)"
- name: Build (tidy, blocking)
run: cmake --build build-tidy -j8 2>&1 | tee tidy.log

format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install clang-format
run: sudo apt-get update && sudo apt-get install -y clang-format
- name: Check formatting
run: |
clang-format --version
git ls-files 'include/np/*.hpp' 'include/np/detail/*.hpp' 'include/np/fft/*.hpp' 'tests/*.cpp' | xargs clang-format --dry-run --Werror

isabelle:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ RANDOM_MODULE_SUMMARY.md
CMakeCache.txt
CMakeFiles/
DartConfiguration.tcl
Testing/
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to `numpy-cpp` will be documented here. Format based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), versioning follows [SemVer](https://semver.org/spec/v2.0.0.html).

## [Unreleased] — honesty pass + 49/49 suites

### Fixed
- **Docs honesty** — `README.md` no longer claims `0 stubs` or bare `Loihi2/SpiNNaker`, `HBM/CXL`, `Hopper/AMX` backends: `neuromorphic` is CPU LIF simulation, `memory` is host storage with `HbmHintArray`/`CxlHintArray` placement hints (`memory.hpp:104-176`), `tensor` is blocked-CPU/FP32-GPU dispatch with quantize-around-FP32 (`tensor_core.hpp:22`), `accelerator` is CPU/GPU/ReRAM-sim (`accelerator.hpp:226-242`). Documented `other.hpp` parity shims and default PQC wrappers as intentional stubs; test count corrected to `49/49` across `README.md`, `docs/` and CI step name.
- **CI enforcement** — `lint` job is now blocking (`clang-tidy` warnings fail the build), new `clang-format --check` job enforces `.clang-format` (`ColumnLimit: 120`, 4-space), TSan keeps `NP_WERROR=ON` (warnings-as-errors stay on where races hide).
- **Error handling (AGENTS.md §4)** — narrowed `datetime64_from_string` catch to `const std::exception&` with rethrow as `invalid_argument`; documented the `datetime_data` count fallback and the `cuda.hpp` `noexcept` cache fallback so no `catch (...)` silently swallows.

## [1.0.0] — 2025-09-03 — Production Ready

First stable **1.0** — header-only C++20 NumPy 2.2 — 712 routines, zero Python runtime.
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ if(NP_ENABLE_CUDA)
target_link_libraries(numpy-cpp INTERFACE CUDA::cudart CUDA::cublas)
message(STATUS "CUDAToolkit found: ${CUDAToolkit_VERSION} – enabling CUDA runtime")
else()
message(STATUS "NP_ENABLE_CUDA but CUDAToolkit not found – using driver dlopen fallback")
message(FATAL_ERROR "NP_ENABLE_CUDA=ON requires the CUDA toolkit (cuda_runtime.h, cudart, cublas). Install it or use -DNP_ENABLE_GPU=ON for driver-only probing without the toolkit.")
endif()
endif()
if(NP_ENABLE_HIP)
Expand Down
20 changes: 11 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
[![Header-only](https://img.shields.io/badge/header--only-Yes-brightgreen?style=flat-square)](include/np/np.hpp)
[![NumPy](https://img.shields.io/badge/NumPy-2.2-013243.svg?style=flat-square&logo=numpy)](https://numpy.org/doc/stable/)
[![License](https://img.shields.io/badge/license-BSD--3--Clause-green?style=flat-square)](LICENSE)
[![Tests](https://img.shields.io/badge/tests-22%2F22-brightgreen?style=flat-square)](#testing)
[![Tests](https://img.shields.io/badge/tests-49%2F49-brightgreen?style=flat-square)](#testing)
[![SIMD](https://img.shields.io/badge/SIMD-SSE4.2%20%7C%20AVX2%20%7C%20AVX--512%20%7C%20NEON%20%7C%20WASM%20%7C%20RVV-orange?style=flat-square)](#performance)

**numpy-cpp** is a complete, header-only C++20 reimplementation of the NumPy 2.2 API — **760+ routines** across **36 modules**, **0 stubs**, with NumPy-identical semantics. Include one header, get the whole scientific stack at compiled speed.
**numpy-cpp** is a complete, header-only C++20 reimplementation of the NumPy 2.2 API — **760+ routines** across **36 modules**, with NumPy-identical semantics. Include one header, get the whole scientific stack at compiled speed.

> Parity shims: a handful of `numpy.distutils` / `ctypeslib` compat helpers in `other.hpp` are intentional thin stubs (documented in [Known Divergences](#known-divergences)), and optional PQC KEM/signature wrappers default to stubs unless `NP_PQC_ALG` is set. Everything in the NumPy surface above has a real implementation plus scalar fallback.

```cpp
#include <np/np.hpp> // now fully integrated (random + concatenate included)
Expand Down Expand Up @@ -66,7 +68,7 @@ No linking. No Python runtime. No code generation. Just `#include <np/np.hpp>`.
* **Zero-overhead** — header-only `INTERFACE` library (`cmake --install` just copies headers). Views are `shared_ptr` aliases, not copies. Contiguous fast paths use `memcpy` / direct `T* __restrict`.
* **Portable SIMD** — auto-detected: SSE4.2 / AVX2 / AVX-512 on x86-64, NEON on ARM64, WASM SIMD128, RISC-V Vector, POWER VSX. Scalar fallback always correct.
* **Two array engines** — `ndarray<T>` (dynamic, heap) + `ndarrayf<T, Extents...>` (fixed, stack, `constexpr`-foldable).
* **Production-ready** — lock-free Chase-Lev threadpool, `29/29` CTest suites, `clang-format` enforced, BSD-3-Clause.
* **Production-ready** — lock-free Chase-Lev threadpool, `49/49` CTest suites, `clang-format` enforced, BSD-3-Clause.

> If you embed scientific computing in C++ — games, robotics, trading, edge inference — numpy-cpp lets you keep NumPy semantics without shipping Python.

Expand All @@ -88,7 +90,7 @@ No linking. No Python runtime. No code generation. Just `#include <np/np.hpp>`.
- **I/O** — `load`, `save`, `savez`, `NpzFile`, `savetxt`, `DataSource`
- **Polynomial** — `Polynomial`, `Chebyshev`, `polyfit`, `polyutils`
- **Dtype & Masked** — `can_cast`, `promote_types`, `finfo`/`iinfo`, `MaskedArray`
- **Extras** — `bigint` (Boost `cpp_int` / GMP), `pqc` constant-time hardening, `differential` LLVM JIT (optional), `homology`/`homotopy`/`manifold`/`variety`, `lattice`/`padic`, `neuromorphic` (Loihi2/SpiNNaker), `memory` (HBM/CXL), `tensor` (Hopper/AMX), `analog` (ReRAM), `photonics` (Mach-Zehnder), `quantum` (StateVector), `accelerator` (heterogeneous)
- **Extras** — `bigint` (Boost `cpp_int` / GMP), `pqc` constant-time hardening (KEM/signature wrappers are opt-in stubs unless `NP_PQC_ALG` is set), `differential` LLVM JIT (optional, interpreter fallback), `homology`/`homotopy`/`manifold`/`variety`, `lattice`/`padic`, `neuromorphic` (CPU LIF simulation, no Loihi2/SpiNNaker hardware), `memory` (host storage with HBM/CXL placement *hints*, no device migration), `tensor` (blocked-CPU / FP32-GPU dispatch, FP8 is quantize-around-FP32, no Hopper/AMX tile path), `analog` (ReRAM crossbar simulation), `photonics` (Mach-Zehnder unitary math + simulation), `quantum` (in-house state-vector simulation), `accelerator` (heterogeneous CPU/GPU/sim dispatch)

---

Expand Down Expand Up @@ -331,7 +333,7 @@ docs/
API.md per-module file:line table
CONTRIBUTING.md workflow & style
MATH_PROOFS.md correctness proofs vs NumPy ref
tests/ 22 CTest suites + bench_math (AVX, manual)
tests/ 49 CTest suites + bench_math / bench_hardware (AVX, manual)
```

---
Expand All @@ -340,7 +342,7 @@ tests/ 22 CTest suites + bench_math (AVX, manual)

```bash
cmake -S . -B build && cmake --build build -j8
ctest --test-dir build --output-on-failure # 29/29
ctest --test-dir build --output-on-failure # 49/49

#single suite verbose
./build/tests/test_ndarray --verbose
Expand All @@ -351,7 +353,7 @@ g++ -std=c++20 -I include tests/test_math.cpp -o /tmp/t && /tmp/t
cmake --build build --target bench_math && ./build/tests/bench_math
```

CI target is `29/29` green. Every fast path has a scalar fallback exercised by tests.
CI target is `49/49` green. Every fast path has a scalar fallback exercised by tests.

---

Expand All @@ -375,7 +377,7 @@ Doxygen per function: `grep -n "Reference:" include/np/*.hpp`.
1. Branch from `dev`: `git checkout -b feat/my-opt dev`
2. Match NumPy signature exactly — check `numpy-reference/reference/generated/numpy.<func>.html`.
3. Implement in `include/np/<module>.hpp` with Doxygen `Reference:` link.
4. Format: `clang-format -i include/np/*.hpp` (`.clang-format`: 2-space, Allman, `ColumnLimit: 90`, `SortIncludes: Never`).
4. Format: `clang-format -i include/np/*.hpp` (`.clang-format`: 4-space, Allman-style custom braces, `ColumnLimit: 120`).
5. Add `tests/test_<module>.cpp` using `tests/test_util.hpp` (`test::check`, `test::approx`).
6. Register in `tests/CMakeLists.txt` `NP_TESTS`.
7. `cmake --build build && ctest --output-on-failure` — commit `feat(module): ...` with `file:line`.
Expand All @@ -389,7 +391,7 @@ See [`docs/CONTRIBUTING.md`](docs/CONTRIBUTING.md) and `AGENTS.md`.
* `operator[](i,j)` is C++23 — use `arr(i,j)` or `arr[i][j]` proxy (`ndarray.hpp:3315`).
* Complex `linalg` is real-only (`is_complex_v` static-assert) — dispatches to real `double`.
* `ndarray<bool>` uses proxy reference (`vector<bool>` bitset); `is_contiguous()` aware.
* `numpy.distutils` / `ctypeslib` are thin `other.hpp` stubs.
* `numpy.distutils` / `ctypeslib` are thin `other.hpp` stubs (`who`, `disp`, `info`, `source`, `lookfor`, `deprecate`, `show_config`, buffer-size helpers) plus `einsum_path_stub` (real path logic lives in `linalg.hpp`). PQC KEM/signature wrappers are opt-in stubs unless `NP_PQC_ALG` selects a backend.

---

Expand Down
12 changes: 6 additions & 6 deletions docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,19 @@ Umbrella `include/np/np.hpp:13` (28 includes; all integrated). Every `np::` has
| **Differential** | `differential.hpp:438` | `VM, ScalarField, KForm, exterior_derivative, wedge, pullback, kernel::gradient/hessian/laplacian` | `Bott–Tu` |
| **Lattice** | `lattice.hpp:143` | `Lattice, PosetLattice, meet/join, dual, lll/bkz, gram, volume, shortest/closest, LatticeFactory, Builder, Strategy, Visitor, Observer, Decorator` | `Micciancio–Goldwasser, Lenstra–Lenstra–Lovász` |
| **Padic** | `padic.hpp:135` | `Padic, PadicLattice, Hensel/Newton, valuation/norm/expansion/teichmuller, PadicFactory, Builder, Strategy, Visitor, Observer, Decorator, to_padic_lattice` | `Gouvea, Koblitz, Serre` |
| **Neuromorphic** | `neuromorphic.hpp:1` | `Event/EventArray, SpikeEncoder (rate/temporal), LIF/Izhikevich, STDP, INeuromorphicBackend (Loihi/SpiNNaker/CPU), NeuromorphicFactory, EventBuilder, SpikeVisitor, QuantizedEventArray` | `Loihi2/NorthPole/Akida, Gerstner` |
| **Memory** | `memory.hpp:1` | `HBMArray/CXLArray, MemorySpace (Host/HBM/CXL/Unified), MemoryFactory, migrate_to_hbm/host, zeros_hbm` | `HBM3/CXL3.0/GH200` |
| **Tensor** | `tensor_core.hpp:1` | `TensorBackend (CPU/Hopper/AMX), TensorFactory, QuantizedTensor, quantize, matmul_fp8` | `Hopper/Blackwell/AMX/SME2` |
| **Analog** | `memristor.hpp:1` | `Crossbar (ReRAM, Mythic/d-Matrix), ReRAMFactory, dot (analog V=IR), quantize` | `ReRAM/Memristor` |
| **Neuromorphic** | `neuromorphic.hpp:1` | `Event/EventArray, SpikeEncoder (rate/temporal), LIF/Izhikevich, STDP (standalone), INeuromorphicBackend (CPU/LIF-sim), NeuromorphicFactory, EventBuilder, SpikeVisitor, QuantizedEventArray` | `Gerstner (algorithmic only; no Loihi2/SpiNNaker hardware)` |
| **Memory** | `memory.hpp:1` | `TaggedArray<T,S>` (ordinary host storage), `HbmHintArray/CxlHintArray/DeviceHintArray` placement hints, `tag_hbm_hint/tag_device_hint`, `migrate_to_host`, `zeros_hinted(shape, space)` | `HBM3/CXL3.0/GH200 (hints only; no device migration)` |
| **Tensor** | `tensor_core.hpp:1` | `TensorBackend (CPU/GPU-FP32/CPU-blocked), TensorFactory, QuantizedTensor, quantize, matmul_fp8` | `cuBLAS FP32 / blocked CPU` |
| **Analog** | `memristor.hpp:1` | `Crossbar (VMM, program, outer-product), MemristorCell (ion-drift/Simmons/TEAM/VTEAM/Yakopcic/Stanford), WindowFunction, MappingScheme, IMemristorBackend (Sim/Noisy/HW/Serial), DifferentialCrossbar, TiledCrossbar, CrossbarBuilder, ReRAMFactory (mythic/dmatrix presets)` | `Strukov/Kvatinsky/Yakopcic, Mythic/d-Matrix` |
| **Photonics** | `photonics.hpp:1` | `MachZehnderMesh (unitary), PhotonicsFactory::identity, apply (optical matmul)` | `Lightmatter/Luminous` |
| **Quantum** | `quantum.hpp:1` | `StateVector (2^n), QuantumFactory::zero/plus_state, prob` | `IBM Heron/Quantinuum` |
| **Accelerator** | `accelerator.hpp:1` | `IAccelerator (CPU/GPU/Loihi/ReRAM), AcceleratorFactory::cpu/gpu/loihi/reram` | `Heterogeneous` |
| **Accelerator** | `accelerator.hpp:1` | `IAccelerator (CPU/GPU/ReRAM-sim/auto_select), AcceleratorFactory::cpu/gpu/reram/auto_select/powerful` | `Heterogeneous (CPU/GPU/sim; no Loihi hardware)` |
| **Cohomology** | `cohomology.hpp:191` | `cohomology_groups, cohomology_ring, cup_product, poincare_pairing, intersection_form, kunneth` | `Hatcher Ch.3` |
| **Bundle** | `bundle.hpp:103` | `VectorBundle, tangent/cotangent, chern/stiefel/euler/pontryagin, whitney_sum, HodgeStar` | `Milnor–Stasheff` |
| **Persistent** | `persistent.hpp:94` | `FilteredSimplex, Filtration, persistence_barcode, bottleneck_distance, vietoris_rips` | `Edelsbrunner–Harer` |
| **Spectral** | `spectral.hpp:129` | `MayerVietoris, SpectralSequence, leray_serre (Hopf), ahss, total_betti` | `McCleary` |

Count `712` base + ~50 higher-math (homology/bundle/persistent/spectral) + aliases.
Count `712` base + ~50 higher-math (homology/bundle/persistent/spectral) + aliases. `other.hpp` parity shims (`who/disp/info/source/lookfor/deprecate/show_config`, `einsum_path_stub`) and default PQC KEM/signature wrappers are intentional documented stubs.

## Quick reference

Expand Down
6 changes: 3 additions & 3 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Branch `dev` is the integration branch for micro-opts. `main` is stable (712 rou
2. **Check ref** `numpy-reference/reference/generated/numpy.<func>.html` — match Python signature exactly (see `AGENTS.md`).
3. **Implement** in `include/np/<module>.hpp` with Doxygen `Reference:` link and `NP_API`.
4. **Test** `tests/test_<module>.cpp` using `tests/test_util.hpp` (`test::check`, `approx`).
5. **Format** `clang-format -i include/np/*.hpp` — `.clang-format`: 2-space Allman, `ColumnLimit: 90`, `SortIncludes: Never`, `UseTab: Never`.
6. **Build** `cmake -S . -B build && cmake --build build -j8 && ctest --test-dir build --output-on-failure` — must be **22/22**.
5. **Format** `clang-format -i include/np/*.hpp` — `.clang-format`: 4-space, custom Allman-style braces, `ColumnLimit: 120`, `UseTab: Never`.
6. **Build** `cmake -S . -B build && cmake --build build -j8 && ctest --test-dir build --output-on-failure` — must be **49/49**.
7. **Commit** `feat(module): ...` with `file:line` (e.g. `ndarray.hpp:3116`). One logical task per commit, no `build/` artifacts (`CMakeCache.txt`, `build/` are in `.gitignore`).
8. **PR** to `dev` — include bench delta if perf-related (see `PERFORMANCE.md`).

Expand Down Expand Up @@ -39,4 +39,4 @@ See `AGENTS.md` and `ARCHITECTURE.md` for layout (`include/np/detail/*` for `pro

## Release

`dev` → `main` squash after 22/22 + `clang-format` clean. Tag `vX.Y-dev` for bench.
`dev` → `main` squash after 49/49 + `clang-format` clean. Tag `vX.Y-dev` for bench.
4 changes: 2 additions & 2 deletions docs/DEAD_CODE.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Dead Code Analysis — dev(isabelle + lattice + padic + global API)

> Branch `dev` — `6856eca` + `35c2498` + `33ffadd` + `9563332` — `31/31 ctest` (including `test_lattice` + `test_padic`), `4/4` Isabelle `100%`.
> Branch `dev` — `6856eca` + `35c2498` + `33ffadd` + `9563332` — `31/31 ctest` at the time of writing (now 49/49; including `test_lattice` + `test_padic`), `4/4` Isabelle `100%`.

This document analyses **dead code** (defined but never used in tests or umbrella `np.hpp`)
and how it is now **integrated** with the rest of the codebase, plus where the
Expand Down Expand Up @@ -57,7 +57,7 @@ Dead code is integrated via **Decorator / Adapter** and **Global API inclusion**

```bash
isabelle build -D isabelle -v # → 100% Dual/Differential/Lattice (7s)
cmake --build build -j8 && ctest --output-on-failure # → 31/31 (including test_lattice, test_padic)
cmake --build build -j8 && ctest --output-on-failure # → 49/49 (31/31 at the time of writing, including test_lattice, test_padic)
clang-format -i include/np/*.hpp tests/*.cpp # → clean
```

Expand Down
10 changes: 5 additions & 5 deletions docs/EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ Build: `cmake -S . -B build && cmake --build build -j8 && ./build/examples/neuro
```cpp
auto spikes = np::spike::encode_rate(img, 100, 100);
np::neuromorphic::LIFNeuron lif; lif.step(2.0);
auto loihi = np::neuromorphic::NeuromorphicFactory::loihi();
loihi->process(ea);
np::neuromorphic::LifSimBackend sim(10.0, 1.0);
auto out = sim.process(ea); // real per-channel LIF simulation
```
Uses `np::event::EventArray` (COO, `shared_ptr`+`span`), `np::spike::encode_rate/temporal`, `LIF`/`Izhikevich` with `differential::Dual` surrogate, `STDP`, `INeuromorphicBackend` Strategy (CPU/Loihi2/SpiNNaker2), `QuantizedEventArray` Decorator.
Uses `np::event::EventArray` (COO, `shared_ptr`+`span`), `np::spike::encode_rate/temporal`, `LIF`/`Izhikevich`, standalone `STDP` primitive, `INeuromorphicBackend` Strategy (CPU pass-through harness / LIF-sim), `QuantizedEventArray` Decorator. Software simulation only — no Loihi/SpiNNaker hardware.

## HBM / Tensor (`examples/hbm_matmul.cpp`)
```cpp
auto ha = np::mem::migrate_to_hbm(a); // HBMArray
auto c = np::tensor::matmul_fp8(a,b,1.0f,1.0f); // Hopper FP8 via QuantizedTensor
auto c = np::tensor::matmul_fp8(a,b,1.0f,1.0f); // simulated FP8 (quantize/dequantize around FP32)
auto acc = np::accelerator::AcceleratorFactory::gpu(); acc->matmul(a,b);
```
`np::mem::HBMArray`/`CXLArray` zero-copy `shared_ptr` alias, `np::tensor::HopperBackend`/`AMXBackend` Strategy.
`np::mem::HBMArray`/`CXLArray` zero-copy `shared_ptr` alias, `np::tensor::GpuFp32Backend`/`CpuBlockedBackend` Strategy.

## p-adic Hensel (`examples/padic_hensel.cpp`)
```cpp
Expand Down
6 changes: 3 additions & 3 deletions docs/MATH_PROOFS.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

> **Scope:** 712+ distinct NumPy 2.2 routines + ~50 higher-math (homology/bundle/persistent/spectral), 36 topic groups. Every `np::` is a direct translation of the NumPy/Bott–Tu/Hatcher formula documented in `numpy-reference/reference/generated/numpy.<func>.html` with Doxygen `Reference:` link per function. This doc proves **correctness** (method = NumPy/spec) and **optimization equivalence** (fast path = slow path).

*Branch `dev` — `91820ec` — `29/29 ctest`.*
*Branch `dev` — `91820ec` — `29/29 ctest` at the time of writing (now 49/49; see `tests/CMakeLists.txt`).*

---

Expand Down Expand Up @@ -145,8 +145,8 @@ Every micro-opt obeys **pattern**: `if (is_contiguous() [[likely]]) { direct __r
| `busday_count` | O(days) | O(1) week |
| `isin` | O(n log m) | O(n) hash when m>64 |

All 29 `ctest` still pass — empirical proof of equivalence.
All 49 `ctest` still pass (29 at the time of writing) — empirical proof of equivalence.

---

*Proofs are constructive: each `Reference: numpy-reference/...` in Doxygen maps 1-1 to NumPy spec; `dev` branch `git log --oneline` shows 0 stubs.*
*Proofs are constructive: each `Reference: numpy-reference/...` in Doxygen maps 1-1 to NumPy spec; documented parity shims in `other.hpp` and default PQC wrappers are the only intentional stubs.*
Loading
Loading