Skip to content

Commit a1d5049

Browse files
authored
Merge pull request #63 from AdaWorldAPI/claude/transcode-deepnsm-rust-oNa1Z
chore: replace hand-rolled PHI/EULER_GAMMA with Rust 1.94 stdlib consts - spo_bundle.rs: PHI → std::f64::consts::GOLDEN_RATIO - compression_curves.rs: PHI → std::f64::consts::GOLDEN_RATIO - vml.rs: PHI → std::f64::consts::GOLDEN_RATIO - surround_metadata.rs: EULER_GAMMA → std::f64::consts::EULER_GAMMA - Cargo.toml: rust-version bumped from "1.64" to "1.94" gguf_indexer.rs already used GOLDEN_RATIO. Now the whole codebase is unified. https://claude.ai/code/session_01Y69Vnw751w75iVSBRws7o7
2 parents cde1fde + 02f4ade commit a1d5049

5 files changed

Lines changed: 7 additions & 9 deletions

File tree

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
name = "ndarray"
44
version = "0.17.2"
55
edition = "2021"
6-
rust-version = "1.64"
6+
rust-version = "1.94"
77
authors = [
88
"Ulrik Sverdrup \"bluss\"",
99
"Jim Turner"

src/hpc/compression_curves.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ impl ProductQuantizer {
257257
// Method 5: SPO Bundle (our method)
258258
// ============================================================================
259259

260-
const PHI: f64 = 1.618_033_988_749_895;
260+
const PHI: f64 = std::f64::consts::GOLDEN_RATIO;
261261

262262
const fn golden_shift(d: usize) -> usize {
263263
let raw = (d as f64 / (PHI * PHI)) as usize;

src/hpc/spo_bundle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
// Constants
1212
// ============================================================================
1313

14-
/// Golden ratio φ ≈ 1.618033988749895
15-
const PHI: f64 = 1.618_033_988_749_895;
14+
/// Golden ratio φ — Rust 1.94 stdlib constant.
15+
const PHI: f64 = std::f64::consts::GOLDEN_RATIO;
1616

1717
/// Compute golden shift for dimension d, ensuring odd (gcd=1 with power-of-2 d).
1818
/// floor(d / φ²), rounded to nearest odd.

src/hpc/surround_metadata.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ use super::fingerprint::Fingerprint;
1717
/// Golden angle in radians: 2π / φ² ≈ 2.39996...
1818
const GOLDEN_ANGLE: f64 = 2.399_963_229_728_653;
1919

20-
/// Euler-Mascheroni constant γ ≈ 0.5772...
21-
const EULER_GAMMA: f64 = 0.577_215_664_901_532_9;
20+
/// Euler-Mascheroni constant γ — Rust 1.94 stdlib constant.
21+
const EULER_GAMMA: f64 = std::f64::consts::EULER_GAMMA;
2222

2323
/// Bundle dimensionality: 8192 f64 values (must be even for Givens pairs)
2424
const D: usize = 8192;

src/hpc/vml.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,9 +466,7 @@ mod tests {
466466
fn test_f64_golden_step_hydration_cost() {
467467
use std::f64::consts;
468468
// Rust 1.94: std::f64::consts::PHI and GAMMA are stable.
469-
// On 1.93: define manually.
470-
#[allow(dead_code)]
471-
const PHI: f64 = 1.618033988749894848204586834365638118;
469+
const PHI: f64 = std::f64::consts::GOLDEN_RATIO;
472470

473471
// Simulate: 4096D f64 vector → Base17-style projection → hydration back
474472
let d = 4096usize;

0 commit comments

Comments
 (0)