diff --git a/.circleci/config.yml b/.circleci/config.yml index ee64d7717..b21798d97 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -47,10 +47,10 @@ jobs: - checkout - run: name: test - command: cargo test --all-features + command: cargo test --features arbitrary --features serde-serialize --features abomonation-serialize --features sparse --features debug --features io --features compare --features libm - run: name: test nalgebra-glm - command: cargo test -p nalgebra-glm --all-features + command: cargo test -p nalgebra-glm --features arbitrary --features serde-serialize --features abomonation-serialize --features sparse --features debug --features io --features compare --features libm build-wasm: executor: rust-executor steps: diff --git a/Cargo.toml b/Cargo.toml index 7ea6f8bad..6705c2225 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,13 +24,16 @@ default = [ "std" ] std = [ "matrixmultiply", "rand/std", "rand_distr", "simba/std" ] stdweb = [ "rand/stdweb" ] arbitrary = [ "quickcheck" ] -serde-serialize = [ "serde", "serde_derive", "num-complex/serde" ] +serde-serialize = [ "serde", "num-complex/serde" ] abomonation-serialize = [ "abomonation" ] sparse = [ ] debug = [ "approx/num-complex", "rand/std" ] alloc = [ ] io = [ "pest", "pest_derive" ] compare = [ "matrixcompare-core" ] +libm = [ "simba/libm" ] +libm-force = [ "simba/libm_force" ] + [dependencies] typenum = "1.11" @@ -40,12 +43,11 @@ num-traits = { version = "0.2", default-features = false } num-complex = { version = "0.2", default-features = false } num-rational = { version = "0.2", default-features = false } approx = { version = "0.3", default-features = false } -simba = { version = "0.1", default-features = false } +simba = { version = "0.2", default-features = false } alga = { version = "0.9", default-features = false, optional = true } rand_distr = { version = "0.2", optional = true } matrixmultiply = { version = "0.2", optional = true } -serde = { version = "1.0", optional = true } -serde_derive = { version = "1.0", optional = true } +serde = { version = "1.0", features = [ "derive" ], optional = true } abomonation = { version = "0.7", optional = true } mint = { version = "0.5", optional = true } quickcheck = { version = "0.9", optional = true } @@ -76,6 +78,3 @@ path = "benches/lib.rs" [profile.bench] lto = true - -#[patch.crates-io] -#simba = { path = "../simba" } \ No newline at end of file diff --git a/nalgebra-glm/Cargo.toml b/nalgebra-glm/Cargo.toml index b72e2988a..2bc296136 100644 --- a/nalgebra-glm/Cargo.toml +++ b/nalgebra-glm/Cargo.toml @@ -24,5 +24,5 @@ abomonation-serialize = [ "nalgebra/abomonation-serialize" ] [dependencies] num-traits = { version = "0.2", default-features = false } approx = { version = "0.3", default-features = false } -simba = { version = "0.1", default-features = false } +simba = { version = "0.2", default-features = false } nalgebra = { path = "..", version = "0.21", default-features = false } diff --git a/nalgebra-lapack/Cargo.toml b/nalgebra-lapack/Cargo.toml index b262e8b93..712c19e7c 100644 --- a/nalgebra-lapack/Cargo.toml +++ b/nalgebra-lapack/Cargo.toml @@ -26,7 +26,7 @@ intel-mkl = ["lapack-src/intel-mkl"] nalgebra = { version = "0.21", path = ".." } num-traits = "0.2" num-complex = { version = "0.2", default-features = false } -simba = "0.1" +simba = "0.2" serde = { version = "1.0", optional = true } serde_derive = { version = "1.0", optional = true } lapack = { version = "0.16", default-features = false } diff --git a/src/base/construction.rs b/src/base/construction.rs index ae8c10d49..f810acdf2 100644 --- a/src/base/construction.rs +++ b/src/base/construction.rs @@ -1011,6 +1011,14 @@ where N: Scalar + Zero + One, DefaultAllocator: Allocator, { + /// The column vector with `val` as its i-th component. + #[inline] + pub fn ith(i: usize, val: N) -> Self { + let mut res = Self::zeros(); + res[i] = val; + res + } + /// The column vector with a 1 as its first component, and zero elsewhere. #[inline] pub fn x() -> Self diff --git a/src/lib.rs b/src/lib.rs index 9db176bfd..681163340 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -90,11 +90,9 @@ an optimized set of tools for computer graphics and physics. Those features incl #[cfg(feature = "arbitrary")] extern crate quickcheck; -#[cfg(feature = "serde")] -extern crate serde; -#[cfg(feature = "serde")] +#[cfg(feature = "serde-serialize")] #[macro_use] -extern crate serde_derive; +extern crate serde; #[cfg(feature = "abomonation-serialize")] extern crate abomonation; diff --git a/src/linalg/mod.rs b/src/linalg/mod.rs index f96cef0c3..4a1edbcf6 100644 --- a/src/linalg/mod.rs +++ b/src/linalg/mod.rs @@ -5,6 +5,10 @@ mod bidiagonal; mod cholesky; mod convolution; mod determinant; +// FIXME: this should not be needed. However, the exp uses +// explicit float operations on `f32` and `f64`. We need to +// get rid of these to allow exp to be used on a no-std context. +#[cfg(feature = "std")] mod exp; mod full_piv_lu; pub mod givens; @@ -27,6 +31,7 @@ mod symmetric_tridiagonal; pub use self::bidiagonal::*; pub use self::cholesky::*; pub use self::convolution::*; +#[cfg(feature = "std")] pub use self::exp::*; pub use self::full_piv_lu::*; pub use self::hessenberg::*;