Compare commits

...

23 Commits

Author SHA1 Message Date
abdul124 dd00f9b460 src/lib: add features for non-std support 2024-07-18 14:19:11 +08:00
Sébastien Crozet 64e97c85d5
Release v0.32.6 2024-06-12 11:13:12 +02:00
Sébastien Crozet f8cb672280
Support conversion for glam 0.27 (#1390) 2024-06-12 11:11:53 +02:00
Sébastien Crozet 6b7305337f
Release v0.32.5 2024-03-28 15:30:06 +01:00
Sébastien Crozet 440d4a4681
chore: add comment providing details on the householder fix. 2024-03-28 15:07:05 +01:00
Vollkornaffe dd44414a8a chore: Add test that fails before fix 2024-03-08 18:19:41 +01:00
Vollkornaffe 4decc8003d fix: Normalize the column once more
The column may not be normalized if the `factor` is on a scale of 1e-40.
Possibly, f32 just runs out of precision.

There is likely a better solution to the problem.
2024-03-08 18:19:41 +01:00
Sébastien Crozet 4a5855a1c4
Merge pull request #1362 from dimforge/dev-0.32.4
Release v0.32.4
2024-02-19 11:00:54 +01:00
Sébastien Crozet e726b65fd7
Release v0.32.4 2024-02-19 10:55:01 +01:00
Sébastien Crozet 980dd68e68
Support Glam 0.25 type conversion 2024-02-19 10:53:08 +01:00
Sébastien Crozet d8ed277243
Merge pull request #1194 from dimforge/dev
Release v0.32.0
2023-01-14 17:52:41 +01:00
Sébastien Crozet 2adb4f0b26 Merge branch 'dev' 2022-10-09 22:16:43 +02:00
Sébastien Crozet 6eea643277
Merge pull request #1134 from dimforge/dev
Release v0.31.1
2022-07-31 10:01:46 +02:00
Sébastien Crozet b7d7b69777
Merge pull request #1104 from dimforge/dev
Release v0.31.0
2022-04-30 14:08:22 +02:00
Sébastien Crozet 7b6f4c6547
Merge pull request #1057 from dimforge/dev
Release v0.30.0
2022-01-02 15:40:03 +01:00
Sébastien Crozet e48169e234
Merge pull request #967 from dimforge/dev
Bump the version of nalgebra-glm, nalgebra-lapack, and nalgebra-sparse.
2021-08-08 18:08:25 +02:00
Sébastien Crozet fef43a6146
Merge pull request #966 from dimforge/dev
Release v0.29.0
2021-08-08 18:04:20 +02:00
Sébastien Crozet 944afe24e8
Merge pull request #945 from dimforge/dev
Release v0.28.0
2021-07-11 18:11:45 +02:00
Sébastien Crozet c04b087388
Merge pull request #901 from dimforge/dev
Release v0.27.0
2021-06-02 15:25:43 +02:00
Sébastien Crozet 156f292917
Merge pull request #869 from dimforge/dev
Release v0.26.0
2021-04-12 16:27:28 +02:00
Sébastien Crozet e9535d5cb5
Merge pull request #846 from dimforge/dev
Release v0.25.2
2021-03-06 14:17:31 +01:00
Sébastien Crozet e8fb1ab215
Merge pull request #842 from dimforge/dev
Release v0.25.1
2021-03-02 14:34:28 +01:00
Sébastien Crozet 39ef8b43cf
Merge pull request #839 from dimforge/dev
Release v0.25.0
2021-03-01 14:34:04 +01:00
8 changed files with 680 additions and 427 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,15 @@
[package] [package]
name = "nalgebra" name = "nalgebra"
version = "0.32.3" version = "0.32.6"
authors = [ "Sébastien Crozet <developer@crozet.re>" ] authors = ["Sébastien Crozet <developer@crozet.re>"]
description = "General-purpose linear algebra library with transformations and statically-sized or dynamically-sized matrices." description = "General-purpose linear algebra library with transformations and statically-sized or dynamically-sized matrices."
documentation = "https://www.nalgebra.org/docs" documentation = "https://www.nalgebra.org/docs"
homepage = "https://nalgebra.org" homepage = "https://nalgebra.org"
repository = "https://github.com/dimforge/nalgebra" repository = "https://github.com/dimforge/nalgebra"
readme = "README.md" readme = "README.md"
categories = [ "science", "mathematics", "wasm", "no-std" ] categories = ["science", "mathematics", "wasm", "no-std"]
keywords = [ "linear", "algebra", "matrix", "vector", "math" ] keywords = ["linear", "algebra", "matrix", "vector", "math"]
license = "BSD-3-Clause" license = "BSD-3-Clause"
edition = "2018" edition = "2018"
exclude = ["/ci/*", "/.travis.yml", "/Makefile"] exclude = ["/ci/*", "/.travis.yml", "/Makefile"]
@ -22,104 +22,108 @@ name = "nalgebra"
path = "src/lib.rs" path = "src/lib.rs"
[features] [features]
default = [ "std", "macros" ] default = ["std", "macros"]
std = [ "matrixmultiply", "simba/std" ] std = ["matrixmultiply", "simba/std"]
sparse = [ ] sparse = []
debug = [ "approx/num-complex", "rand" ] debug = ["approx/num-complex", "rand"]
alloc = [ ] alloc = []
io = [ "pest", "pest_derive" ] io = ["pest", "pest_derive"]
compare = [ "matrixcompare-core" ] compare = ["matrixcompare-core"]
libm = [ "simba/libm" ] libm = ["simba/libm"]
libm-force = [ "simba/libm_force" ] libm-force = ["simba/libm_force"]
macros = [ "nalgebra-macros" ] macros = ["nalgebra-macros"]
cuda = [ "cust_core", "simba/cuda" ] cuda = ["cust_core", "simba/cuda"]
# Conversion # Conversion
convert-mint = [ "mint" ] convert-mint = ["mint"]
convert-bytemuck = [ "bytemuck" ] convert-bytemuck = ["bytemuck"]
convert-glam014 = [ "glam014" ] convert-glam014 = ["glam014"]
convert-glam015 = [ "glam015" ] convert-glam015 = ["glam015"]
convert-glam016 = [ "glam016" ] convert-glam016 = ["glam016"]
convert-glam017 = [ "glam017" ] convert-glam017 = ["glam017"]
convert-glam018 = [ "glam018" ] convert-glam018 = ["glam018"]
convert-glam019 = [ "glam019" ] convert-glam019 = ["glam019"]
convert-glam020 = [ "glam020" ] convert-glam020 = ["glam020"]
convert-glam021 = [ "glam021" ] convert-glam021 = ["glam021"]
convert-glam022 = [ "glam022" ] convert-glam022 = ["glam022"]
convert-glam023 = [ "glam023" ] convert-glam023 = ["glam023"]
convert-glam024 = [ "glam024" ] convert-glam024 = ["glam024"]
convert-glam025 = ["glam025"]
convert-glam027 = ["glam027"]
# Serialization # Serialization
## To use serde in a #[no-std] environment, enable the ## To use serde in a #[no-std] environment, enable the
## `serde-serialize-no-std` feature instead of `serde-serialize`. ## `serde-serialize-no-std` feature instead of `serde-serialize`.
## Serialization of dynamically-sized matrices/vectors require ## Serialization of dynamically-sized matrices/vectors require
## `serde-serialize`. ## `serde-serialize`.
serde-serialize-no-std = [ "serde", "num-complex/serde" ] serde-serialize-no-std = ["serde", "num-complex/serde"]
serde-serialize = [ "serde-serialize-no-std", "serde/std" ] serde-serialize = ["serde-serialize-no-std", "serde/std"]
rkyv-serialize-no-std = [ "rkyv/size_32" ] rkyv-serialize-no-std = ["rkyv/size_32"]
rkyv-serialize = [ "rkyv-serialize-no-std", "rkyv/std", "rkyv/validation" ] rkyv-serialize = ["rkyv-serialize-no-std", "rkyv/std", "rkyv/validation"]
# Randomness # Randomness
## To use rand in a #[no-std] environment, enable the ## To use rand in a #[no-std] environment, enable the
## `rand-no-std` feature instead of `rand`. ## `rand-no-std` feature instead of `rand`.
rand-no-std = [ "rand-package" ] rand-no-std = ["rand-package"]
rand = [ "rand-no-std", "rand-package/std", "rand-package/std_rng", "rand_distr" ] rand = ["rand-no-std", "rand-package/std", "rand-package/std_rng", "rand_distr"]
# Tests # Tests
arbitrary = [ "quickcheck" ] arbitrary = ["quickcheck"]
proptest-support = [ "proptest" ] proptest-support = ["proptest"]
slow-tests = [] slow-tests = []
rkyv-safe-deser = [ "rkyv-serialize", "rkyv/validation" ] rkyv-safe-deser = ["rkyv-serialize", "rkyv/validation"]
[dependencies] [dependencies]
nalgebra-macros = { version = "0.2.1", path = "nalgebra-macros", optional = true } nalgebra-macros = { version = "0.2.1", path = "nalgebra-macros", optional = true }
typenum = "1.12" typenum = "1.12"
rand-package = { package = "rand", version = "0.8", optional = true, default-features = false } rand-package = { package = "rand", version = "0.8", optional = true, default-features = false }
num-traits = { version = "0.2", default-features = false } num-traits = { version = "0.2", default-features = false }
num-complex = { version = "0.4", default-features = false } num-complex = { version = "0.4", default-features = false }
num-rational = { version = "0.4", default-features = false } num-rational = { version = "0.4", default-features = false }
approx = { version = "0.5", default-features = false } approx = { version = "0.5", default-features = false }
simba = { version = "0.8", default-features = false } simba = { version = "0.8", default-features = false }
alga = { version = "0.9", default-features = false, optional = true } alga = { version = "0.9", default-features = false, optional = true }
rand_distr = { version = "0.4", default-features = false, optional = true } rand_distr = { version = "0.4", default-features = false, optional = true }
matrixmultiply = { version = "0.3", optional = true } matrixmultiply = { version = "0.3", optional = true }
serde = { version = "1.0", default-features = false, features = [ "derive" ], optional = true } serde = { version = "1.0", default-features = false, features = ["derive"], optional = true }
rkyv = { version = "0.7.41", default-features = false, optional = true } rkyv = { version = "0.7.41", default-features = false, optional = true }
mint = { version = "0.5", optional = true } mint = { version = "0.5", optional = true }
quickcheck = { version = "1", optional = true } quickcheck = { version = "1", optional = true }
pest = { version = "2", optional = true } pest = { version = "2", optional = true }
pest_derive = { version = "2", optional = true } pest_derive = { version = "2", optional = true }
bytemuck = { version = "1.5", optional = true } bytemuck = { version = "1.5", optional = true }
matrixcompare-core = { version = "0.1", optional = true } matrixcompare-core = { version = "0.1", optional = true }
proptest = { version = "1", optional = true, default-features = false, features = ["std"] } proptest = { version = "1", optional = true, default-features = false, features = ["std"] }
glam014 = { package = "glam", version = "0.14", optional = true } glam014 = { package = "glam", version = "0.14", optional = true }
glam015 = { package = "glam", version = "0.15", optional = true } glam015 = { package = "glam", version = "0.15", optional = true }
glam016 = { package = "glam", version = "0.16", optional = true } glam016 = { package = "glam", version = "0.16", optional = true }
glam017 = { package = "glam", version = "0.17", optional = true } glam017 = { package = "glam", version = "0.17", optional = true }
glam018 = { package = "glam", version = "0.18", optional = true } glam018 = { package = "glam", version = "0.18", optional = true }
glam019 = { package = "glam", version = "0.19", optional = true } glam019 = { package = "glam", version = "0.19", optional = true }
glam020 = { package = "glam", version = "0.20", optional = true } glam020 = { package = "glam", version = "0.20", optional = true }
glam021 = { package = "glam", version = "0.21", optional = true } glam021 = { package = "glam", version = "0.21", optional = true }
glam022 = { package = "glam", version = "0.22", optional = true } glam022 = { package = "glam", version = "0.22", optional = true }
glam023 = { package = "glam", version = "0.23", optional = true } glam023 = { package = "glam", version = "0.23", optional = true }
glam024 = { package = "glam", version = "0.24", optional = true } glam024 = { package = "glam", version = "0.24", optional = true }
cust_core = { version = "0.1", optional = true } glam025 = { package = "glam", version = "0.25", optional = true }
rayon = { version = "1.6", optional = true } glam027 = { package = "glam", version = "0.27", optional = true }
cust_core = { version = "0.1", optional = true }
rayon = { version = "1.6", optional = true }
[dev-dependencies] [dev-dependencies]
serde_json = "1.0" serde_json = "1.0"
rand_xorshift = "0.3" rand_xorshift = "0.3"
rand_isaac = "0.3" rand_isaac = "0.3"
criterion = { version = "0.4", features = ["html_reports"] } 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 # For matrix comparison macro
matrixcompare = "0.3.0" matrixcompare = "0.3.0"
itertools = "0.10" itertools = "0.10"
[workspace] [workspace]
members = [ "nalgebra-lapack", "nalgebra-glm", "nalgebra-sparse", "nalgebra-macros" ] members = ["nalgebra-lapack", "nalgebra-glm", "nalgebra-sparse", "nalgebra-macros"]
resolver = "2" resolver = "2"
[[example]] [[example]]

View File

@ -94,6 +94,7 @@ an optimized set of tools for computer graphics and physics. Those features incl
html_root_url = "https://docs.rs/nalgebra/0.25.0" html_root_url = "https://docs.rs/nalgebra/0.25.0"
)] )]
#![cfg_attr(not(feature = "std"), no_std)] #![cfg_attr(not(feature = "std"), no_std)]
#![feature(const_fn, extended_key_value_attributes, array_methods)]
/// Generates an appropriate deprecation note with a suggestion for replacement. /// Generates an appropriate deprecation note with a suggestion for replacement.
/// ///

View File

@ -34,6 +34,17 @@ pub fn reflection_axis_mut<T: ComplexField, D: Dim, S: StorageMut<T, D>>(
if !factor.is_zero() { if !factor.is_zero() {
column.unscale_mut(factor.sqrt()); column.unscale_mut(factor.sqrt());
// Normalize again, making sure the vector is unit-sized.
// If `factor` had a very small value, the first normalization
// (dividing by `factor.sqrt()`) might end up with a slightly
// non-unit vector (especially when using 32-bits float).
// Decompositions strongly rely on that unit-vector property,
// so we run a second normalization (that is much more numerically
// stable since the norm is close to 1) to ensure it has a unit
// size.
let _ = column.normalize_mut();
(-signed_norm, true) (-signed_norm, true)
} else { } else {
// TODO: not sure why we don't have a - sign here. // TODO: not sure why we don't have a - sign here.

View File

@ -20,3 +20,7 @@ mod v022;
mod v023; mod v023;
#[cfg(feature = "glam024")] #[cfg(feature = "glam024")]
mod v024; mod v024;
#[cfg(feature = "glam025")]
mod v025;
#[cfg(feature = "glam027")]
mod v027;

18
src/third_party/glam/v025/mod.rs vendored Normal file
View File

@ -0,0 +1,18 @@
#[path = "../common/glam_isometry.rs"]
mod glam_isometry;
#[path = "../common/glam_matrix.rs"]
mod glam_matrix;
#[path = "../common/glam_point.rs"]
mod glam_point;
#[path = "../common/glam_quaternion.rs"]
mod glam_quaternion;
#[path = "../common/glam_rotation.rs"]
mod glam_rotation;
#[path = "../common/glam_similarity.rs"]
mod glam_similarity;
#[path = "../common/glam_translation.rs"]
mod glam_translation;
#[path = "../common/glam_unit_complex.rs"]
mod glam_unit_complex;
pub(self) use glam025 as glam;

18
src/third_party/glam/v027/mod.rs vendored Normal file
View File

@ -0,0 +1,18 @@
#[path = "../common/glam_isometry.rs"]
mod glam_isometry;
#[path = "../common/glam_matrix.rs"]
mod glam_matrix;
#[path = "../common/glam_point.rs"]
mod glam_point;
#[path = "../common/glam_quaternion.rs"]
mod glam_quaternion;
#[path = "../common/glam_rotation.rs"]
mod glam_rotation;
#[path = "../common/glam_similarity.rs"]
mod glam_similarity;
#[path = "../common/glam_translation.rs"]
mod glam_translation;
#[path = "../common/glam_unit_complex.rs"]
mod glam_unit_complex;
pub(self) use glam027 as glam;

View File

@ -1,4 +1,4 @@
use na::DMatrix; use na::{DMatrix, Matrix3};
#[cfg(feature = "proptest-support")] #[cfg(feature = "proptest-support")]
mod proptest_tests { mod proptest_tests {
@ -116,6 +116,31 @@ fn symmetric_eigen_singular_24x24() {
); );
} }
// Test for #1368
#[test]
fn very_small_deviation_from_identity() {
let m = Matrix3::<f32>::new(
1.0,
3.1575704e-23,
8.1146196e-23,
3.1575704e-23,
1.0,
1.7471054e-22,
8.1146196e-23,
1.7471054e-22,
1.0,
);
for v in m
.try_symmetric_eigen(f32::EPSILON, 0)
.unwrap()
.eigenvalues
.into_iter()
{
assert_relative_eq!(*v, 1.);
}
}
// #[cfg(feature = "arbitrary")] // #[cfg(feature = "arbitrary")]
// quickcheck! { // quickcheck! {
// TODO: full eigendecomposition is not implemented yet because of its complexity when some // TODO: full eigendecomposition is not implemented yet because of its complexity when some