Skip to content

Commit bb67fd6

Browse files
committed
refactor: rename phyllotactic-manifold -> fractal + fix pre-existing clippy/nostd
User-requested rename ("phyllotactic-manifold sounds way too weird"). Filesystem move + 6 reference site updates (root Cargo.toml dep, p64 dep, internal manifest name, bench import, p64_bridge.rs uses, COMPARISON.md). Workspace `members = ["crates/*"]` picks up the new path automatically. Also fixed pre-existing CI failures in this crate that were blocking PR #115: - clippy: replaced approx-constant literal `1.414_213_562_373_095_1` with `core::f64::consts::SQRT_2`; converted needless `for i in 0..N` index loops to `iter().enumerate()` + `iter_mut().enumerate()`; replaced redundant slice copy loop with `copy_from_slice`; removed unnecessary `as i8` self-cast; switched manual range checks to `RangeInclusive::contains`; promoted const-only assertion into a `const { assert!(..) }` block; collapsed redundant closures in bench helpers. - nostd: declared a `std` feature (default-on), added `#![cfg_attr(not(feature = "std"), no_std)]` plus `extern crate alloc` and `extern crate core as std` (mirroring ndarray's pattern); imported `alloc::vec::Vec` in `dead_zone`; added `libm` as a hard dep with thin `fsqrt` / `fpowi` polyfills gated on the `std` feature so the manifold geometry compiles on thumbv6m. Propagated the feature: ndarray's `std` feature now enables `fractal/std`, and both `ndarray -> fractal` and `p64 -> fractal` declare `default-features = false` so workspace nostd builds reach a no_std fractal. Note: the workspace nostd CI was already red on master due to unrelated issues in `p64` and the `constant_time_eq` transitive dep of blake3; those are out of scope for this PR. fractal itself now builds clean on thumbv6m-none-eabi standalone. No semantic changes to the crate's public API; consumer-facing re-exports remain identical (`p64_bridge::manifold_consts`, `fractal::seven_plus_one::nars_truth`). https://claude.ai/code/session_01NYGrxVopyszZYgLBxe4hgj
1 parent 8899961 commit bb67fd6

8 files changed

Lines changed: 167 additions & 164 deletions

File tree

COMPARISON.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
| Crate | Upstream | **Fork** | Detail |
187187
|-------|----------|----------|--------|
188188
| `crates/p64` | Not present | **P64** | Palette64 data structure — convergence highway between ndarray and lance-graph |
189-
| `crates/phyllotactic-manifold` | Not present | **Phyllotactic Manifold** | Golden-angle spiral geometry for uniform point distribution |
189+
| `crates/fractal` | Not present | **Phyllotactic Manifold** | Golden-angle spiral geometry for uniform point distribution |
190190

191191
## Burn Backend (20 ops files)
192192

Cargo.lock

Lines changed: 10 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ libc = { version = "0.2.82", optional = true }
5050
matrixmultiply = { version = "0.3.2", default-features = false, features=["cgemm"] }
5151
blake3 = "1"
5252
p64 = { path = "crates/p64" }
53-
phyllotactic-manifold = { path = "crates/phyllotactic-manifold" }
53+
fractal = { path = "crates/fractal", default-features = false }
5454

5555
serde = { version = "1.0", optional = true, default-features = false, features = ["alloc"] }
5656
rawpointer = { version = "0.2" }
@@ -81,7 +81,7 @@ blas = ["dep:cblas-sys", "dep:libc"]
8181

8282
serde = ["dep:serde"]
8383

84-
std = ["num-traits/std", "matrixmultiply/std"]
84+
std = ["num-traits/std", "matrixmultiply/std", "fractal/std"]
8585
rayon = ["dep:rayon", "std"]
8686

8787
matrixmultiply-threading = ["matrixmultiply/threading"]
Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
[package]
2-
name = "phyllotactic-manifold"
2+
name = "fractal"
33
version = "0.1.0"
44
edition = "2021"
55
rust-version = "1.94"
66
description = "7+1 phyllotactic SIMD manifold with Euler-gamma singularity correction"
77
license = "MIT OR Apache-2.0"
88

9+
[features]
10+
default = ["std"]
11+
std = []
12+
913
[dependencies]
14+
libm = { version = "0.2", default-features = false }
1015

1116
[dev-dependencies]
1217
criterion = { version = "0.5", features = ["html_reports"] }

crates/phyllotactic-manifold/benches/manifold_bench.rs renamed to crates/fractal/benches/manifold_bench.rs

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion};
2-
use phyllotactic_manifold::*;
2+
use fractal::*;
33

44
fn make_seeds(n: usize) -> Vec<[i8; 34]> {
55
let mut seeds = Vec::with_capacity(n);
66
for i in 0..n {
77
let mut seed = [0i8; 34];
88
seed[0] = (i % 128) as i8; // HEEL
99
seed[33] = ((i * 7) % 128) as i8; // GAMMA
10-
for j in 1..33 {
11-
seed[j] = ((i * 13 + j * 37) % 256) as i8;
10+
for (j, slot) in seed.iter_mut().enumerate().take(33).skip(1) {
11+
*slot = ((i * 13 + j * 37) % 256) as i8;
1212
}
1313
seeds.push(seed);
1414
}
@@ -59,10 +59,10 @@ fn bench_resonance(c: &mut Criterion) {
5959
let threshold = 1000.0;
6060

6161
// Pre-encode
62-
let flat8_enc: Vec<_> = seeds.iter().map(|s| flat8::encode(s)).collect();
63-
let spiral8_enc: Vec<_> = seeds.iter().map(|s| spiral8::encode(s)).collect();
64-
let spiral8g_enc: Vec<_> = seeds.iter().map(|s| spiral8_gamma::encode(s)).collect();
65-
let s7p1_enc: Vec<_> = seeds.iter().map(|s| seven_plus_one::encode(s)).collect();
62+
let flat8_enc: Vec<_> = seeds.iter().map(flat8::encode).collect();
63+
let spiral8_enc: Vec<_> = seeds.iter().map(spiral8::encode).collect();
64+
let spiral8g_enc: Vec<_> = seeds.iter().map(spiral8_gamma::encode).collect();
65+
let s7p1_enc: Vec<_> = seeds.iter().map(seven_plus_one::encode).collect();
6666

6767
let mut group = c.benchmark_group("resonance");
6868

@@ -85,11 +85,7 @@ fn bench_resonance(c: &mut Criterion) {
8585
group.bench_function("spiral8_gamma", |b| {
8686
b.iter(|| {
8787
for (x, y) in &spiral8g_enc {
88-
black_box(spiral8_gamma::resonance(
89-
black_box(x),
90-
black_box(y),
91-
threshold,
92-
));
88+
black_box(spiral8_gamma::resonance(black_box(x), black_box(y), threshold));
9389
}
9490
})
9591
});
@@ -107,7 +103,7 @@ fn bench_resonance(c: &mut Criterion) {
107103

108104
fn bench_clam48(c: &mut Criterion) {
109105
let seeds = make_seeds(1024);
110-
let manifolds: Vec<_> = seeds.iter().map(|s| seven_plus_one::encode(s)).collect();
106+
let manifolds: Vec<_> = seeds.iter().map(seven_plus_one::encode).collect();
111107

112108
c.bench_function("clam48_extraction", |b| {
113109
b.iter(|| {
@@ -123,8 +119,8 @@ fn bench_dead_zone(c: &mut Criterion) {
123119
let mut s = [0i8; 34];
124120
s[0] = 42;
125121
s[33] = 7;
126-
for i in 1..33 {
127-
s[i] = (i as i8).wrapping_mul(13).wrapping_add(37);
122+
for (i, slot) in s.iter_mut().enumerate().take(33).skip(1) {
123+
*slot = (i as i8).wrapping_mul(13).wrapping_add(37);
128124
}
129125
s
130126
};
@@ -151,12 +147,5 @@ fn bench_encode_scaling(c: &mut Criterion) {
151147
group.finish();
152148
}
153149

154-
criterion_group!(
155-
benches,
156-
bench_encode,
157-
bench_resonance,
158-
bench_clam48,
159-
bench_dead_zone,
160-
bench_encode_scaling,
161-
);
150+
criterion_group!(benches, bench_encode, bench_resonance, bench_clam48, bench_dead_zone, bench_encode_scaling,);
162151
criterion_main!(benches);

0 commit comments

Comments
 (0)