src/main.rs

changeset 7
8979a6638424
parent 6
df9628092285
child 9
0fa3ac0c248b
equal deleted inserted replaced
6:df9628092285 7:8979a6638424
2 // We use unicode. We would like to use much more of it than Rust allows. 2 // We use unicode. We would like to use much more of it than Rust allows.
3 // Live with it. Embrace it. 3 // Live with it. Embrace it.
4 #![allow(uncommon_codepoints)] 4 #![allow(uncommon_codepoints)]
5 #![allow(mixed_script_confusables)] 5 #![allow(mixed_script_confusables)]
6 #![allow(confusable_idents)] 6 #![allow(confusable_idents)]
7
8 use dist::DistToSquaredDiv2;
9 use fb::forward_backward;
10 use manifold::EmbeddedManifoldPoint;
7 11
8 mod manifold; 12 mod manifold;
9 mod fb; 13 mod fb;
10 mod cube; 14 mod cube;
11 mod dist; 15 mod dist;
12 mod zero; 16 mod zero;
13 17
14 fn main() { 18 fn main() {
19 simple_test()
20 }
15 21
22 fn simple_test() {
23 use cube::*;
24 use alg_tools::loc::Loc;
25 use Face::*;
26 use zero::ZeroFn;
27 use alg_tools::mapping::Sum;
28 use alg_tools::iterate::{AlgIteratorOptions, Verbose};
29
30 let points = [
31 OnCube::new(F1, Loc([0.5, 0.5])),
32 OnCube::new(F2, Loc([0.5, 0.5])),
33 OnCube::new(F4, Loc([0.1, 0.1])),
34 ];
35
36 //let x = points[0].clone();
37 let x = OnCube::new(F6, Loc([0.5, 0.5]));
38 let f = Sum::new(points.into_iter().map(DistToSquaredDiv2));
39 let g = ZeroFn::new();
40 let τ = 0.1;
41 let iter = AlgIteratorOptions{
42 max_iter : 100,
43 verbose_iter : Verbose::Every(1),
44 .. Default::default()
45 };
46
47 let x̂ = forward_backward(&f, &g, x, τ, iter);
48 println!("result = {}\n{:?}", x̂.embedded_coords(), &x̂);
16 } 49 }

mercurial