Mon, 21 Oct 2024 10:02:57 -0500
A simple test
4 | 1 | |
2 | // We use unicode. We would like to use much more of it than Rust allows. | |
3 | // Live with it. Embrace it. | |
4 | #![allow(uncommon_codepoints)] | |
5 | #![allow(mixed_script_confusables)] | |
6 | #![allow(confusable_idents)] | |
1 | 7 | |
7 | 8 | use dist::DistToSquaredDiv2; |
9 | use fb::forward_backward; | |
10 | use manifold::EmbeddedManifoldPoint; | |
11 | ||
1 | 12 | mod manifold; |
4 | 13 | mod fb; |
1 | 14 | mod cube; |
5 | 15 | mod dist; |
6
df9628092285
Add a zero function on manifolds
Tuomo Valkonen <tuomov@iki.fi>
parents:
5
diff
changeset
|
16 | mod zero; |
1 | 17 | |
18 | fn main() { | |
7 | 19 | simple_test() |
20 | } | |
1 | 21 | |
7 | 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̂); | |
1 | 49 | } |