diff --git a/crates/argmin-math/Cargo.toml b/crates/argmin-math/Cargo.toml index 46de4d025..1382b9629 100644 --- a/crates/argmin-math/Cargo.toml +++ b/crates/argmin-math/Cargo.toml @@ -15,11 +15,18 @@ exclude = [] [dependencies] # nalgebra +nalgebra_0_33 = { package = "nalgebra", version = "0.33", optional = true } nalgebra_0_32 = { package = "nalgebra", version = "0.32", optional = true } nalgebra_0_31 = { package = "nalgebra", version = "0.31", optional = true } nalgebra_0_30 = { package = "nalgebra", version = "0.30", optional = true } nalgebra_0_29 = { package = "nalgebra", version = "0.29", optional = true } +# simba +simba_0_6 = { package = "simba", version = "0.6", optional = true } +simba_0_7 = { package = "simba", version = "0.7", optional = true } +simba_0_8 = { package = "simba", version = "0.8", optional = true } +simba_0_9 = { package = "simba", version = "0.9", optional = true } + # ndarray ## v0.15 ndarray_0_15 = { package = "ndarray", version = "0.15", optional = true } @@ -57,11 +64,12 @@ vec = ["primitives", "num-complex_0_4"] # nalgebra nalgebra_all = ["primitives"] -nalgebra_latest = ["nalgebra_v0_32"] -nalgebra_v0_32 = ["nalgebra_0_32", "num-complex_0_4", "nalgebra_all"] -nalgebra_v0_31 = ["nalgebra_0_31", "num-complex_0_4", "nalgebra_all"] -nalgebra_v0_30 = ["nalgebra_0_30", "num-complex_0_4", "nalgebra_all"] -nalgebra_v0_29 = ["nalgebra_0_29", "num-complex_0_4", "nalgebra_all"] +nalgebra_latest = ["nalgebra_v0_33"] +nalgebra_v0_33 = ["nalgebra_0_33", "num-complex_0_4", "nalgebra_all", "simba_0_9"] +nalgebra_v0_32 = ["nalgebra_0_32", "num-complex_0_4", "nalgebra_all", "simba_0_8"] +nalgebra_v0_31 = ["nalgebra_0_31", "num-complex_0_4", "nalgebra_all", "simba_0_7"] +nalgebra_v0_30 = ["nalgebra_0_30", "num-complex_0_4", "nalgebra_all", "simba_0_7"] +nalgebra_v0_29 = ["nalgebra_0_29", "num-complex_0_4", "nalgebra_all", "simba_0_6"] # ndarray ndarray_all = ["primitives"] diff --git a/crates/argmin-math/src/lib.rs b/crates/argmin-math/src/lib.rs index b6cb9fcaf..396ddc17a 100644 --- a/crates/argmin-math/src/lib.rs +++ b/crates/argmin-math/src/lib.rs @@ -68,6 +68,7 @@ //! | Feature | Default | Comment | //! |------------------------|---------|------------------------------------------| //! | `nalgebra_latest` | no | latest supported version | +//! | `nalgebra_v0_33` | no | version 0.33 | //! | `nalgebra_v0_32` | no | version 0.32 | //! | `nalgebra_v0_31` | no | version 0.31 | //! | `nalgebra_v0_30` | no | version 0.30 | @@ -131,14 +132,69 @@ #![deny(clippy::float_cmp)] cfg_if::cfg_if! { - if #[cfg(feature = "nalgebra_0_32")] { + if #[cfg(feature = "nalgebra_0_33")] { + extern crate nalgebra_0_33 as nalgebra; + trait Allocator: nalgebra::allocator::Allocator + where + R: nalgebra::Dim, + C: nalgebra::Dim, + {} + impl Allocator for U + where + U: nalgebra::allocator::Allocator, + R: nalgebra::Dim, + C: nalgebra::Dim, + {} + trait SameShapeAllocator: nalgebra::allocator::SameShapeAllocator + where + R1: nalgebra::Dim, + C1: nalgebra::Dim, + R2: nalgebra::Dim, + C2: nalgebra::Dim, + nalgebra::constraint::ShapeConstraint: nalgebra::constraint::SameNumberOfRows + nalgebra::constraint::SameNumberOfColumns, + {} + impl SameShapeAllocator for U + where + U: nalgebra::allocator::SameShapeAllocator, + R1: nalgebra::Dim, + C1: nalgebra::Dim, + R2: nalgebra::Dim, + C2: nalgebra::Dim, + nalgebra::constraint::ShapeConstraint: nalgebra::constraint::SameNumberOfRows + nalgebra::constraint::SameNumberOfColumns, + {} + } else if #[cfg(feature = "nalgebra_0_32")] { extern crate nalgebra_0_32 as nalgebra; + use nalgebra::allocator::{Allocator, SameShapeAllocator}; } else if #[cfg(feature = "nalgebra_0_31")] { extern crate nalgebra_0_31 as nalgebra; + use nalgebra::allocator::{Allocator, SameShapeAllocator}; } else if #[cfg(feature = "nalgebra_0_30")] { extern crate nalgebra_0_30 as nalgebra; + use nalgebra::allocator::{Allocator, SameShapeAllocator}; } else if #[cfg(feature = "nalgebra_0_29")] { extern crate nalgebra_0_29 as nalgebra; + use nalgebra::allocator::{Allocator, SameShapeAllocator}; + } +} + +cfg_if::cfg_if! { + if #[cfg(feature = "simba_0_9")] { + extern crate simba_0_9 as simba; + use simba::scalar::{ + ClosedAddAssign as ClosedAdd, + ClosedSubAssign as ClosedSub, + ClosedDivAssign as ClosedDiv, + ClosedMulAssign as ClosedMul, + }; + } else if #[cfg(feature = "simba_0_8")] { + extern crate simba_0_8 as simba; + use simba::scalar::{ClosedAdd, ClosedSub, ClosedDiv, ClosedMul}; + } else if #[cfg(feature = "simba_0_7")] { + extern crate simba_0_7 as simba; + use simba::scalar::{ClosedAdd, ClosedSub, ClosedDiv, ClosedMul}; + } else if #[cfg(feature = "simba_0_6")] { + extern crate simba_0_6 as simba; + use simba::scalar::{ClosedAdd, ClosedSub, ClosedDiv, ClosedMul}; } } diff --git a/crates/argmin-math/src/nalgebra_m/add.rs b/crates/argmin-math/src/nalgebra_m/add.rs index ae91936b2..cf39f1ee0 100644 --- a/crates/argmin-math/src/nalgebra_m/add.rs +++ b/crates/argmin-math/src/nalgebra_m/add.rs @@ -5,17 +5,17 @@ // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. -use crate::ArgminAdd; +use crate::{Allocator, ArgminAdd, SameShapeAllocator}; +use crate::ClosedAdd; use nalgebra::{ base::{ - allocator::{Allocator, SameShapeAllocator}, constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}, dimension::Dim, storage::Storage, Scalar, }, - ClosedAdd, DefaultAllocator, Matrix, MatrixSum, OMatrix, + DefaultAllocator, Matrix, MatrixSum, OMatrix, }; impl ArgminAdd> for Matrix diff --git a/crates/argmin-math/src/nalgebra_m/conj.rs b/crates/argmin-math/src/nalgebra_m/conj.rs index f9b07350b..f8d02aa14 100644 --- a/crates/argmin-math/src/nalgebra_m/conj.rs +++ b/crates/argmin-math/src/nalgebra_m/conj.rs @@ -5,12 +5,9 @@ // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. -use crate::ArgminConj; +use crate::{Allocator, ArgminConj}; -use nalgebra::{ - base::{allocator::Allocator, dimension::Dim}, - DefaultAllocator, OMatrix, SimdComplexField, -}; +use nalgebra::{base::dimension::Dim, DefaultAllocator, OMatrix, SimdComplexField}; impl ArgminConj for OMatrix where diff --git a/crates/argmin-math/src/nalgebra_m/div.rs b/crates/argmin-math/src/nalgebra_m/div.rs index b42535adf..0073e1d40 100644 --- a/crates/argmin-math/src/nalgebra_m/div.rs +++ b/crates/argmin-math/src/nalgebra_m/div.rs @@ -5,17 +5,17 @@ // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. -use crate::ArgminDiv; +use crate::{Allocator, ArgminDiv, SameShapeAllocator}; +use crate::ClosedDiv; use nalgebra::{ base::{ - allocator::{Allocator, SameShapeAllocator}, constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}, dimension::Dim, storage::Storage, MatrixSum, Scalar, }, - ClosedDiv, DefaultAllocator, Matrix, OMatrix, + DefaultAllocator, Matrix, OMatrix, }; impl ArgminDiv> for Matrix diff --git a/crates/argmin-math/src/nalgebra_m/dot.rs b/crates/argmin-math/src/nalgebra_m/dot.rs index 2ab10ac5b..f6d6e3e24 100644 --- a/crates/argmin-math/src/nalgebra_m/dot.rs +++ b/crates/argmin-math/src/nalgebra_m/dot.rs @@ -5,19 +5,19 @@ // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. -use crate::ArgminDot; +use crate::{Allocator, ArgminDot}; use num_traits::{One, Zero}; +use crate::{ClosedAdd, ClosedMul}; use nalgebra::{ base::{ - allocator::Allocator, constraint::{AreMultipliable, DimEq, ShapeConstraint}, dimension::Dim, storage::Storage, Scalar, }, - ClosedAdd, ClosedMul, DefaultAllocator, Matrix, OMatrix, + DefaultAllocator, Matrix, OMatrix, }; impl ArgminDot, N> for Matrix diff --git a/crates/argmin-math/src/nalgebra_m/eye.rs b/crates/argmin-math/src/nalgebra_m/eye.rs index 9960c71ce..7b0a1e6e2 100644 --- a/crates/argmin-math/src/nalgebra_m/eye.rs +++ b/crates/argmin-math/src/nalgebra_m/eye.rs @@ -5,14 +5,11 @@ // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. -use crate::ArgminEye; +use crate::{Allocator, ArgminEye}; use num_traits::{One, Zero}; -use nalgebra::{ - base::{allocator::Allocator, dimension::Dim}, - DefaultAllocator, OMatrix, Scalar, -}; +use nalgebra::{base::dimension::Dim, DefaultAllocator, OMatrix, Scalar}; impl ArgminEye for OMatrix where diff --git a/crates/argmin-math/src/nalgebra_m/inv.rs b/crates/argmin-math/src/nalgebra_m/inv.rs index 04af64d17..0c4b47987 100644 --- a/crates/argmin-math/src/nalgebra_m/inv.rs +++ b/crates/argmin-math/src/nalgebra_m/inv.rs @@ -5,9 +5,9 @@ // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. -use crate::{ArgminInv, Error}; +use crate::{Allocator, ArgminInv, Error}; use nalgebra::{ - base::{allocator::Allocator, dimension::Dim, storage::Storage}, + base::{dimension::Dim, storage::Storage}, ComplexField, DefaultAllocator, OMatrix, SquareMatrix, }; use std::fmt; diff --git a/crates/argmin-math/src/nalgebra_m/minmax.rs b/crates/argmin-math/src/nalgebra_m/minmax.rs index fd223c36d..88b321217 100644 --- a/crates/argmin-math/src/nalgebra_m/minmax.rs +++ b/crates/argmin-math/src/nalgebra_m/minmax.rs @@ -5,11 +5,12 @@ // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. -use crate::ArgminMinMax; +use crate::{Allocator, ArgminMinMax}; +use crate::ClosedMul; use nalgebra::{ - base::{allocator::Allocator, dimension::Dim, Scalar}, - ClosedMul, DefaultAllocator, OMatrix, + base::{dimension::Dim, Scalar}, + DefaultAllocator, OMatrix, }; impl ArgminMinMax for OMatrix diff --git a/crates/argmin-math/src/nalgebra_m/mul.rs b/crates/argmin-math/src/nalgebra_m/mul.rs index d11735e79..be897e6e1 100644 --- a/crates/argmin-math/src/nalgebra_m/mul.rs +++ b/crates/argmin-math/src/nalgebra_m/mul.rs @@ -5,17 +5,17 @@ // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. -use crate::ArgminMul; +use crate::{Allocator, ArgminMul, SameShapeAllocator}; +use crate::ClosedMul; use nalgebra::{ base::{ - allocator::{Allocator, SameShapeAllocator}, constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}, dimension::Dim, storage::Storage, MatrixSum, Scalar, }, - ClosedMul, DefaultAllocator, Matrix, OMatrix, + DefaultAllocator, Matrix, OMatrix, }; impl ArgminMul> for Matrix diff --git a/crates/argmin-math/src/nalgebra_m/random.rs b/crates/argmin-math/src/nalgebra_m/random.rs index b9c7aea6d..6c6e478ae 100644 --- a/crates/argmin-math/src/nalgebra_m/random.rs +++ b/crates/argmin-math/src/nalgebra_m/random.rs @@ -7,10 +7,10 @@ use rand::{distributions::uniform::SampleUniform, Rng}; -use crate::ArgminRandom; +use crate::{Allocator, ArgminRandom}; use nalgebra::{ - base::{allocator::Allocator, dimension::Dim, Scalar}, + base::{dimension::Dim, Scalar}, DefaultAllocator, OMatrix, }; diff --git a/crates/argmin-math/src/nalgebra_m/signum.rs b/crates/argmin-math/src/nalgebra_m/signum.rs index 9ca7091ab..4b628ace8 100644 --- a/crates/argmin-math/src/nalgebra_m/signum.rs +++ b/crates/argmin-math/src/nalgebra_m/signum.rs @@ -5,12 +5,9 @@ // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. -use crate::ArgminSignum; +use crate::{Allocator, ArgminSignum}; -use nalgebra::{ - base::{allocator::Allocator, dimension::Dim}, - DefaultAllocator, OMatrix, SimdComplexField, -}; +use nalgebra::{base::dimension::Dim, DefaultAllocator, OMatrix, SimdComplexField}; impl ArgminSignum for OMatrix where diff --git a/crates/argmin-math/src/nalgebra_m/sub.rs b/crates/argmin-math/src/nalgebra_m/sub.rs index d12bad158..f48738e0c 100644 --- a/crates/argmin-math/src/nalgebra_m/sub.rs +++ b/crates/argmin-math/src/nalgebra_m/sub.rs @@ -7,11 +7,12 @@ use std::ops::Sub; -use crate::ArgminSub; +use crate::{Allocator, ArgminSub}; +use crate::ClosedSub; use nalgebra::{ - base::{allocator::Allocator, dimension::Dim, storage::Storage, Scalar}, - ClosedSub, DefaultAllocator, Matrix, OMatrix, + base::{dimension::Dim, storage::Storage, Scalar}, + DefaultAllocator, Matrix, OMatrix, }; impl ArgminSub> for Matrix diff --git a/crates/argmin-math/src/nalgebra_m/transpose.rs b/crates/argmin-math/src/nalgebra_m/transpose.rs index ac49f43bf..a336f2a7b 100644 --- a/crates/argmin-math/src/nalgebra_m/transpose.rs +++ b/crates/argmin-math/src/nalgebra_m/transpose.rs @@ -8,10 +8,10 @@ // Note: This is not really the preferred way I think. Maybe this should also be implemented for // ArrayViews, which would probably make it more efficient. -use crate::ArgminTranspose; +use crate::{Allocator, ArgminTranspose}; use nalgebra::{ - base::{allocator::Allocator, dimension::Dim, storage::Storage, Scalar}, + base::{dimension::Dim, storage::Storage, Scalar}, DefaultAllocator, Matrix, OMatrix, }; diff --git a/crates/argmin-math/src/nalgebra_m/zero.rs b/crates/argmin-math/src/nalgebra_m/zero.rs index 3a0b052b3..2e05c3dc7 100644 --- a/crates/argmin-math/src/nalgebra_m/zero.rs +++ b/crates/argmin-math/src/nalgebra_m/zero.rs @@ -5,14 +5,11 @@ // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according to those terms. -use crate::{ArgminZero, ArgminZeroLike}; +use crate::{Allocator, ArgminZero, ArgminZeroLike}; use num_traits::Zero; -use nalgebra::{ - base::{allocator::Allocator, dimension::Dim}, - DefaultAllocator, OMatrix, Scalar, -}; +use nalgebra::{base::dimension::Dim, DefaultAllocator, OMatrix, Scalar}; impl ArgminZeroLike for OMatrix where diff --git a/examples/gaussnewton_nalgebra/Cargo.toml b/examples/gaussnewton_nalgebra/Cargo.toml index b7234e85d..0faf487c6 100644 --- a/examples/gaussnewton_nalgebra/Cargo.toml +++ b/examples/gaussnewton_nalgebra/Cargo.toml @@ -9,4 +9,4 @@ publish = false argmin = { version = "*", path = "../../crates/argmin" } argmin-math = { version = "*", features = ["nalgebra_latest"], path = "../../crates/argmin-math" } argmin-observer-slog = { version = "*", path = "../../crates/argmin-observer-slog" } -nalgebra = "0.32.3" +nalgebra = "0.33.0" diff --git a/examples/lbfgs_nalgebra/Cargo.toml b/examples/lbfgs_nalgebra/Cargo.toml index 212e5163b..5a7ea1570 100644 --- a/examples/lbfgs_nalgebra/Cargo.toml +++ b/examples/lbfgs_nalgebra/Cargo.toml @@ -10,4 +10,4 @@ argmin = { version = "*", path = "../../crates/argmin" } argmin-math = { version = "*", features = ["nalgebra_latest"], path = "../../crates/argmin-math" } argmin-observer-slog = { version = "*", path = "../../crates/argmin-observer-slog" } argmin_testfunctions = { version = "*", path = "../../crates/argmin-testfunctions" } -nalgebra = "0.32.3" +nalgebra = "0.33.0" diff --git a/examples/particleswarm_nalgebra/Cargo.toml b/examples/particleswarm_nalgebra/Cargo.toml index 1cc59e647..a60ea273c 100644 --- a/examples/particleswarm_nalgebra/Cargo.toml +++ b/examples/particleswarm_nalgebra/Cargo.toml @@ -10,4 +10,4 @@ argmin = { version = "*", path = "../../crates/argmin" } argmin-math = { version = "*", features = ["nalgebra_latest"], path = "../../crates/argmin-math" } argmin-observer-slog = { version = "*", path = "../../crates/argmin-observer-slog" } argmin_testfunctions = { version = "*", path = "../../crates/argmin-testfunctions" } -nalgebra = { version = "0.32.3", features = ["serde-serialize"] } +nalgebra = { version = "0.33.0", features = ["serde-serialize"] }