Skip to content

Commit

Permalink
chore: update to simba 0.9 (#1415)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebcrozet authored Jun 22, 2024
1 parent f812694 commit 292abfb
Show file tree
Hide file tree
Showing 54 changed files with 331 additions and 362 deletions.
148 changes: 74 additions & 74 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[package]
name = "nalgebra"
name = "nalgebra"
version = "0.32.3"
authors = [ "Sébastien Crozet <[email protected]>" ]
authors = ["Sébastien Crozet <[email protected]>"]

description = "General-purpose linear algebra library with transformations and statically-sized or dynamically-sized matrices."
documentation = "https://www.nalgebra.org/docs"
homepage = "https://nalgebra.org"
repository = "https://github.com/dimforge/nalgebra"
readme = "README.md"
categories = [ "science", "mathematics", "wasm", "no-std" ]
keywords = [ "linear", "algebra", "matrix", "vector", "math" ]
categories = ["science", "mathematics", "wasm", "no-std"]
keywords = ["linear", "algebra", "matrix", "vector", "math"]
license = "Apache-2.0"
edition = "2018"
exclude = ["/ci/*", "/.travis.yml", "/Makefile"]
Expand All @@ -22,108 +22,108 @@ name = "nalgebra"
path = "src/lib.rs"

[features]
default = [ "std", "macros" ]
std = [ "matrixmultiply", "num-traits/std", "num-complex/std", "num-rational/std", "approx/std", "simba/std" ]
sparse = [ ]
debug = [ "approx/num-complex", "rand" ]
alloc = [ ]
io = [ "pest", "pest_derive" ]
compare = [ "matrixcompare-core" ]
libm = [ "simba/libm" ]
libm-force = [ "simba/libm_force" ]
macros = [ "nalgebra-macros" ]
default = ["std", "macros"]
std = ["matrixmultiply", "num-traits/std", "num-complex/std", "num-rational/std", "approx/std", "simba/std"]
sparse = []
debug = ["approx/num-complex", "rand"]
alloc = []
io = ["pest", "pest_derive"]
compare = ["matrixcompare-core"]
libm = ["simba/libm"]
libm-force = ["simba/libm_force"]
macros = ["nalgebra-macros"]


# Conversion
convert-mint = [ "mint" ]
convert-bytemuck = [ "bytemuck" ]
convert-glam014 = [ "glam014" ]
convert-glam015 = [ "glam015" ]
convert-glam016 = [ "glam016" ]
convert-glam017 = [ "glam017" ]
convert-glam018 = [ "glam018" ]
convert-glam019 = [ "glam019" ]
convert-glam020 = [ "glam020" ]
convert-glam021 = [ "glam021" ]
convert-glam022 = [ "glam022" ]
convert-glam023 = [ "glam023" ]
convert-glam024 = [ "glam024" ]
convert-glam025 = [ "glam025" ]
convert-glam027 = [ "glam027" ]
convert-glam028 = [ "glam028" ]
convert-mint = ["mint"]
convert-bytemuck = ["bytemuck"]
convert-glam014 = ["glam014"]
convert-glam015 = ["glam015"]
convert-glam016 = ["glam016"]
convert-glam017 = ["glam017"]
convert-glam018 = ["glam018"]
convert-glam019 = ["glam019"]
convert-glam020 = ["glam020"]
convert-glam021 = ["glam021"]
convert-glam022 = ["glam022"]
convert-glam023 = ["glam023"]
convert-glam024 = ["glam024"]
convert-glam025 = ["glam025"]
convert-glam027 = ["glam027"]
convert-glam028 = ["glam028"]

# Serialization
## To use serde in a #[no-std] environment, enable the
## `serde-serialize-no-std` feature instead of `serde-serialize`.
## Serialization of dynamically-sized matrices/vectors require
## `serde-serialize`.
serde-serialize-no-std = [ "serde", "num-complex/serde" ]
serde-serialize = [ "serde-serialize-no-std", "serde/std" ]
rkyv-serialize-no-std = [ "rkyv/size_32" ]
rkyv-serialize = [ "rkyv-serialize-no-std", "rkyv/std", "rkyv/validation" ]
serde-serialize-no-std = ["serde", "num-complex/serde"]
serde-serialize = ["serde-serialize-no-std", "serde/std"]
rkyv-serialize-no-std = ["rkyv/size_32"]
rkyv-serialize = ["rkyv-serialize-no-std", "rkyv/std", "rkyv/validation"]

# Randomness
## To use rand in a #[no-std] environment, enable the
## `rand-no-std` feature instead of `rand`.
rand-no-std = [ "rand-package" ]
rand = [ "rand-no-std", "rand-package/std", "rand-package/std_rng", "rand_distr" ]
rand-no-std = ["rand-package"]
rand = ["rand-no-std", "rand-package/std", "rand-package/std_rng", "rand_distr"]

# Tests
arbitrary = [ "quickcheck" ]
proptest-support = [ "proptest" ]
slow-tests = []
rkyv-safe-deser = [ "rkyv-serialize", "rkyv/validation" ]
arbitrary = ["quickcheck"]
proptest-support = ["proptest"]
slow-tests = []
rkyv-safe-deser = ["rkyv-serialize", "rkyv/validation"]

[dependencies]
nalgebra-macros = { version = "0.2.1", path = "nalgebra-macros", optional = true }
typenum = "1.12"
rand-package = { package = "rand", version = "0.8", optional = true, default-features = false }
num-traits = { version = "0.2", default-features = false }
num-complex = { version = "0.4", default-features = false }
num-rational = { version = "0.4", default-features = false }
approx = { version = "0.5", default-features = false }
simba = { version = "0.8", default-features = false }
alga = { version = "0.9", default-features = false, optional = true }
rand_distr = { version = "0.4", default-features = false, optional = true }
typenum = "1.12"
rand-package = { package = "rand", version = "0.8", optional = true, default-features = false }
num-traits = { version = "0.2", default-features = false }
num-complex = { version = "0.4", default-features = false }
num-rational = { version = "0.4", default-features = false }
approx = { version = "0.5", default-features = false }
simba = { version = "0.9", default-features = false }
alga = { version = "0.9", default-features = false, optional = true }
rand_distr = { version = "0.4", default-features = false, optional = true }
matrixmultiply = { version = "0.3", optional = true }
serde = { version = "1.0", default-features = false, features = [ "derive" ], optional = true }
rkyv = { version = "0.7.41", default-features = false, optional = true }
mint = { version = "0.5", optional = true }
quickcheck = { version = "1", optional = true }
pest = { version = "2", optional = true }
pest_derive = { version = "2", optional = true }
bytemuck = { version = "1.5", optional = true }
serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
rkyv = { version = "0.7.41", default-features = false, optional = true }
mint = { version = "0.5", optional = true }
quickcheck = { version = "1", optional = true }
pest = { version = "2", optional = true }
pest_derive = { version = "2", optional = true }
bytemuck = { version = "1.5", optional = true }
matrixcompare-core = { version = "0.1", optional = true }
proptest = { version = "1", optional = true, default-features = false, features = ["std"] }
glam014 = { package = "glam", version = "0.14", optional = true }
glam015 = { package = "glam", version = "0.15", optional = true }
glam016 = { package = "glam", version = "0.16", optional = true }
glam017 = { package = "glam", version = "0.17", optional = true }
glam018 = { package = "glam", version = "0.18", optional = true }
glam019 = { package = "glam", version = "0.19", optional = true }
glam020 = { package = "glam", version = "0.20", optional = true }
glam021 = { package = "glam", version = "0.21", optional = true }
glam022 = { package = "glam", version = "0.22", optional = true }
glam023 = { package = "glam", version = "0.23", optional = true }
glam024 = { package = "glam", version = "0.24", optional = true }
glam025 = { package = "glam", version = "0.25", optional = true }
glam027 = { package = "glam", version = "0.27", optional = true }
glam028 = { package = "glam", version = "0.28", optional = true }
rayon = { version = "1.6", optional = true }
proptest = { version = "1", optional = true, default-features = false, features = ["std"] }
glam014 = { package = "glam", version = "0.14", optional = true }
glam015 = { package = "glam", version = "0.15", optional = true }
glam016 = { package = "glam", version = "0.16", optional = true }
glam017 = { package = "glam", version = "0.17", optional = true }
glam018 = { package = "glam", version = "0.18", optional = true }
glam019 = { package = "glam", version = "0.19", optional = true }
glam020 = { package = "glam", version = "0.20", optional = true }
glam021 = { package = "glam", version = "0.21", optional = true }
glam022 = { package = "glam", version = "0.22", optional = true }
glam023 = { package = "glam", version = "0.23", optional = true }
glam024 = { package = "glam", version = "0.24", optional = true }
glam025 = { package = "glam", version = "0.25", optional = true }
glam027 = { package = "glam", version = "0.27", optional = true }
glam028 = { package = "glam", version = "0.28", optional = true }
rayon = { version = "1.6", optional = true }

[dev-dependencies]
serde_json = "1.0"
rand_xorshift = "0.3"
rand_isaac = "0.3"
criterion = { version = "0.4", features = ["html_reports"] }
nalgebra = { path = ".", features = ["debug", "compare", "rand", "macros"]}
nalgebra = { path = ".", features = ["debug", "compare", "rand", "macros"] }

# For matrix comparison macro
matrixcompare = "0.3.0"
itertools = "0.13"

[workspace]
members = [ "nalgebra-lapack", "nalgebra-glm", "nalgebra-sparse", "nalgebra-macros" ]
members = ["nalgebra-lapack", "nalgebra-glm", "nalgebra-sparse", "nalgebra-macros"]
resolver = "2"

[[example]]
Expand Down
30 changes: 15 additions & 15 deletions nalgebra-glm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,31 @@ documentation = "https://www.nalgebra.org/docs"
homepage = "https://nalgebra.org"
repository = "https://github.com/dimforge/nalgebra"
readme = "../README.md"
categories = [ "science", "mathematics", "wasm", "no standard library" ]
keywords = [ "linear", "algebra", "matrix", "vector", "math" ]
categories = ["science", "mathematics", "wasm", "no standard library"]
keywords = ["linear", "algebra", "matrix", "vector", "math"]
license = "Apache-2.0"
edition = "2018"

[badges]
maintenance = { status = "actively-developed" }

[features]
default = [ "std" ]
std = [ "nalgebra/std", "simba/std" ]
arbitrary = [ "nalgebra/arbitrary" ]
serde-serialize = [ "nalgebra/serde-serialize-no-std" ]
default = ["std"]
std = ["nalgebra/std", "simba/std"]
arbitrary = ["nalgebra/arbitrary"]
serde-serialize = ["nalgebra/serde-serialize-no-std"]

# Conversion
convert-mint = [ "nalgebra/mint" ]
convert-bytemuck = [ "nalgebra/bytemuck" ]
convert-glam014 = [ "nalgebra/glam014" ]
convert-glam015 = [ "nalgebra/glam015" ]
convert-glam016 = [ "nalgebra/glam016" ]
convert-glam017 = [ "nalgebra/glam017" ]
convert-glam018 = [ "nalgebra/glam018" ]
convert-mint = ["nalgebra/mint"]
convert-bytemuck = ["nalgebra/bytemuck"]
convert-glam014 = ["nalgebra/glam014"]
convert-glam015 = ["nalgebra/glam015"]
convert-glam016 = ["nalgebra/glam016"]
convert-glam017 = ["nalgebra/glam017"]
convert-glam018 = ["nalgebra/glam018"]

[dependencies]
num-traits = { version = "0.2", default-features = false }
approx = { version = "0.5", default-features = false }
simba = { version = "0.8", default-features = false }
nalgebra = { path = "..", version = "0.32", default-features = false }
simba = { version = "0.9", default-features = false }
nalgebra = { path = "..", version = "0.32", default-features = false }
14 changes: 7 additions & 7 deletions nalgebra-glm/src/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ use approx::AbsDiffEq;
use num::{Bounded, Signed};

use na::Scalar;
use simba::scalar::{ClosedAdd, ClosedMul, ClosedSub, RealField};
use simba::scalar::{ClosedAddAssign, ClosedMulAssign, ClosedSubAssign, RealField};

/// A number that can either be an integer or a float.
pub trait Number:
Scalar
+ Copy
+ PartialOrd
+ ClosedAdd
+ ClosedSub
+ ClosedMul
+ ClosedAddAssign
+ ClosedSubAssign
+ ClosedMulAssign
+ AbsDiffEq<Epsilon = Self>
+ Signed
+ Bounded
Expand All @@ -22,9 +22,9 @@ impl<
T: Scalar
+ Copy
+ PartialOrd
+ ClosedAdd
+ ClosedSub
+ ClosedMul
+ ClosedAddAssign
+ ClosedSubAssign
+ ClosedMulAssign
+ AbsDiffEq<Epsilon = Self>
+ Signed
+ Bounded,
Expand Down
2 changes: 1 addition & 1 deletion nalgebra-lapack/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ intel-mkl = ["lapack-src/intel-mkl"]
nalgebra = { version = "0.32", path = ".." }
num-traits = "0.2"
num-complex = { version = "0.4", default-features = false }
simba = "0.8"
simba = "0.9"
serde = { version = "1.0", features = ["derive"], optional = true }
lapack = { version = "0.19", default-features = false }
lapack-src = { version = "0.8", default-features = false }
Expand Down
14 changes: 7 additions & 7 deletions nalgebra-sparse/src/convert/impl_std_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::coo::CooMatrix;
use crate::csc::CscMatrix;
use crate::csr::CsrMatrix;
use nalgebra::storage::RawStorage;
use nalgebra::{ClosedAdd, DMatrix, Dim, Matrix, Scalar};
use nalgebra::{ClosedAddAssign, DMatrix, Dim, Matrix, Scalar};
use num_traits::Zero;

impl<'a, T, R, C, S> From<&'a Matrix<T, R, C, S>> for CooMatrix<T>
Expand All @@ -20,7 +20,7 @@ where

impl<'a, T> From<&'a CooMatrix<T>> for DMatrix<T>
where
T: Scalar + Zero + ClosedAdd,
T: Scalar + Zero + ClosedAddAssign,
{
fn from(coo: &'a CooMatrix<T>) -> Self {
convert_coo_dense(coo)
Expand All @@ -29,7 +29,7 @@ where

impl<'a, T> From<&'a CooMatrix<T>> for CsrMatrix<T>
where
T: Scalar + Zero + ClosedAdd,
T: Scalar + Zero + ClosedAddAssign,
{
fn from(matrix: &'a CooMatrix<T>) -> Self {
convert_coo_csr(matrix)
Expand All @@ -38,7 +38,7 @@ where

impl<'a, T> From<&'a CsrMatrix<T>> for CooMatrix<T>
where
T: Scalar + Zero + ClosedAdd,
T: Scalar + Zero + ClosedAddAssign,
{
fn from(matrix: &'a CsrMatrix<T>) -> Self {
convert_csr_coo(matrix)
Expand All @@ -59,7 +59,7 @@ where

impl<'a, T> From<&'a CsrMatrix<T>> for DMatrix<T>
where
T: Scalar + Zero + ClosedAdd,
T: Scalar + Zero + ClosedAddAssign,
{
fn from(matrix: &'a CsrMatrix<T>) -> Self {
convert_csr_dense(matrix)
Expand All @@ -68,7 +68,7 @@ where

impl<'a, T> From<&'a CooMatrix<T>> for CscMatrix<T>
where
T: Scalar + Zero + ClosedAdd,
T: Scalar + Zero + ClosedAddAssign,
{
fn from(matrix: &'a CooMatrix<T>) -> Self {
convert_coo_csc(matrix)
Expand Down Expand Up @@ -98,7 +98,7 @@ where

impl<'a, T> From<&'a CscMatrix<T>> for DMatrix<T>
where
T: Scalar + Zero + ClosedAdd,
T: Scalar + Zero + ClosedAddAssign,
{
fn from(matrix: &'a CscMatrix<T>) -> Self {
convert_csc_dense(matrix)
Expand Down
8 changes: 4 additions & 4 deletions nalgebra-sparse/src/convert/serial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use std::ops::Add;
use num_traits::Zero;

use nalgebra::storage::RawStorage;
use nalgebra::{ClosedAdd, DMatrix, Dim, Matrix, Scalar};
use nalgebra::{ClosedAddAssign, DMatrix, Dim, Matrix, Scalar};

use crate::coo::CooMatrix;
use crate::cs;
Expand Down Expand Up @@ -41,7 +41,7 @@ where
/// Converts a [`CooMatrix`] to a dense matrix.
pub fn convert_coo_dense<T>(coo: &CooMatrix<T>) -> DMatrix<T>
where
T: Scalar + Zero + ClosedAdd,
T: Scalar + Zero + ClosedAddAssign,
{
let mut output = DMatrix::repeat(coo.nrows(), coo.ncols(), T::zero());
for (i, j, v) in coo.triplet_iter() {
Expand Down Expand Up @@ -80,7 +80,7 @@ pub fn convert_csr_coo<T: Scalar>(csr: &CsrMatrix<T>) -> CooMatrix<T> {
/// Converts a [`CsrMatrix`] to a dense matrix.
pub fn convert_csr_dense<T>(csr: &CsrMatrix<T>) -> DMatrix<T>
where
T: Scalar + ClosedAdd + Zero,
T: Scalar + ClosedAddAssign + Zero,
{
let mut output = DMatrix::zeros(csr.nrows(), csr.ncols());

Expand Down Expand Up @@ -157,7 +157,7 @@ where
/// Converts a [`CscMatrix`] to a dense matrix.
pub fn convert_csc_dense<T>(csc: &CscMatrix<T>) -> DMatrix<T>
where
T: Scalar + ClosedAdd + Zero,
T: Scalar + ClosedAddAssign + Zero,
{
let mut output = DMatrix::zeros(csc.nrows(), csc.ncols());

Expand Down
Loading

0 comments on commit 292abfb

Please sign in to comment.