nblade 0.1.2__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 (100) hide show
  1. nblade-0.1.2/.github/workflows/ci.yml +104 -0
  2. nblade-0.1.2/.github/workflows/publish-crates.yml +24 -0
  3. nblade-0.1.2/.github/workflows/publish-pypi.yml +95 -0
  4. nblade-0.1.2/.github/workflows/publish-test.yml +90 -0
  5. nblade-0.1.2/.github/workflows/release-please.yml +30 -0
  6. nblade-0.1.2/.gitignore +60 -0
  7. nblade-0.1.2/.readthedocs.yaml +20 -0
  8. nblade-0.1.2/.release-please-config.json +10 -0
  9. nblade-0.1.2/.release-please-manifest.json +3 -0
  10. nblade-0.1.2/AGENTS.md +159 -0
  11. nblade-0.1.2/CHANGELOG.md +38 -0
  12. nblade-0.1.2/CONTRIBUTING.md +190 -0
  13. nblade-0.1.2/Cargo.lock +1242 -0
  14. nblade-0.1.2/Cargo.toml +59 -0
  15. nblade-0.1.2/LICENSE +21 -0
  16. nblade-0.1.2/PKG-INFO +364 -0
  17. nblade-0.1.2/README.md +329 -0
  18. nblade-0.1.2/benches/geometric_product.rs +162 -0
  19. nblade-0.1.2/benches/pool_benchmark.rs +130 -0
  20. nblade-0.1.2/docs/en/api/algebra.md +378 -0
  21. nblade-0.1.2/docs/en/api/multivector.md +684 -0
  22. nblade-0.1.2/docs/en/examples/cg.md +231 -0
  23. nblade-0.1.2/docs/en/examples/physics.md +140 -0
  24. nblade-0.1.2/docs/en/examples/tutorials.md +154 -0
  25. nblade-0.1.2/docs/en/quickstart.md +111 -0
  26. nblade-0.1.2/docs/en/tutorial/01_basics.md +284 -0
  27. nblade-0.1.2/docs/en/tutorial/02_dual.md +231 -0
  28. nblade-0.1.2/docs/index.md +88 -0
  29. nblade-0.1.2/docs/javascripts/mathjax.js +16 -0
  30. nblade-0.1.2/docs/requirements.txt +9 -0
  31. nblade-0.1.2/docs/zh-cn/api/algebra.md +378 -0
  32. nblade-0.1.2/docs/zh-cn/api/multivector.md +684 -0
  33. nblade-0.1.2/docs/zh-cn/examples/cg.md +341 -0
  34. nblade-0.1.2/docs/zh-cn/examples/physics.md +214 -0
  35. nblade-0.1.2/docs/zh-cn/examples/tutorials.md +245 -0
  36. nblade-0.1.2/docs/zh-cn/quickstart.md +111 -0
  37. nblade-0.1.2/docs/zh-cn/tutorial/01_basics.md +284 -0
  38. nblade-0.1.2/docs/zh-cn/tutorial/02_dual.md +231 -0
  39. nblade-0.1.2/examples/README.md +100 -0
  40. nblade-0.1.2/examples/advanced/02_advanced_operations.py +169 -0
  41. nblade-0.1.2/examples/advanced/03_spacetime.py +514 -0
  42. nblade-0.1.2/examples/advanced/04_conformal.py +618 -0
  43. nblade-0.1.2/examples/applications/03_applications.py +280 -0
  44. nblade-0.1.2/examples/basic/01_basic_operations.py +85 -0
  45. nblade-0.1.2/examples/basic/02_vector_creation.py +144 -0
  46. nblade-0.1.2/examples/basic/vector_from_array.py +53 -0
  47. nblade-0.1.2/examples/cg/01_transformations.py +391 -0
  48. nblade-0.1.2/examples/cg/02_projection.py +338 -0
  49. nblade-0.1.2/examples/cg/03_reflection.py +386 -0
  50. nblade-0.1.2/examples/cg/04_interpolation.py +394 -0
  51. nblade-0.1.2/examples/physics/01_rigid_body.py +310 -0
  52. nblade-0.1.2/examples/physics/02_kepler_problem.py +425 -0
  53. nblade-0.1.2/examples/physics/03_electromagnetism.py +457 -0
  54. nblade-0.1.2/examples/tutorials/01_quickstart.py +176 -0
  55. nblade-0.1.2/examples/tutorials/02_basic_operations.py +321 -0
  56. nblade-0.1.2/examples/tutorials/03_vectors.py +317 -0
  57. nblade-0.1.2/examples/tutorials/04_dual_operations.py +441 -0
  58. nblade-0.1.2/examples/tutorials/05_rotations.py +340 -0
  59. nblade-0.1.2/examples/tutorials/06_reciprocal_frame.py +352 -0
  60. nblade-0.1.2/examples/tutorials/07_grade_operations.py +447 -0
  61. nblade-0.1.2/mkdocs.yml +127 -0
  62. nblade-0.1.2/pyproject.toml +72 -0
  63. nblade-0.1.2/python/nblade/__init__.py +213 -0
  64. nblade-0.1.2/python/nblade/_core.pyi +126 -0
  65. nblade-0.1.2/python/nblade/py.typed +0 -0
  66. nblade-0.1.2/python/pytest.ini +8 -0
  67. nblade-0.1.2/python/test_nblade.py +724 -0
  68. nblade-0.1.2/src/algebra_config.rs +437 -0
  69. nblade-0.1.2/src/basis/frame.rs +879 -0
  70. nblade-0.1.2/src/basis/grade.rs +150 -0
  71. nblade-0.1.2/src/basis/index.rs +343 -0
  72. nblade-0.1.2/src/basis/mod.rs +11 -0
  73. nblade-0.1.2/src/geometry/mod.rs +5 -0
  74. nblade-0.1.2/src/geometry/projection.rs +130 -0
  75. nblade-0.1.2/src/geometry/reflection.rs +119 -0
  76. nblade-0.1.2/src/geometry/rotation.rs +163 -0
  77. nblade-0.1.2/src/lib.rs +62 -0
  78. nblade-0.1.2/src/multiplication_table.rs +570 -0
  79. nblade-0.1.2/src/multivector/AGENTS.md +81 -0
  80. nblade-0.1.2/src/multivector/dense.rs +348 -0
  81. nblade-0.1.2/src/multivector/mod.rs +626 -0
  82. nblade-0.1.2/src/multivector/pool.rs +279 -0
  83. nblade-0.1.2/src/multivector/sparse.rs +694 -0
  84. nblade-0.1.2/src/operations/commutator.rs +98 -0
  85. nblade-0.1.2/src/operations/dual.rs +427 -0
  86. nblade-0.1.2/src/operations/inverse.rs +132 -0
  87. nblade-0.1.2/src/operations/involution.rs +520 -0
  88. nblade-0.1.2/src/operations/mod.rs +7 -0
  89. nblade-0.1.2/src/operations/norm.rs +343 -0
  90. nblade-0.1.2/src/products/geometric.rs +252 -0
  91. nblade-0.1.2/src/products/geometric_simd.rs +531 -0
  92. nblade-0.1.2/src/products/inner.rs +734 -0
  93. nblade-0.1.2/src/products/mod.rs +31 -0
  94. nblade-0.1.2/src/products/outer.rs +431 -0
  95. nblade-0.1.2/src/python/mod.rs +713 -0
  96. nblade-0.1.2/src/signature.rs +156 -0
  97. nblade-0.1.2/tests/test_arbitrary_dimension.rs +547 -0
  98. nblade-0.1.2/tests/test_property_based.proptest-regressions +9 -0
  99. nblade-0.1.2/tests/test_property_based.rs +1056 -0
  100. nblade-0.1.2/tests/test_python_api.py +491 -0
@@ -0,0 +1,104 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test-rust:
11
+ name: Rust Tests
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - name: Install Rust
17
+ uses: dtolnay/rust-toolchain@stable
18
+
19
+ - name: Cache cargo
20
+ uses: actions/cache@v4
21
+ with:
22
+ path: |
23
+ ~/.cargo/registry
24
+ ~/.cargo/git
25
+ target
26
+ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
27
+ restore-keys: |
28
+ ${{ runner.os }}-cargo-
29
+
30
+ - name: Run Rust tests
31
+ run: cargo test --lib --all-features
32
+
33
+ test-python:
34
+ name: Python Tests (${{ matrix.python-version }}, ${{ matrix.os }})
35
+ runs-on: ${{ matrix.os }}
36
+ needs: test-rust
37
+ strategy:
38
+ fail-fast: false
39
+ matrix:
40
+ os: [ubuntu-latest, macos-latest, windows-latest]
41
+ python-version: ["3.8", "3.10", "3.12"]
42
+ exclude:
43
+ - os: macos-latest
44
+ python-version: "3.8"
45
+ - os: windows-latest
46
+ python-version: "3.8"
47
+ steps:
48
+ - uses: actions/checkout@v4
49
+
50
+ - name: Install Rust
51
+ uses: dtolnay/rust-toolchain@stable
52
+
53
+ - name: Set up Python ${{ matrix.python-version }}
54
+ uses: actions/setup-python@v5
55
+ with:
56
+ python-version: ${{ matrix.python-version }}
57
+
58
+ - name: Install maturin
59
+ run: pip install maturin pytest numpy
60
+
61
+ - name: Build wheel (Unix)
62
+ if: runner.os != 'Windows'
63
+ run: |
64
+ python -m venv .venv
65
+ source .venv/bin/activate
66
+ maturin develop --release
67
+
68
+ - name: Build wheel (Windows)
69
+ if: runner.os == 'Windows'
70
+ shell: bash
71
+ run: |
72
+ python -m venv .venv
73
+ source .venv/Scripts/activate
74
+ maturin develop --release
75
+
76
+ - name: Run Python tests (Unix)
77
+ if: runner.os != 'Windows'
78
+ run: |
79
+ source .venv/bin/activate
80
+ pytest python/test_nblade.py -v
81
+
82
+ - name: Run Python tests (Windows)
83
+ if: runner.os == 'Windows'
84
+ shell: bash
85
+ run: |
86
+ source .venv/Scripts/activate
87
+ pytest python/test_nblade.py -v
88
+
89
+ lint:
90
+ name: Lint
91
+ runs-on: ubuntu-latest
92
+ steps:
93
+ - uses: actions/checkout@v4
94
+
95
+ - name: Install Rust
96
+ uses: dtolnay/rust-toolchain@stable
97
+ with:
98
+ components: rustfmt, clippy
99
+
100
+ - name: Check formatting
101
+ run: cargo fmt -- --check
102
+
103
+ - name: Clippy
104
+ run: cargo clippy --all-features -- -D warnings
@@ -0,0 +1,24 @@
1
+ name: Publish to Crates.io
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+
8
+ jobs:
9
+ publish:
10
+ name: Publish to Crates.io
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - name: Install Rust
16
+ uses: dtolnay/rust-toolchain@stable
17
+
18
+ - name: Publish to Crates.io
19
+ run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
20
+
21
+ - name: Verify publication
22
+ run: |
23
+ sleep 30
24
+ cargo search nblade | head -5
@@ -0,0 +1,95 @@
1
+ name: Publish to PyPI
2
+
3
+ on:
4
+ release:
5
+ types: [published] # Trigger on GitHub Release published
6
+ workflow_dispatch: # Manual trigger with input
7
+ inputs:
8
+ version:
9
+ description: 'Version to publish (e.g., 0.1.1)'
10
+ required: false
11
+
12
+ jobs:
13
+ build-wheels:
14
+ name: Build wheels on ${{ matrix.os }}
15
+ runs-on: ${{ matrix.os }}
16
+ strategy:
17
+ fail-fast: false
18
+ matrix:
19
+ os: [ubuntu-latest, macos-latest, windows-latest]
20
+ python-version: ["3.8", "3.10", "3.12"]
21
+ steps:
22
+ - uses: actions/checkout@v4
23
+
24
+ - name: Install Rust
25
+ uses: dtolnay/rust-toolchain@stable
26
+
27
+ - name: Set up Python
28
+ uses: actions/setup-python@v5
29
+ with:
30
+ python-version: ${{ matrix.python-version }}
31
+
32
+ - name: Build wheels
33
+ uses: PyO3/maturin-action@v1
34
+ with:
35
+ command: build
36
+ args: --release --out dist
37
+ manylinux: auto
38
+
39
+ - name: Upload wheels
40
+ uses: actions/upload-artifact@v4
41
+ with:
42
+ name: wheels-${{ matrix.os }}-${{ matrix.python-version }}
43
+ path: dist
44
+
45
+ build-sdist:
46
+ name: Build source distribution
47
+ runs-on: ubuntu-latest
48
+ steps:
49
+ - uses: actions/checkout@v4
50
+
51
+ - name: Set up Python
52
+ uses: actions/setup-python@v5
53
+ with:
54
+ python-version: "3.10"
55
+
56
+ - name: Build sdist
57
+ run: |
58
+ pip install maturin
59
+ maturin sdist --out dist
60
+
61
+ - name: Upload sdist
62
+ uses: actions/upload-artifact@v4
63
+ with:
64
+ name: sdist
65
+ path: dist
66
+
67
+ publish:
68
+ name: Publish to PyPI
69
+ needs: [build-wheels, build-sdist]
70
+ runs-on: ubuntu-latest
71
+ permissions:
72
+ id-token: write
73
+ environment:
74
+ name: pypi
75
+ url: https://pypi.org/project/nblade/
76
+ steps:
77
+ - name: Download all artifacts
78
+ uses: actions/download-artifact@v4
79
+ with:
80
+ pattern: wheels-*
81
+ path: dist
82
+ merge-multiple: true
83
+
84
+ - name: Download sdist
85
+ uses: actions/download-artifact@v4
86
+ with:
87
+ name: sdist
88
+ path: dist
89
+
90
+ - name: List distributions
91
+ run: ls -la dist/
92
+
93
+ - name: Publish to PyPI
94
+ uses: pypa/gh-action-pypi-publish@release/v1
95
+ # Uses trusted publishing, no token needed
@@ -0,0 +1,90 @@
1
+ name: Publish to TestPyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*-test' # Only test tags like v0.1.1-test
7
+ workflow_dispatch: # Manual trigger
8
+
9
+ jobs:
10
+ build-wheels:
11
+ name: Build wheels on ${{ matrix.os }}
12
+ runs-on: ${{ matrix.os }}
13
+ strategy:
14
+ fail-fast: false
15
+ matrix:
16
+ os: [ubuntu-latest, macos-latest, windows-latest]
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Install Rust
21
+ uses: dtolnay/rust-toolchain@stable
22
+
23
+ - name: Set up Python
24
+ uses: actions/setup-python@v5
25
+ with:
26
+ python-version: "3.10"
27
+
28
+ - name: Build wheels
29
+ uses: PyO3/maturin-action@v1
30
+ with:
31
+ command: build
32
+ args: --release --out dist
33
+ manylinux: auto
34
+
35
+ - name: Upload wheels
36
+ uses: actions/upload-artifact@v4
37
+ with:
38
+ name: wheels-${{ matrix.os }}
39
+ path: dist
40
+
41
+ build-sdist:
42
+ name: Build source distribution
43
+ runs-on: ubuntu-latest
44
+ steps:
45
+ - uses: actions/checkout@v4
46
+
47
+ - name: Set up Python
48
+ uses: actions/setup-python@v5
49
+ with:
50
+ python-version: "3.10"
51
+
52
+ - name: Build sdist
53
+ run: |
54
+ pip install maturin
55
+ maturin sdist --out dist
56
+
57
+ - name: Upload sdist
58
+ uses: actions/upload-artifact@v4
59
+ with:
60
+ name: sdist
61
+ path: dist
62
+
63
+ publish:
64
+ name: Publish to TestPyPI
65
+ needs: [build-wheels, build-sdist]
66
+ runs-on: ubuntu-latest
67
+ permissions:
68
+ id-token: write
69
+ steps:
70
+ - name: Download wheels
71
+ uses: actions/download-artifact@v4
72
+ with:
73
+ pattern: wheels-*
74
+ path: dist
75
+ merge-multiple: true
76
+
77
+ - name: Download sdist
78
+ uses: actions/download-artifact@v4
79
+ with:
80
+ name: sdist
81
+ path: dist
82
+
83
+ - name: List distributions
84
+ run: ls -la dist/
85
+
86
+ - name: Publish to TestPyPI
87
+ uses: pypa/gh-action-pypi-publish@release/v1
88
+ with:
89
+ repository-url: https://test.pypi.org/legacy/
90
+ skip-existing: true
@@ -0,0 +1,30 @@
1
+ name: Release Please
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ permissions:
9
+ contents: write
10
+ pull-requests: write
11
+
12
+ jobs:
13
+ release-please:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: googleapis/release-please-action@v4
17
+ with:
18
+ token: ${{ secrets.GITHUB_TOKEN }}
19
+ release-type: rust
20
+ package-name: nblade
21
+ changelog-types: |
22
+ [
23
+ {"type":"feat","section":"Features","hidden":false},
24
+ {"type":"fix","section":"Bug Fixes","hidden":false},
25
+ {"type":"chore","section":"Miscellaneous","hidden":false},
26
+ {"type":"docs","section":"Documentation","hidden":false},
27
+ {"type":"perf","section":"Performance","hidden":false},
28
+ {"type":"refactor","section":"Refactoring","hidden":false},
29
+ {"type":"test","section":"Tests","hidden":false}
30
+ ]
@@ -0,0 +1,60 @@
1
+ # Rust build artifacts
2
+ /target/
3
+
4
+ # Python
5
+ __pycache__/
6
+ *.py[cod]
7
+ *$py.class
8
+ *.so
9
+ .Python
10
+ build/
11
+ develop-eggs/
12
+ dist/
13
+ downloads/
14
+ eggs/
15
+ .eggs/
16
+ lib/
17
+ lib64/
18
+ parts/
19
+ sdist/
20
+ var/
21
+ wheels/
22
+ *.egg-info/
23
+ .installed.cfg
24
+ *.egg
25
+
26
+ # Virtual environments
27
+ venv/
28
+ ENV/
29
+ env/
30
+ .venv/
31
+
32
+ # Testing
33
+ .pytest_cache/
34
+ .coverage
35
+ htmlcov/
36
+ lcov.info
37
+
38
+ # IDE
39
+ .vscode/
40
+ .idea/
41
+ *.swp
42
+ *.swo
43
+ *~
44
+
45
+ # Linter/formatter caches
46
+ .ruff_cache/
47
+ .mypy_cache/
48
+
49
+ # Project-specific
50
+ .sisyphus/
51
+ .lingma/
52
+ .archive/
53
+
54
+ # Development notes
55
+ full_zh.md
56
+ summary.md
57
+
58
+ # OS
59
+ .DS_Store
60
+ Thumbs.db
@@ -0,0 +1,20 @@
1
+ # Read the Docs configuration file
2
+ # See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
3
+
4
+ # Required
5
+ version: 2
6
+
7
+ # Set the OS, Python version, and other tools you might need
8
+ build:
9
+ os: ubuntu-24.04
10
+ tools:
11
+ python: "3.13"
12
+
13
+ # Build documentation with Mkdocs
14
+ mkdocs:
15
+ configuration: mkdocs.yml
16
+
17
+ # Python requirements for building documentation
18
+ python:
19
+ install:
20
+ - requirements: docs/requirements.txt
@@ -0,0 +1,10 @@
1
+ {
2
+ "packages": {
3
+ ".": {
4
+ "release-type": "rust",
5
+ "package-name": "nblade",
6
+ "changelog-path": "CHANGELOG.md"
7
+ }
8
+ },
9
+ "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
10
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.1.2"
3
+ }
nblade-0.1.2/AGENTS.md ADDED
@@ -0,0 +1,159 @@
1
+ # NBLADE PROJECT KNOWLEDGE BASE
2
+
3
+ **Generated:** 2026-03-22T12:00:00+08:00
4
+ **Stack:** Rust 2021 Edition + Python 3.8+ (PyO3/maturin)
5
+
6
+ ## OVERVIEW
7
+
8
+ nblade (N-dimensional Blade) - High-performance Geometric Algebra library for arbitrary dimensions (up to 64D). Supports any metric signature G(p,q,r) with dense/sparse multivector representations and parallel computation via rayon.
9
+
10
+ ## STRUCTURE
11
+
12
+ ```
13
+ nblade/
14
+ ├── src/
15
+ │ ├── lib.rs # Entry point, public API, prelude
16
+ │ ├── signature.rs # Metric signature (p,q,r)
17
+ │ ├── algebra_config.rs # Algebra configuration (Arc-shared)
18
+ │ ├── multiplication_table.rs # Precomputed tables (rayon parallel)
19
+ │ ├── basis/ # Bitwise basis index operations
20
+ │ ├── multivector/ # Dense/Sparse multivector types (CORE)
21
+ │ ├── products/ # Geometric, outer, inner products
22
+ │ ├── operations/ # Involution, dual, inverse, norm
23
+ │ ├── geometry/ # Projection, rotation, reflection
24
+ │ └── python/ # PyO3 bindings (feature-gated)
25
+ ├── tests/ # Integration tests
26
+ ├── benches/ # Criterion benchmarks
27
+ ├── python/ # Python package (nblade)
28
+ ├── examples/ # Tutorial and application examples
29
+ │ ├── tutorials/ # Basic tutorials
30
+ │ ├── physics/ # Physics applications
31
+ │ └── cg/ # Computer graphics examples
32
+ └── docs/ # MkDocs documentation
33
+ ├── zh/ # Chinese documentation
34
+ └── en/ # English documentation
35
+ ```
36
+
37
+ ## WHERE TO LOOK
38
+
39
+ | Task | Location | Notes |
40
+ |------|----------|-------|
41
+ | Create multivector | `src/multivector/mod.rs` | `MultiVector::basis_vector()`, `from_coefficients()` |
42
+ | Geometric product | `src/products/geometric.rs` | Uses precomputed tables |
43
+ | Basis operations | `src/basis/index.rs` | Bitwise encoding, sign calculations |
44
+ | Metric signatures | `src/signature.rs` | Euclidean, spacetime, custom |
45
+ | Thread sharing | `src/algebra_config.rs` | `AlgebraConfigRef = Arc<AlgebraConfig>` |
46
+ | Python bindings | `src/python/mod.rs` | Feature `python` required |
47
+ | Tests | `tests/test_arbitrary_dimension.rs` | 19 tests, 1D-16D coverage |
48
+ | Benchmarks | `benches/geometric_product.rs` | Criterion, 3D and 5D |
49
+ | Volume element | `src/algebra_config.rs` | `volume_element()`, `volume_element_squared()`, `volume_element_inverse()` |
50
+ | Reciprocal frame | `src/basis/frame.rs` | `reciprocal_frame()`, `verify_reciprocal_frame()`, `metric_tensor()` |
51
+ | Basis expansion | `src/basis/frame.rs` | `basis_expansion()`, `basis_reconstruction()` |
52
+ | Dual operations | `src/operations/dual.rs` | `dual()`, `inverse_dual()` |
53
+
54
+ ## CODE MAP
55
+
56
+ | Symbol | Type | Location | Role |
57
+ |--------|------|----------|------|
58
+ | `MultiVector` | Enum | `src/multivector/mod.rs` | Core type, 40+ operations |
59
+ | `DenseMultiVector` | Struct | `src/multivector/dense.rs` | ndarray-backed, all 2^n coeffs |
60
+ | `SparseMultiVector` | Struct | `src/multivector/sparse.rs` | HashMap-backed, <10% density |
61
+ | `Signature` | Struct | `src/signature.rs` | Metric (p,q,r), basis squares |
62
+ | `AlgebraConfig` | Struct | `src/algebra_config.rs` | Dimension, signature, metric factors |
63
+ | `BasisIndex` | Type | `src/basis/index.rs` | `u64` for up to 64 dimensions |
64
+ | `MultiplicationTables` | Struct | `src/multiplication_table.rs` | Precomputed lookup tables |
65
+ | `reciprocal_frame` | Function | `src/basis/frame.rs` | Compute reciprocal frame vectors |
66
+ | `verify_reciprocal_frame` | Function | `src/basis/frame.rs` | Verify aⁱ⌋aⱼ = δⁱⱼ |
67
+ | `metric_tensor` | Function | `src/basis/frame.rs` | Compute metric tensor g_ij |
68
+ | `basis_expansion` | Function | `src/basis/frame.rs` | Expand multivector in basis |
69
+ | `basis_reconstruction` | Function | `src/basis/frame.rs` | Reconstruct from coefficients |
70
+
71
+ ## CONVENTIONS
72
+
73
+ **Basis Index Encoding:**
74
+ ```rust
75
+ // Bitwise: bit i set = includes e_i
76
+ // 0b00101 = e1∧e3, 0b111 = e1∧e2∧e3
77
+ let index: BasisIndex = 0b101; // e1∧e3
78
+ ```
79
+
80
+ **Auto Dense/Sparse Selection:**
81
+ ```rust
82
+ // Density < 10% → Sparse, else Dense
83
+ const SPARSE_THRESHOLD: f64 = 0.1;
84
+ ```
85
+
86
+ **Zero Tolerance:**
87
+ ```rust
88
+ const EPSILON: f64 = 1e-15; // Used throughout for is_zero(), filtering
89
+ ```
90
+
91
+ **Test Config Pattern (repeated in 13 files):**
92
+ ```rust
93
+ fn test_config() -> AlgebraConfigRef {
94
+ Arc::new(AlgebraConfig::euclidean(3))
95
+ }
96
+ ```
97
+
98
+ **Float Assertions:**
99
+ ```rust
100
+ assert!((value - expected).abs() < 1e-10); // Never assert_eq! for floats
101
+ ```
102
+
103
+ ## ANTI-PATTERNS (THIS PROJECT)
104
+
105
+ - **No traits** — Uses concrete types and enum dispatch (MultiVector)
106
+ - **Chinese comments** — Docstrings in Chinese throughout
107
+ - **Manual Send/Sync** — `unsafe impl Send/Sync for AlgebraConfig` (lines 144-145 in algebra_config.rs)
108
+ - **No CI/CD** — Zero workflow files, Makefile, or justfile
109
+
110
+ ## UNIQUE STYLES
111
+
112
+ **Module Re-exports:**
113
+ ```rust
114
+ // basis/mod.rs - wildcard re-export pattern
115
+ pub use index::*;
116
+ pub use grade::*;
117
+ ```
118
+
119
+ **Prelude Module:**
120
+ ```rust
121
+ pub mod prelude {
122
+ pub use crate::Signature;
123
+ pub use crate::AlgebraConfig;
124
+ pub use crate::MultiVector;
125
+ pub use crate::basis::grade_of_index;
126
+ pub use crate::basis::index::index_to_string;
127
+ }
128
+ ```
129
+
130
+ **Dual Crate Type:**
131
+ ```toml
132
+ # Cargo.toml
133
+ crate-type = ["cdylib", "rlib"] # Python extension + Rust library
134
+ ```
135
+
136
+ ## COMMANDS
137
+
138
+ ```bash
139
+ # Build
140
+ cargo build [--release]
141
+
142
+ # Test
143
+ cargo test --all-features
144
+
145
+ # Benchmark
146
+ cargo bench
147
+
148
+ # Python wheel (requires maturin)
149
+ maturin develop
150
+ maturin build --release
151
+ ```
152
+
153
+ ## NOTES
154
+
155
+ - **Max dimension: 64** (BasisIndex = u64)
156
+ - **No git history** — Fresh repo or squashed
157
+ - **Empty `src/utils/`** directory exists but unused
158
+ - **Python feature default ON** — `default = ["python"]`
159
+ - **Release profile:** LTO enabled, single codegen unit for optimization
@@ -0,0 +1,38 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.2] - 2026-03-23
11
+
12
+ ### Features
13
+ - Added comprehensive examples: spacetime algebra, conformal GA, electromagnetism, rotor interpolation
14
+ - Added Chinese documentation (zh-cn)
15
+ - Added CONTRIBUTING.md with bilingual guidelines
16
+ - Added separate CI workflows for TestPyPI, PyPI, and Crates.io publishing
17
+
18
+ ### Documentation
19
+ - Reorganized docs structure for i18n support
20
+ - Added zh-cn/index.md as Chinese landing page
21
+
22
+ ### Bug Fixes
23
+ - Fixed ReadTheDocs build configuration
24
+ - Fixed mkdocs i18n language code (zh → zh-cn)
25
+
26
+ ## [0.1.1] - 2026-03-22
27
+
28
+ ### Features
29
+ - Initial release with core geometric algebra operations
30
+ - Python bindings via PyO3
31
+ - Support for arbitrary dimensions (up to 64D)
32
+ - Support for arbitrary metric signatures G(p, q, r)
33
+ - Dense and sparse multivector representations
34
+ - NumPy integration
35
+
36
+ [Unreleased]: https://github.com/UynajGI/nblade/compare/v0.1.2...HEAD
37
+ [0.1.2]: https://github.com/UynajGI/nblade/compare/v0.1.1...v0.1.2
38
+ [0.1.1]: https://github.com/UynajGI/nblade/releases/tag/v0.1.1