dyna3/app-proto/examples/irisawa-hexlet.rs
Vectornaut 2c4fd39c1f refactor: Tidy up engine tests (#72)
### `zero_loss_test`
  - Drop the redundant type hint in the definition of `a`.

  ### `tangent_test_three_spheres`
  - Get the dimension from the expected basis, rather than putting it in by hand.

  ### `tangent_test_kaleidocycle`
  - Factor out the realization code, in the same style as `realize_irisawa_hexlet`.
  - Rename the `irisawa` submodule to `examples`.

  ### `frozen_entry_test`
  - Move up into the section for simpler tests, between `zero_loss_test` and `irisawa_hexlet_test`.

Co-authored-by: Aaron Fenyes <aaron.fenyes@fareycircles.ooo>
Reviewed-on: glen/dyna3#72
Reviewed-by: Glen Whitney <glen@nobody@nowhere.net>
Co-authored-by: Vectornaut <vectornaut@nobody@nowhere.net>
Co-committed-by: Vectornaut <vectornaut@nobody@nowhere.net>
2025-03-12 21:54:56 +00:00

25 lines
No EOL
1,012 B
Rust

use dyna3::engine::{Q, examples::realize_irisawa_hexlet};
fn main() {
const SCALED_TOL: f64 = 1.0e-12;
let (config, _, success, history) = realize_irisawa_hexlet(SCALED_TOL);
print!("\nCompleted Gram matrix:{}", config.tr_mul(&*Q) * &config);
if success {
println!("Target accuracy achieved!");
} else {
println!("Failed to reach target accuracy");
}
println!("Steps: {}", history.scaled_loss.len() - 1);
println!("Loss: {}", history.scaled_loss.last().unwrap());
if success {
println!("\nChain diameters:");
println!(" {} sun (given)", 1.0 / config[(3, 3)]);
for k in 4..9 {
println!(" {} sun", 1.0 / config[(3, k)]);
}
}
println!("\nStep │ Loss\n─────┼────────────────────────────────");
for (step, scaled_loss) in history.scaled_loss.into_iter().enumerate() {
println!("{:<4}{}", step, scaled_loss);
}
}