src/main.rs

changeset 7
8979a6638424
parent 6
df9628092285
child 9
0fa3ac0c248b
--- a/src/main.rs	Mon Oct 21 08:44:23 2024 -0500
+++ b/src/main.rs	Mon Oct 21 10:02:57 2024 -0500
@@ -5,6 +5,10 @@
 #![allow(mixed_script_confusables)]
 #![allow(confusable_idents)]
 
+use dist::DistToSquaredDiv2;
+use fb::forward_backward;
+use manifold::EmbeddedManifoldPoint;
+
 mod manifold;
 mod fb;
 mod cube;
@@ -12,5 +16,34 @@
 mod zero;
 
 fn main() {
+    simple_test()
+}
 
+fn simple_test() {
+    use cube::*;
+    use alg_tools::loc::Loc;
+    use Face::*;
+    use zero::ZeroFn;
+    use alg_tools::mapping::Sum;
+    use alg_tools::iterate::{AlgIteratorOptions, Verbose};
+    
+    let points = [
+        OnCube::new(F1, Loc([0.5, 0.5])),
+        OnCube::new(F2, Loc([0.5, 0.5])),
+        OnCube::new(F4, Loc([0.1, 0.1])),
+    ];
+
+    //let x = points[0].clone();
+    let x = OnCube::new(F6, Loc([0.5, 0.5]));
+    let f = Sum::new(points.into_iter().map(DistToSquaredDiv2));
+    let g = ZeroFn::new();
+    let τ = 0.1;
+    let iter = AlgIteratorOptions{
+        max_iter : 100,
+        verbose_iter : Verbose::Every(1),
+        .. Default::default()
+    };
+
+    let x̂ = forward_backward(&f, &g, x, τ, iter);
+    println!("result = {}\n{:?}", x̂.embedded_coords(), &x̂);
 }

mercurial