pub fn phi_quantized_decode(quantized: f64, n: usize) -> f64Expand description
Decode quantized φ-code
Examples found in repository?
examples/quantized_demo.rs (line 41)
29fn main() {
30 let (n, step) = parse_args();
31 let values = [-1000.0, -100.0, -1.0, 0.0, 1.0, 42.0, 123.456, 999.99];
32
33 println!("Quantized φ-memory demo (N = {}, step = {})\n", n, step);
34 println!(
35 "{:<10} {:>12} {:>12} {:>12}",
36 "w", "quantized", "recovered", "error"
37 );
38
39 for &w in &values {
40 let q = phi_quantized_encode(w, n, step);
41 let recon = phi_quantized_decode(q, n);
42 let err = (w - recon).abs();
43
44 println!(
45 "{:<10.3} {:>12.6} {:>12.6} {:>12.3e}",
46 w, q, recon, err
47 );
48 }
49}