# HG changeset patch # User Tuomo Valkonen # Date 1734641732 18000 # Node ID 34f8ec6363684a9a835148876cdae03c9fdcfc18 # Parent 15f01efc034b046939f310fc0a924599c98ebd54 Update to current alg_tools diff -r 15f01efc034b -r 34f8ec636368 Cargo.lock --- a/Cargo.lock Sun Dec 15 01:10:52 2024 -0500 +++ b/Cargo.lock Thu Dec 19 15:55:32 2024 -0500 @@ -24,7 +24,6 @@ "colored", "cpu-time", "csv", - "either", "itertools 0.13.0", "nalgebra", "num", @@ -33,6 +32,7 @@ "rayon", "serde", "serde_json", + "simba", ] [[package]] diff -r 15f01efc034b -r 34f8ec636368 src/cube.rs --- a/src/cube.rs Sun Dec 15 01:10:52 2024 -0500 +++ b/src/cube.rs Thu Dec 19 15:55:32 2024 -0500 @@ -6,6 +6,7 @@ use serde::Serialize; use alg_tools::loc::Loc; use alg_tools::norms::{Norm, L2}; +use alg_tools::impl_basic_space; use crate::manifold::{EmbeddedManifoldPoint, FacedManifoldPoint, ManifoldPoint}; /// All the difference faces of a [`OnCube`]. @@ -359,6 +360,9 @@ } } +impl_basic_space!(OnCube); + + #[cfg(test)] mod tests { use super::*; diff -r 15f01efc034b -r 34f8ec636368 src/cylinder.rs --- a/src/cylinder.rs Sun Dec 15 01:10:52 2024 -0500 +++ b/src/cylinder.rs Thu Dec 19 15:55:32 2024 -0500 @@ -2,12 +2,13 @@ Implementation of the surface of a 3D cylinder as a [`ManifoldPoint`]. */ -use alg_tools::euclidean::{Euclidean, Dot}; +use alg_tools::euclidean::Euclidean; use serde_repr::*; use serde::{Serialize, Deserialize}; use alg_tools::loc::Loc; use alg_tools::norms::{Norm, L2}; use alg_tools::types::Float; +use alg_tools::impl_basic_space; use crate::manifold::{ManifoldPoint, EmbeddedManifoldPoint, FacedManifoldPoint}; use crate::newton::{newton_sym1x1, newton_sym2x2}; @@ -908,6 +909,8 @@ } } +impl_basic_space!(OnCylinder<'a> where 'a); + #[cfg(test)] mod tests { use super::*; @@ -1142,3 +1145,4 @@ } } } + diff -r 15f01efc034b -r 34f8ec636368 src/fb.rs --- a/src/fb.rs Sun Dec 15 01:10:52 2024 -0500 +++ b/src/fb.rs Thu Dec 19 15:55:32 2024 -0500 @@ -75,10 +75,12 @@ τ : f64, iterator : I ) -> M -where M : ManifoldPoint + EmbeddedManifoldPoint, - F : Desc + Mapping, - G : Prox + Mapping, - I : AlgIteratorFactory> { +where + M : ManifoldPoint + EmbeddedManifoldPoint, + F : Desc + Mapping, + G : Prox + Mapping, + I : AlgIteratorFactory> +{ // Closure that calculates current status let status = |x : &M| IterInfo { diff -r 15f01efc034b -r 34f8ec636368 src/main.rs --- a/src/main.rs Sun Dec 15 01:10:52 2024 -0500 +++ b/src/main.rs Thu Dec 19 15:55:32 2024 -0500 @@ -210,12 +210,14 @@ τ : f64, logmap : impl Fn(usize, IterInfo) -> I ) -> DynError -where M : ManifoldPoint - + EmbeddedManifoldPoint> - + FacedManifoldPoint, - F : Desc + Mapping, - G : Prox + Mapping, - I : Serialize { +where + M : ManifoldPoint + + EmbeddedManifoldPoint> + + FacedManifoldPoint, + F : Desc + Mapping, + G : Prox + Mapping, + I : Serialize +{ let mut logger = Logger::new(); let iter = AlgIteratorOptions{ diff -r 15f01efc034b -r 34f8ec636368 src/manifold.rs --- a/src/manifold.rs Sun Dec 15 01:10:52 2024 -0500 +++ b/src/manifold.rs Thu Dec 19 15:55:32 2024 -0500 @@ -4,9 +4,10 @@ use serde::Serialize; use alg_tools::euclidean::Euclidean; +use alg_tools::instance::{Space, BasicDecomposition}; /// A point on a manifold -pub trait ManifoldPoint : Clone + PartialEq { +pub trait ManifoldPoint : Space + Clone + PartialEq { // Type of tangent factors type Tangent : Euclidean + std::fmt::Debug + Serialize; diff -r 15f01efc034b -r 34f8ec636368 src/scaled.rs --- a/src/scaled.rs Sun Dec 15 01:10:52 2024 -0500 +++ b/src/scaled.rs Thu Dec 19 15:55:32 2024 -0500 @@ -2,7 +2,7 @@ Implementation of scaling of functions on a manifold by a scalar. */ -use alg_tools::mapping::{Mapping, Instance}; +use alg_tools::mapping::{Mapping, Instance, Space}; use crate::manifold::ManifoldPoint; use crate::fb::{Grad, Desc, Prox}; @@ -22,7 +22,7 @@ } } -impl> Mapping for Scaled< G> { +impl> Mapping for Scaled< G> { type Codomain = f64; fn apply>(&self, x : I) -> Self::Codomain {