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

View File

@ -1,17 +1,40 @@
# Change Log
All notable changes to `nalgebra`, starting with the version 0.6.0 will be
documented here.
This project adheres to [Semantic Versioning](https://semver.org/).
## Unreleased
## [0.32.6] (12 June 2024)
### Added
- Add the `convert-glam027` feature to enable conversion from/to types from `glam` v0.27.
## [0.32.5] (28 March 2024)
## Fixed
- Fix numerical issue on SVD with near-identity matrix.
## [0.32.4] (19 Feb 2023)
### Added
- Add the `glam-0.25` feature to enable conversion from/to types from `glam` v0.25.
## [0.32.3] (09 July 2023)
### Modified
- Statically sized matrices are now serialized as tuples to match how serde
serialized plain arrays.
- Dont require `Scalar` for matrix `PartialEq` and `Eq`.
### Added
- Allow trailing punctuation in macros `vector!`, `matrix!`, `point!`, etc.
- Add the methods `Matrix1::as_scalar`, `::as_scalar_mut`, `::to_scalar`, `::into_scalar`.
- Add `Rotation3::euler_angles_ordered`, a generalized euler angles calculation.
@ -20,21 +43,25 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- Implement `Clone` for `MatrixIter`.
### Fixed
- Fixed severe catastrophic cancellation issue in variance calculation.
## [0.32.2] (07 March 2023)
### Added
- Add the `glam-0.23` to enable conversion from/to type from `glam` v0.23.
## [0.32.1] (14 Jan. 2023)
### Modified
- Updated `nalgebra-macros` to use the new `Dyn`, avoiding macro-generated deprecation warnings.
## [0.32.0] (14 Jan. 2023)
### Modified
- Renamed all `MatrixSlice` types to `MatrixView`. In general all occurrences of the world `Slice` or `slice` have been
replaced by `View` or `view`.
- Deprecated all the types involving `Slice` in its name, in favor of the word `View`.
@ -42,10 +69,12 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- Renamed `Dynamic` to `Dyn` and make `Dyn` a tuple struct.
### Added
- Add `Cholesky::ln_determinant` to compute the natural logarithm of the determinant of a matrix decomposed
with Cholesky. This can be more numerically stable than computing the determinant itself when very small and/or
large values are involved.
- Added new methods `Matrix::as_view` and `Matrix::as_view_mut`, which are very useful when working with view-based APIs.
- Added new methods `Matrix::as_view` and `Matrix::as_view_mut`, which are very useful when working with view-based
APIs.
- Added parallel column iterator using `rayon`: `Matrix::par_column_iter` and `Matrix::par_column_iter_mut`. The `rayon`
feature must be enabled to access these methods.
- Implement `ReshapableStorage` for matrix slices (only for unit strides at the moment).
@ -53,76 +82,89 @@ This project adheres to [Semantic Versioning](https://semver.org/).
`Const::<4>` when we need const dimensions.
### Fixed
- Fixed the implementation of `Rotation3::euler_angles` to return the angles in the documented order (roll, pitch, yaw).
## [0.31.4] (13 Nov. 2022)
### Added
- Add a `convert-glam022` feature to enable conversion between `nalgebra` and `glam v0.22`.
- Add a `convert-glam022` feature to enable conversion between `nalgebra` and `glam v0.22`.
## [0.31.3] (30 Oct. 2022)
### Added
- Add `Matrix::try_cast` to attempt casting the inner scalar types when that cast may fail.
### Fixed
- Fixed the usage of `CheckBytes` with `rkyv`.
## [0.31.2] (09 Oct. 2022)
### Modified
- Use `#[inline]` on the `Dim` implementation for `Const` to improve opt-level 1 performance.
- Make the `Point::new` constructions const-fn.
### Added
- Add `UnitVector::cast` to change the underlying scalar type.
- Add `UnitVector::cast` to change the underlying scalar type.
## [0.31.1] (31 July 2022)
### Modified
- Improve performances of multiplication of two sparse matrices.
### Added
- Add `Matrix::from_row_iterator` to build a matrix from an iterator yielding components in row-major order.
- Add support for conversion from/to types of `glam` 0.21.
- `nalgebra-sparse`: add support for the matrix-market export of sparse matrices.
- `nalgebra-lapack`: add a `GE` for solving the generalized eigenvalues problem.
### Fixed
- Fix `Rotation3::from_matrix` and `UnitQuaternion::from_matrix` when the input matrix is already a valid
rotation matrix.
## [0.31.0] (30 Apr. 2022)
### Breaking changes
- Switch to `cust` 0.3 (for CUDA support).
- Switch to `rkyv` 0.7
- Remove support for serialization based on `abomonation`.
- Remove support for conversions between `nalgebra` types and `glam` 0.13.
### Modified
- The aliases for `Const` types have been simplified to help `rust-analyzer`.
### Added
- Add `TryFrom` conversion between `UnitVector2/3/4` and `glam`s `Vec2/3/4`.
- `nalgebra-sparse`: added support for serialization of sparse matrices with `serde`.
- `nalgebra-sparse`: add a CSC matrix constructor from unsorted (but valid) data.
- `nalgebra-lapack`: add generalized eigenvalues/eigenvectors calculation + QZ decomposition.
### Fixed
- Improve stability of SVD.
- Fix slerp for `UnitComplex`.
## [0.30.1] (09 Jan. 2022)
### Added
- Add conversion from/to types of `glam` 0.19 and 0.20.
## [0.30.0] (02 Jan. 2022)
### Breaking changes
- The `Dim` trait is now marked as unsafe.
- The `Matrix::pow` and `Matrix::pow_mut` methods only allow positive integer exponents now. To compute negative
exponents, the user is free to invert the matrix before calling `pow` with the exponents absolute value.
@ -132,6 +174,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
return `Option<Self>`, meaning that it could be implemented by any type.
### Modified
- Use more concise debug impls for matrices and geometric transformation types.
- The singular values computed by the SVD are now sorted in increasing order by default. Use `SVD::new_unordered`
instead to reproduce the older behavior without the sorting overhead.
@ -141,6 +184,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- The `Matrix::pow` and `Matrix::pow_mut` methods will now also work with integer matrices.
### Added
- Added the conversion trait `From<Vec<T>>` and method `from_vec_storage` for `RowDVector`.
- Added implementation of `From` and `Into` for converting between `nalgebra` types and types from
`glam 0.18`. These can be enabled by enabling the `convert-glam018` cargo features.
@ -161,6 +205,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- `nalgebra-sparse`: added reading MatrixMarked data files to a sparse `CooMatrix`.
### Fixed
- Fixed a potential unsoundness with `matrix.get(i)` and `matrix.get_mut(i)` where `i` is an `usize`, and `matrix`
is a matrix slice with non-default strides.
- Fixed potential unsoundness with `vector.perp` where `vector` isnt actually a 2D vector as expected.
@ -169,9 +214,10 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- Fixed the `no-std` build of `nalgebra-glm`.
- Fix the `pow` and `pow_mut` functions (the result was incorrect for some exponent values).
## [0.29.0]
### Breaking changes
- We updated to the version 0.6 of `simba`. This means that the trait bounds `T: na::RealField`, `na::ComplexField`,
`na::SimdRealField`, `na:SimdComplexField` no imply that `T: Copy` (they only imply that `T: Clone`). This may affect
generic code.
@ -183,6 +229,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
way.
### Modified
- `Orthographic3::from_matrix_unchecked` is now `const fn`.
- `Perspective3::from_matrix_unchecked` is now `const fn`.
- `Rotation::from_matrix_unchecked` is now `const fn`.
@ -190,6 +237,7 @@ This project adheres to [Semantic Versioning](https://semver.org/).
`Copy` are now much safer to work with thanks to the refactoring of the `Allocator` system.
### Added
- The conversion traits form the `bytemuck` crates are now implemented for the geometric types too.
- Added operator overloading for `Transform * UnitComplex`, `UnitComplex * Transform`, `Transform ×= UnitComplex`,
`Transform ÷= UnitComplex`.
@ -200,16 +248,21 @@ This project adheres to [Semantic Versioning](https://semver.org/).
cargo features.
## [0.28.0]
### Added
- Implement `Hash` for `Transform`.
- Implement `Borrow` and `BorrowMut` for contiguous slices.
### Modified
- The `OPoint<T, D>` type has been added. It takes the dimension number as a type-level integer (e.g. `Const<3>`) instead
- The `OPoint<T, D>` type has been added. It takes the dimension number as a type-level integer (e.g. `Const<3>`)
instead
of a const-generic. The type `Point<T, const D: usize>` is now an alias for `OPoint`. This changes doesn't affect any
of the existing code using `Point`. However, it will allow the use `OPoint` in a generic context where the dimension
cannot be easily expressed as a const-generic (because of the current limitation of const-generics in Rust).
- Several clippy warnings were fixed. This results in some method signature changes (e.g. taking `self` instead of `&self`)
- Several clippy warnings were fixed. This results in some method signature changes (e.g. taking `self` instead
of `&self`)
but this should not have any practical infulances on existing codebase.
- The `Point::new` constructors are no longer const-fn. This is due to some limitations in const-fn
not allowing custom trait-bounds. Use the `point!` macro instead to build points in const environments.
@ -217,30 +270,38 @@ This project adheres to [Semantic Versioning](https://semver.org/).
- Methods returning `Result<(), ()>` now return `bool` instead.
### Fixed
- Fixed a potential unsoundess issue when converting a mutable slice to a `&mut[T]`.
## [0.27.1]
### Fixed
- Fixed a bug in the conversion from `glam::Vec2` or `glam::DVec2` to `Isometry2`.
## [0.27.0]
This removes the `convert-glam` and `convert-glam-unchecked` optional features.
Instead, this adds the `convert-glam013`, `convert-glam014`, and `convert-glam015` optional features for
conversions targeting the versions 0.13, 0.14, and 0.15 of `glam`.
### Added
- Add macros `matrix!`, `dmatrix!`, `vector!`, `dvector!`, `point!` for constructing matrices/vectors/points in a
more convenient way. See [#886](https://github.com/dimforge/nalgebra/pull/886) and [#899](https://github.com/dimforge/nalgebra/pull/899).
more convenient way. See [#886](https://github.com/dimforge/nalgebra/pull/886)
and [#899](https://github.com/dimforge/nalgebra/pull/899).
- Add `CooMatrix::reserve` to `nalgebra-sparse`.
- Add basic support for serialization using `rkyv`. Can be enabled with the features `rkyv-serialize` or
`rkyv-serialize-no-std`.
### Fixed
- Fixed a potential unsoundness issue after deserializing an invalid `DVector` using `serde`.
## [0.26.2]
### Added
- Conversion from an array `[T; D]` to an isometry `Isometry<T, _, D>` (as a translation).
- Conversion from a static vector `SVector<T; D>` to an isometry `Isometry<T, _, D>` (as a translation).
- Conversion from a point `Point<T; D>` to an isometry `Isometry<T, _, D>` (as a translation).
@ -250,14 +311,17 @@ conversions targeting the versions 0.13, 0.14, and 0.15 of `glam`.
- Conversion of a glam type `Vec2/3/4` from/to a `Translation2/3/4`.
## [0.26.1]
Fix a regression introduced in 0.26.0 preventing `DVector` from being serialized with `serde`.
## [0.26.0]
This release integrates `min-const-generics` to nalgebra. See
[our blog post](https://www.dimforge.com/blog/2021/04/12/integrating-const-generics-to-nalgebra)
for details about this release.
### Added
- Add type aliases for unit vector, e.g., `UnitVector3`.
- Add a `pow` and `pow_mut` function to square matrices.
- Add `Cholesky::determinant` to compute the determinant of a matrix decomposed
@ -265,8 +329,8 @@ for details about this release.
- Add the `serde-serialize-no-std` feature to enable serialization of static matrices/vectors
with serde, but without requiring `std`.
### Modified
- The `serde` crate isn't enabled by default now. Enable the `serde-serialize` or the
`serde-serialize-no-std` features instead.
- The `Const<const D: usize>` type has been introduced to represent dimensions known
@ -288,16 +352,22 @@ for details about this release.
constructor is also a `const fn` now.
## [0.25.4]
### Fixed
- Fix a compilation error when only the `serde-serialize` feature is enabled.
## [0.25.3]
### Added
- The `Vector::simd_cap_magnitude` method to cap the magnitude of the vector with
SIMD components.
## [0.25.2]
### Added
- A `convert-glam` cargo feature to enable implementations of `From` traits to convert
between `glam` types and `nalgebra` types.
- A `convert-glam-unchecked` cargo feature to enable some extra `glam`/`nalgebra` conversions that may
@ -308,56 +378,70 @@ for details about this release.
type of the components of a given entity. Example: `vector.cast::<f32>()`.
## [0.25.1]
This release replaces the version 0.25.0 which has been yanked. The 0.25.0 version
added significant complication to build `nalgebra` targeting a `#[no-std]` platform
not supported by `rand`.
The `rand` dependency is now optional (and disabled by default). You may enable it with:
- The `rand-no-std` cargo feature when targeting a `#[no-std]` environment.
- The `rand` cargo feature when targeting a `std` environment.
## [0.25.0] - Yanked
This updates all the dependencies of nalgebra to their latest version, including:
- rand 0.8
- proptest 1.0
- simba 0.4
### New crate: nalgebra-sparse
Alongside this release of `nalgebra`, we are releasing `nalgebra-sparse`: a crate dedicated to sparse matrix
computation with `nalgebra`. The `sparse` module of `nalgebra`itself still exists for backward compatibility,
but it will be deprecated soon in favor of the `nalgebra-sparse` crate.
### Added
* Add `UnitDualQuaternion`, a dual-quaternion with unit magnitude which can be used as an isometry transformation.
* Add `UDU::new()` and `matrix.udu()` to compute the UDU factorization of a matrix.
* Add `ColPivQR::new()` and `matrix.col_piv_qr()` to compute the QR decomposition with column pivoting of a matrix.
* Add `from_basis_unchecked` to all the rotation types. This builds a rotation from a set of basis vectors (representing the columns of the corresponding rotation matrix).
* Add `from_basis_unchecked` to all the rotation types. This builds a rotation from a set of basis vectors (representing
the columns of the corresponding rotation matrix).
* Add `Matrix::cap_magnitude` to cap the magnitude of a vector.
* Add `UnitQuaternion::append_axisangle_linearized` to approximately append a rotation represented as an axis-angle to a rotation represented as an unit quaternion.
* Add `UnitQuaternion::append_axisangle_linearized` to approximately append a rotation represented as an axis-angle to a
rotation represented as an unit quaternion.
* Mark the iterators on matrix components as `DoubleEndedIter`.
* Re-export `simba::simd::SimdValue` at the root of the `nalgebra` crate.
## [0.24.0]
### Added
* The `DualQuaternion` type. It is still work-in-progress, but the basics are here:
creation from its real and dual part, multiplication of two dual quaternions,
and normalization.
### Removed
* There is no blanket `impl<T> PartialEq for Unit<T>` anymore. Instead, it is
implemented specifically for `UnitComplex`, `UnitQuaternion` and `Unit<Vector>`.
## [0.23.2]
In this release, we improved the documentation of some of the geometric types
by applying changes similar to what we did in the version 0.23.1 for matrices.
### Added
* The `Isometry::inv_mul` method which is a more efficient way of doing
`isometry1.inverse() * isometry2`.
## [0.23.1]
In this release we improved the documentation of the matrix and vector types by:
- Grouping `impl` bocks logically, adding a title comment to these impl blocks.
- Reference these impl blocks docs at the top of the documentation page for `Matrix`.
- Reduce the depth of type aliasing. Now all vector and matrix types are aliases of `Matrix`
@ -366,13 +450,17 @@ In this release we improved the documentation of the matrix and vector types by:
## [0.23.0]
### Added
* The `.inverse_transform_unit_vector(v)` was added to `Rotation2/3`, `Isometry2/3`, `UnitQuaternion`, and `UnitComplex`.
* The `.inverse_transform_unit_vector(v)` was added to `Rotation2/3`, `Isometry2/3`, `UnitQuaternion`,
and `UnitComplex`.
It applies the corresponding rotation to a unit vector `Unit<Vector2/3>`.
* The `Point.map(f)` and `Point.apply(f)` to apply a function to each component of the point, similarly to `Vector.map(f)`
* The `Point.map(f)` and `Point.apply(f)` to apply a function to each component of the point, similarly
to `Vector.map(f)`
and `Vector.apply(f)`.
* The `Quaternion::from([N; 4])` conversion to build a quaternion from an array of four elements.
* The `Isometry::from(Translation)` conversion to build an isometry from a translation.
* The `Vector::ith_axis(i)` which build a unit vector, e.g., `Unit<Vector3<f32>>` with its i-th component set to 1.0, and the
* The `Vector::ith_axis(i)` which build a unit vector, e.g., `Unit<Vector3<f32>>` with its i-th component set to 1.0,
and the
others set to zero.
* The `Isometry.lerp_slerp` and `Isometry.try_lerp_slerp` methods to interpolate between two isometries using linear
interpolation for the translational part, and spherical interpolation for the rotational part.
@ -380,12 +468,14 @@ In this release we improved the documentation of the matrix and vector types by:
spherical interpolation.
## [0.22.0]
In this release, we are using the new version 0.2 of simba. One major change of that version is that the
use of `libm` is now opt-in when building targeting `no-std` environment. If you are using floating-point
operations with nalgebra in a `no-std` environment, you will need to enable the new `libm` feature
of nalgebra for your code to compile again.
### Added
* The `libm` feature that enables `libm` when building for `no-std` environment.
* The `libm-force` feature that enables `libm` even when building for a not `no-std` environment.
* `Cholesky::new_unchecked` which build a Cholesky decomposition without checking that its input is
@ -396,6 +486,7 @@ of nalgebra for your code to compile again.
* The `Vector::ith(i, x)` that builds a vector filled with zeros except for the `i`-th component set to `x`.
## [0.21.0]
In this release, we are no longer relying on traits from the __alga__ crate for our generic code.
Instead, we use traits from the new [simba](https://crates.io/crates/simba) crate which are both
simpler, and allow for significant optimizations like AoSoA SIMD.
@ -404,75 +495,98 @@ Refer to the [monthly dimforge blogpost](https://www.dimforge.org/blog/2020/04/0
for details about this switch and its benefits.
### Added
* It is now possible to use SIMD types like `simba::f32x4` as scalar types for nalgebra's matrices and
geometric types.
### Modified
* Use of traits like `alga::general::{RealField, ComplexField}` have now been replaced by
`simba::scalar::{RealField, ComplexField}`.
* The implementation of traits from the __alga__ crate (and well as the dependency to _alga__) are now
omitted unless the `alga` cargo feature is activated.
### Removed
* The `Neg` unary operator is no longer implemented for `UnitComplex` and `UnitQuaternion`. This caused
hard-to-track errors when we mistakenly write, e.g., `-q * v` instead of `-(q * v)`.
* The `na::convert_unchecked` is no longer marked as unsafe.
## [0.20.0]
### Added
* `cholesky.rank_one_update(...)` which performs a rank-one update on the cholesky decomposition of a matrix.
* `From<&Matrix>` is now implemented for matrix slices.
* `.try_set_magnitude(...)` which sets the magnitude of a vector, while keeping its direction.
* Implementations of `From` and `Into` for the conversion between matrix slices and standard (`&[N]` `&mut [N]`) slices.
### Modified
* We started some major changes in order to allow non-Copy types to be used as scalar types inside of matrices/vectors.
## [0.19.0]
### Added
* `.remove_rows_at` and `remove_columns_at` which removes a set of rows or columns (specified by indices) from a matrix.
* Several formatting traits have been implemented for all matrices/vectors: `LowerExp`, `UpperExp`, `Octal`, `LowerHex`,
`UpperHex`, `Binary`, `Pointer`.
* `UnitQuaternion::quaternions_mean(...)` which computes the mean rotation of a set of unit quaternions. This implements
the algorithm from _Oshman, Yaakov, and Avishy Carmi, "Attitude estimation from vector observations using a genetic-algorithm-embedded quaternion particle filter."
the algorithm from _Oshman, Yaakov, and Avishy Carmi, "Attitude estimation from vector observations using a
genetic-algorithm-embedded quaternion particle filter."
### Modified
* It is now possible to get the `min/max` element of unsigned integer matrices.
### Added to nalgebra-glm
* Some infinite and reversed perspectives: `::infinite_perspective_rh_no`, `::infinite_perspective_rh_zo`,
`::reversed_perspective_rh_zo`, and `::reversed_infinite_perspective_rh_zo`.
## [0.18.0]
This release adds full complex number support to nalgebra. This includes all common vector/matrix operations as well
as matrix decomposition. This excludes geometric type (like `Isometry`, `Rotation`, `Translation`, etc.) from the
`geometry` module.
### Added
#### Quaternion and geometric operations
* Add trigonometric functions for quaternions: `.cos, .sin, .tan, .acos, .asin, .atan, .cosh, .sinh, .tanh, .acosh, .asinh, .atanh`.
* Add trigonometric functions for
quaternions: `.cos, .sin, .tan, .acos, .asin, .atan, .cosh, .sinh, .tanh, .acosh, .asinh, .atanh`.
* Add geometric algebra operations for quaternions: `.inner, .outer, .project, .rejection`
* Add `.left_div, .right_div` for quaternions.
* Add `.renormalize` to `Unit<...>` and `Rotation3` to correct potential drift due to repeated operations.
Those drifts could cause them not to be pure rotations anymore.
#### Convolution
* `.convolve_full(kernel)` returns the convolution of `self` by `kernel`.
* `.convolve_valid(kernel)` returns the convolution of `self` by `kernel` after removal of all the elements relying on zero-padding.
* `.convolve_valid(kernel)` returns the convolution of `self` by `kernel` after removal of all the elements relying on
zero-padding.
* `.convolve_same(kernel)` returns the convolution of `self` by `kernel` with a result of the same size as `self`.
#### Complex number support
* Add the `::from_matrix` constructor too all rotation types to extract a rotation from a raw matrix.
* Add the `::from_matrix_eps` constructor too all rotation types to extract a rotation from a raw matrix. This takes
more argument than `::from_matrix` to control the convergence of the underlying optimization algorithm.
* Add `.camax()` which returns the matrix component with the greatest L1-norm.
* Add `.camin()` which returns the matrix component with the smallest L1-norm.
* Add `.ad_mul(b)` for matrix-multiplication of `self.adjoint() * b`.
* Add `.ad_mul_to(b)` which is the same as `.ad_mul` but with a provided matrix to be filled with the result of the multiplication.
* Add `.ad_mul_to(b)` which is the same as `.ad_mul` but with a provided matrix to be filled with the result of the
multiplication.
* Add BLAS operations involving complex conjugation (following similar names as the original BLAS spec):
* `.dotc(rhs)` equal to `self.adjoint() * rhs`.
* `.gerc(alpha, x, y, beta)` equivalent to `self = alpha * x * y.adjoint() + beta * self`
* `.hegerc` which is like `gerc` but for Hermitian matrices.
* `.syger` which is the new name of `.ger_symm` which is equivalent to `self = alpha * x * y.transpose() + beta * self`.
* `.sygemv` which is the new name of `.gemv_symm` which is equivalent to `self = alpha * a * x + beta * self` with `a` symmetric.
* `.syger` which is the new name of `.ger_symm` which is equivalent
to `self = alpha * x * y.transpose() + beta * self`.
* `.sygemv` which is the new name of `.gemv_symm` which is equivalent to `self = alpha * a * x + beta * self`
with `a` symmetric.
* `.hegemv(alpha, a, x, beta)` which is like `.sygemv` but with `a` Hermitian.
* `.gemv_ad(alpha, a, x, beta)` which is equivalent to `self = alpha * a.adjoint() * x + beta * self`.
* `.gemm_ad(alpha, a, b, beta)` which is equivalent to `self = alpha * a.adjoint() * b + beta * self`.
@ -481,14 +595,17 @@ as matrix decomposition. This excludes geometric type (like `Isometry`, `Rotatio
Note that all the other BLAS operation will continue to work for all fields, including floats and complex numbers.
### Renamed
* `RealSchur` has been renamed `Schur` because it can now work with complex matrices.
* `RealSchur` has been renamed `Schur` because it can now work with complex matrices.
## [0.17.0]
### Added
* Add swizzling up to dimension 3 for vectors. For example, you can do `v.zxy()` as an equivalent to `Vector3::new(v.z, v.x, v.y)`.
* Add swizzling up to dimension 3 for points. For example, you can do `p.zxy()` as an equivalent to `Point3::new(p.z, p.x, p.y)`.
* Add swizzling up to dimension 3 for vectors. For example, you can do `v.zxy()` as an equivalent
to `Vector3::new(v.z, v.x, v.y)`.
* Add swizzling up to dimension 3 for points. For example, you can do `p.zxy()` as an equivalent
to `Point3::new(p.z, p.x, p.y)`.
* Add `.copy_from_slice` to copy matrix components from a slice in column-major order.
* Add `.dot` to quaternions.
* Add `.zip_zip_map` for iterating on three matrices simultaneously, and applying a closure to them.
@ -499,7 +616,8 @@ Note that all the other BLAS operation will continue to work for all fields, inc
* Add `From/Into` impls to allow the conversion of any transformation type to a matrix.
* Add `Into` impls to convert a matrix slice into an owned matrix.
* Add `Point*::from_slice` to create a point from a slice.
* Add `.map_with_location` to matrices to apply a map which passes the component indices to the user-defined closure alongside
* Add `.map_with_location` to matrices to apply a map which passes the component indices to the user-defined closure
alongside
the component itself.
* Add impl `From<Vector>` for `Point`.
* Add impl `From<Vector4>` for `Quaternion`.
@ -509,7 +627,8 @@ Note that all the other BLAS operation will continue to work for all fields, inc
* Add `.to_homogeneous` to square matrices (and with dimensions higher than 1x1). This will increase their number of row
and columns by 1. The new column and row are filled with 0, except for the diagonal element which is set to 1.
* Implement `Extend<Vec>` for matrices with a dynamic storage. The provided `Vec` is assumed to represent a column-major
matrix with the same number of rows as the one being extended. This will effectively append new columns on the right of
matrix with the same number of rows as the one being extended. This will effectively append new columns on the right
of
the matrix being extended.
* Implement `Extend<Vec>` for vectors with a dynamic storage. This will concatenate the vector with the given `Vec`.
* Implement `Extend<Matrix<...>>` for matrices with dynamic storage. This will concatenate the columns of both matrices.
@ -518,10 +637,12 @@ Note that all the other BLAS operation will continue to work for all fields, inc
* Add a `.len()` method to retrieve the size of a `MatrixVec`.
### Modified
* The orthographic projection no longer require that `bottom < top`, that `left < right`, and that `znear < zfar`. The
only restriction now ith that they must not be equal (in which case the projection would be singular).
* The `Point::from_coordinates` methods is deprecated. Use `Point::from` instead.
* The `.transform_point` and `.transform_vector` methods are now inherent methods for matrices so that the user does not have to
* The `.transform_point` and `.transform_vector` methods are now inherent methods for matrices so that the user does not
have to
explicitly import the `Transform` trait from the alga crate.
* Renamed the matrix storage types: `MatrixArray` -> `ArrayStorage` and `MatrixVec` -> `VecStorage`.
* Renamed `.unwrap()` to `.into_inner()` for geometric types that wrap another type.
@ -529,32 +650,46 @@ Note that all the other BLAS operation will continue to work for all fields, inc
* Deprecate several functions at the root of the crate (replaced by methods).
### Removed
* Remove the `Deref` impl for `MatrixVec` as it could cause hard-to-understand compilation errors.
### nalgebra-glm
* Add several alternative projection computations, e.g., `ortho_lh`, `ortho_lh_no`, `perspective_lh`, etc.
* Add features matching those of nalgebra, in particular: `serde-serialize`, `abmonation-serialize`, std` (enabled by default).
* Add features matching those of nalgebra, in particular:`serde-serialize`, `abmonation-serialize`, std` (enabled by
default).
## [0.16.0]
All dependencies have been updated to their latest versions.
## Modified
* Adjust `UnitQuaternion`s, `Rotation3`s, and `Rotation2`s generated from the `Standard` distribution to be uniformly distributed.
* Adjust `UnitQuaternion`s, `Rotation3`s, and `Rotation2`s generated from the `Standard` distribution to be uniformly
distributed.
### Added
* Add a feature `stdweb` to activate the dependency feature `rand/stdweb`.
* Add blas-like methods `.imin()` and `.imax()` that return the index of the minimum and maximum entry of a vector.
* Add construction of a `Point` from an array by implementing the `From` trait.
* Add support for generating uniformly distributed random unit column vectors using the `Standard` distribution.
## [0.15.0]
The most notable change of this release is the support for using part of the library without the rust standard
library (i.e. it supports `#![no_std]`). See the corresponding [documentation](https://nalgebra.org/wasm_and_embedded_programming/).
library (i.e. it supports `#![no_std]`). See the
corresponding [documentation](https://nalgebra.org/wasm_and_embedded_programming/).
### Modified
* Rename the `core` module to `base` to avoid conflicts with the `core` crate implicitly imported when
`#![no_std]` is enabled.
* Constructors of the `MatrixSlice*` types have been renamed from `new_*` to `from_slice_*`. This was
necessary to avoid the `incoherent_fundamental_impls` lint that is going to become a hard error.
### Added
* Add `UnitQuaternion` constructor `::new_eps(...)` and `::from_scaled_axis_eps(...)` that return the
identity if the magnitude of the input axisangle is smaller than the epsilon provided.
* Add methods `.rotation_between_axis(...)` and `.scaled_rotation_between_axis(...)` to `UnitComplex`
@ -564,9 +699,13 @@ library (i.e. it supports `#![no_std]`). See the corresponding [documentation](h
* Add functions to construct a random matrix with a user-defined distribution: `::from_distribution(...)`.
## [0.14.0]
### Modified
* Allow the `Isometry * Unit<Vector>` multiplication.
### Added
* Add blas-like operations: `.quadform(...)` and `.quadform_tr(...)` to compute respectively
the quadratic forms `self = alpha * A.transpose() * B * A + beta * self` and
`alpha * A * B * A.transpose() + beta * self`. Here, `A, B` are matrices with
@ -596,8 +735,6 @@ library (i.e. it supports `#![no_std]`). See the corresponding [documentation](h
`UnitQuaternion::rotation_between_axis(...)` that take Unit vectors instead of
Vector as arguments.
## [0.13.0]
The **nalgebra-lapack** crate has been updated. This now includes a broad range
@ -607,6 +744,7 @@ This adds support for serialization using the
[abomonation](https://crates.io/crates/abomonation) crate.
### Breaking semantic change
* The implementation of slicing with steps now matches the documentation.
Before, step identified the number to add to pass from one column/row index
to the next one. This made 0 step invalid. Now (and on the documentation so
@ -615,6 +753,7 @@ This adds support for serialization using the
example, a step of, say, 3 on previous versions should now bet set to 2.
### Modified
* The trait `Axpy` has been replaced by a method `.axpy`.
* The alias `MatrixNM` is now deprecated. Use `MatrixMN` instead (we
reordered M and N to be in alphabetical order).
@ -624,6 +763,7 @@ This adds support for serialization using the
`.component_div_assign(...)` instead.
### Added
* `alga::general::Real` is now re-exported by nalgebra.
elements.)
* `::zeros(...)` that creates a matrix filled with zeroes.
@ -659,17 +799,20 @@ Pure Rust implementation of some Blas operations:
* `.ger_symm(...)` is the same as `.ger` except that `self` is assumed symmetric.
New slicing methods:
* `.rows_range(...)` that retrieves a reference to a range of rows.
* `.rows_range_mut(...)` that retrieves a mutable reference to a range of rows.
* `.columns_range(...)` that retrieves a reference to a range of columns.
* `.columns_range_mut(...)` that retrieves a mutable reference to a range of columns.
Matrix decompositions implemented in pure Rust:
* Cholesky, SVD, LU, QR, Hessenberg, Schur, Symmetric eigendecompositions,
Bidiagonal, Symmetric tridiagonal
* Computation of householder reflectors and givens rotations.
Matrix edition:
* `.upper_triangle()` extracts the upper triangle of a matrix, including the diagonal.
* `.lower_triangle()` extracts the lower triangle of a matrix, including the diagonal.
* `.fill(...)` fills the matrix with a single value.
@ -686,37 +829,45 @@ Matrix edition:
* `.swap_columns(...)` swaps two columns.
Column removal:
* `.remove_column(...)` removes one column.
* `.remove_fixed_columns<D>(...)` removes `D` columns.
* `.remove_columns(...)` removes a number of columns known at run-time.
Row removal:
* `.remove_row(...)` removes one row.
* `.remove_fixed_rows<D>(...)` removes `D` rows.
* `.remove_rows(...)` removes a number of rows known at run-time.
Column insertion:
* `.insert_column(...)` adds one column at the given position.
* `.insert_fixed_columns<D>(...)` adds `D` columns at the given position.
* `.insert_columns(...)` adds at the given position a number of columns known at run-time.
Row insertion:
* `.insert_row(...)` adds one row at the given position.
* `.insert_fixed_rows<D>(...)` adds `D` rows at the given position.
* `.insert_rows(...)` adds at the given position a number of rows known at run-time.
## [0.12.0]
The main change of this release is the update of the dependency serde to 1.0.
### Added
* `.trace()` that computes the trace of a matrix (the sum of its diagonal
elements.)
## [0.11.0]
The [website](https://nalgebra.org) has been fully rewritten and gives a good
overview of all the added/modified features.
This version is a major rewrite of the library. Major changes are:
* Algebraic traits are now defined by the [alga](https://crates.io/crates/alga) crate.
All other mathematical traits, except `Axpy` have been removed from
**nalgebra**.
@ -734,9 +885,11 @@ This version is a major rewrite of the library. Major changes are:
* Matrix **slices** are now implemented.
### Added
Lots of features including rectangular matrices, slices, and Serde
serialization. Refer to the brand new [website](https://nalgebra.org) for more
details. The following free-functions have been added as well:
* `::id()` that returns the universal [identity element](https://nalgebra.org/performance_tricks/#the-id-type)
of type `Id`.
* `::inf_sup()` that returns both the infimum and supremum of a value at the
@ -746,6 +899,7 @@ details. The following free-functions have been added as well:
the interval width to it.
### Modified
* `::cast` -> `::convert`
* `point.as_vector()` -> `point.coords`
* `na::origin` -> `P::origin()`
@ -756,6 +910,7 @@ details. The following free-functions have been added as well:
* `::angle_between` -> `::angle`
Componentwise multiplication and division has been replaced by methods:
* multiplication -> `.componentwise_mul`, `.componentwise_mul_mut`.
* division -> `.componentwise_div`, `.componentwise_div_mut`.
@ -765,8 +920,8 @@ only:
`.eig`), `::hessenberg`, `::qr`, `::to_homogeneous`, `::to_rotation_matrix`,
`::transpose`, `::shape`.
The following free-functions are now replaced by static methods only:
* `::householder_matrix` under the name `::new_householder_generic`
* `::identity`
* `::new_identity` under the name `::identity`
@ -775,6 +930,7 @@ The following free-functions are now replaced by static methods only:
The following free-function are now replaced methods accessible through traits
only:
* `::transform` -> methods `.transform_point` and `.transform_vector` of the `alga::linear::Transformation` trait.
* `::inverse_transform` -> methods `.inverse_transform_point` and
`.inverse_transform_vector` of the `alga::linear::ProjectiveTransformation`
@ -791,9 +947,8 @@ only:
`alga::linear::Rotation` trait.
* `::is_zero` -> method with the same name from `num::Zero`.
### Removed
* The free functions `::prepend_rotation`, `::append_rotation`,
`::append_rotation_wrt_center`, `::append_rotation_wrt_point`,
`::append_transformation`, and `::append_translation ` have been removed.
@ -817,11 +972,14 @@ only:
`rotation.angle()` and `rotation.axis()`.
## [0.10.0]
### Added
Binary operations are now allowed between references as well. For example
`Vector3<f32> + &Vector3<f32>` is now possible.
### Modified
Removed unused parameters to methods from the `ApproxEq` trait. Those were
required before rust 1.0 to help type inference. They are not needed any more
since it now allowed to write for a type `T` that implements `ApproxEq`:
@ -829,7 +987,9 @@ since it now allowed to write for a type `T` that implements `ApproxEq`:
`ApproxEq::approx_epsilon(None::<T>)`.
## [0.9.0]
### Modified
* Renamed:
- `::from_col_vector` -> `::from_column_vector`
- `::from_col_iter` -> `::from_column_iter`
@ -851,11 +1011,13 @@ Other similar trait changes are to be expected in the future, e.g., for the
Methods marked `unsafe` for reasons unrelated to memory safety are no
longer unsafe. Instead, their name end with `_unchecked`. In particular:
* `Rotation3::new_with_matrix` -> `Rotation3::from_matrix_unchecked`
* `PerspectiveMatrix3::new_with_matrix` -> `PerspectiveMatrix3::from_matrix_unchecked`
* `OrthographicMatrix3::new_with_matrix` -> `OrthographicMatrix3::from_matrix_unchecked`
### Added
- A `Unit<T>` type that wraps normalized values. In particular,
`UnitQuaternion<N>` is now an alias for `Unit<Quaternion<N>>`.
- `.ln()`, `.exp()` and `.powf(..)` for quaternions and unit quaternions.
@ -872,7 +1034,9 @@ crate for vectors, rotations and points. To enable them, activate the
`abstract_algebra` feature.
## [0.8.0]
### Modified
* Almost everything (types, methods, and traits) now use fulls names instead
of abbreviations (e.g. `Vec3` becomes `Vector3`). Most changes are obvious.
Note however that:
@ -886,19 +1050,24 @@ crate for vectors, rotations and points. To enable them, activate the
e.g., `vec.rs` becomes `vector.rs`.
## [0.7.0]
### Added
* Added implementation of assignment operators (+=, -=, etc.) for
everything.
### Modified
* Points and vectors are now linked to each other with associated types
(on the PointAsVector trait).
## [0.6.0]
**Announcement:** a users forum has been created for `nalgebra`, `ncollide`, and `nphysics`. See
you [there](https://users.nphysics.org)!
### Added
* Added a dependency to [generic-array](https://crates.io/crates/generic-array). Feature-gated:
requires `features="generic_sizes"`.
* Added statically sized vectors with user-defined sizes: `VectorN`. Feature-gated: requires
@ -907,10 +1076,13 @@ you [there](https://users.nphysics.org)!
translation): `Similarity2`, `Similarity3`.
### Removed
* Removed zero-sized elements `Vector0`, `Point0`.
* Removed 4-dimensional transformations `Rotation4` and `Isometry4` (which had an implementation too incomplete to be useful).
* Removed 4-dimensional transformations `Rotation4` and `Isometry4` (which had an implementation too incomplete to be
useful).
### Modified
* Vectors are now multipliable with isometries. This will result into a pure rotation (this is how
vectors differ from point semantically: they design directions, so they are not translatable).
* `{Isometry3, Rotation3}::look_at` reimplemented and renamed to `::look_at_rh` and `::look_at_lh` to agree

View File

@ -1,6 +1,6 @@
[package]
name = "nalgebra"
version = "0.32.3"
version = "0.32.6"
authors = ["Sébastien Crozet <developer@crozet.re>"]
description = "General-purpose linear algebra library with transformations and statically-sized or dynamically-sized matrices."
@ -49,6 +49,8 @@ convert-glam021 = [ "glam021" ]
convert-glam022 = ["glam022"]
convert-glam023 = ["glam023"]
convert-glam024 = ["glam024"]
convert-glam025 = ["glam025"]
convert-glam027 = ["glam027"]
# Serialization
## To use serde in a #[no-std] environment, enable the
@ -104,6 +106,8 @@ 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 }
cust_core = { version = "0.1", optional = true }
rayon = { version = "1.6", optional = true }

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"
)]
#![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.
///

View File

@ -34,6 +34,17 @@ pub fn reflection_axis_mut<T: ComplexField, D: Dim, S: StorageMut<T, D>>(
if !factor.is_zero() {
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)
} else {
// TODO: not sure why we don't have a - sign here.

View File

@ -20,3 +20,7 @@ mod v022;
mod v023;
#[cfg(feature = "glam024")]
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")]
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")]
// quickcheck! {
// TODO: full eigendecomposition is not implemented yet because of its complexity when some