All notable changes to nalgebra, starting with the version 0.6.0 will be
documented here.
This project adheres to Semantic Versioning.
nalgebra-lapack change log is found here
starting with nalgebra-lapack version 0.27.0.
- Add
convert-glam031andconvert-glam032features for conversion from/toglamv0.31 and v0.32 #1597.
- Fix
SymmetricEigenroutine #1210. - Fix matrix parsing grammar to accept numbers without leading zeros, e.g. ".45" #1578.
- Fix build with
glaminno_stdenvironments #1555. - Fix rustdoc warnings #1511.
- Implement absolute threshold for early deflation in Schur algorithm #1565.
- Assert matrix shapes for
Matrix::abs_diff_eq#1568.
- Added
encasefeature, providingencasetrait implementations fornalgebratypes.
- Add the
convert-glam030feature to enable conversion from/to types fromglamv0.30. - Add the
defmtcargo feature that enables derives ofdefmt::Formatfor all no-std types.
- Bumped MSRV to 1.87.0.
- Updated rand dependency to 0.9.0.
- Renamed associated const
DimName::USIZEtoDimName::DIM. - Moved to Rust 2024 edition.
- Several methods are now
constwhenever possible. See details in #1522. - Features for conversion from/to types from
glam(such asconvert-glam029) no longer enable default features forglam, allowing use inno_stdenvironments.
- Fix infinite loop when attempting to take the Schur decomposition of a 0 matrix.
- Add the
convert-glam029feature to enable conversion from/to types fromglamv0.29.
- Add implementations of
bytemucktraits for isometries and similarities. - Implement
AsRef<[T]>for matrices with contiguous storage. - Enable the
num-complex/bytemuckfeature when theconvert-bytemuckfeature is enabled.
- Fix a memory leak in
Matrix::generic_resize. - Fix
glm::is_nullto check the vector magnitude instead of individual components. - Ensure that inverting a 4x4 matrix leaves it unchanged if the inversion fails.
- Add the
glam-0.28feature to enable conversion from/to types fromglamv0.28. - Add a
stack!macro for concatenating matrices. See #1375.
- The
cudafeature has been removed, as the toolchain it depends on is long abandoned. - Update to
simba0.9. See the changelog ofsimbafor details. - Update the
nalgebra-macroscrate tosyn2.0. - Remove the scalar type
Tfrom theAllocatortrait parameters. Instead ofAllocator<T, R, C>, use the simplerAllocator<R, C>.
- Add the
glam-0.27feature to enable conversion from/to types fromglamv0.27.
- Fix numerical issue on SVD with near-identity matrix.
- Add the
glam-0.25feature to enable conversion from/to types fromglamv0.25.
- Statically sized matrices are now serialized as tuples to match how serde serialized plain arrays.
- Don’t require
Scalarfor matrixPartialEqandEq.
- 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. - Add the
glam-0.24feature to enable conversion from/to types fromglamv0.24. - Add the
glam-0.25feature to enable conversion from/to types fromglamv0.25. - Add the
lerpmethod to points. - Implement
CloneforMatrixIter.
- Fixed severe catastrophic cancellation issue in variance calculation.
- Add the
glam-0.23to enable conversion from/to type fromglamv0.23.
- Updated
nalgebra-macrosto use the newDyn, avoiding macro-generated deprecation warnings.
- Renamed all
MatrixSlicetypes toMatrixView. In general all occurrences of the worldSliceorslicehave been replaced byVieworview. - Deprecated all the types involving
Slicein its name, in favor of the wordView. - Make it so that most
nalgebraobjects archive as themselves (when usingrkyvfor serialization). - Renamed
DynamictoDynand makeDyna tuple struct.
- Add
Cholesky::ln_determinantto 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_viewandMatrix::as_view_mut, which are very useful when working with view-based APIs. - Added parallel column iterator using
rayon:Matrix::par_column_iterandMatrix::par_column_iter_mut. Therayonfeature must be enabled to access these methods. - Implement
ReshapableStoragefor matrix slices (only for unit strides at the moment). - Add
U0, U1, …constants alongside theU0, U1, …types. This lets us writeU4instead ofU4::name()orConst::<4>when we need const dimensions.
- Fixed the implementation of
Rotation3::euler_anglesto return the angles in the documented order (roll, pitch, yaw).
- Add a
convert-glam022feature to enable conversion betweennalgebraandglam v0.22.
- Add
Matrix::try_castto attempt casting the inner scalar types when that cast may fail.
- Fixed the usage of
CheckByteswithrkyv.
- Use
#[inline]on theDimimplementation forConstto improve opt-level 1 performance. - Make the
Point::newconstructions const-fn.
- Add
UnitVector::castto change the underlying scalar type.
- Improve performances of multiplication of two sparse matrices.
- Add
Matrix::from_row_iteratorto build a matrix from an iterator yielding components in row-major order. - Add support for conversion from/to types of
glam0.21. nalgebra-sparse: add support for the matrix-market export of sparse matrices.nalgebra-lapack: add aGEfor solving the generalized eigenvalues problem.
- Fix
Rotation3::from_matrixandUnitQuaternion::from_matrixwhen the input matrix is already a valid rotation matrix.
- Switch to
cust0.3 (for CUDA support). - Switch to
rkyv0.7 - Remove support for serialization based on
abomonation. - Remove support for conversions between
nalgebratypes andglam0.13.
- The aliases for
Consttypes have been simplified to helprust-analyzer.
- Add
TryFromconversion betweenUnitVector2/3/4andglam’sVec2/3/4. nalgebra-sparse: added support for serialization of sparse matrices withserde.nalgebra-sparse: add a CSC matrix constructor from unsorted (but valid) data.nalgebra-lapack: add generalized eigenvalues/eigenvectors calculation + QZ decomposition.
- Improve stability of SVD.
- Fix slerp for
UnitComplex.
- Add conversion from/to types of
glam0.19 and 0.20.
- The
Dimtrait is now marked as unsafe. - The
Matrix::powandMatrix::pow_mutmethods only allow positive integer exponents now. To compute negative exponents, the user is free to invert the matrix before callingpowwith the exponent’s absolute value. - Remove the
Boundedrequirement fromRealField. Replace it by methods returningOption<Self>so that they can still be implemented by unbounded types (by returningNone). - The
ComplexFieldtrait derives fromFromPrimitiveagain. We can actually keep this because all its methods returnOption<Self>, meaning that it could be implemented by any type.
- 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_unorderedinstead to reproduce the older behavior without the sorting overhead. - The
UnitDualQuaternion::sclerpmethod will no longer panic when given two equal rotations. - The
Matrix::select_rowsandMatrix::select_columnsmethods no longer require the matrix components to implement the traitZero. - The
Matrix::powandMatrix::pow_mutmethods will now also work with integer matrices.
- Added the conversion trait
From<Vec<T>>and methodfrom_vec_storageforRowDVector. - Added implementation of
FromandIntofor converting betweennalgebratypes and types fromglam 0.18. These can be enabled by enabling theconvert-glam018cargo features. - Added the methods
Matrix::product,::row_product,::row_product_tr, and::column_productto compute the product of the components, rows, or columns, of a single matrix or vector. - The
Defaulttrait is now implemented for most geometric types:Point,Isometry,Rotation,Similarity,Transform,UnitComplex, andUnitQuaternion. - Added the
Scalegeometric type for representing non-uniform scaling. - Added
Cholesky::new_with_substitutethat will replace diagonal elements by a given constant wheneverCholeskymeets a non-definite-positiveness. - Re-added the conversion from a vector/matrix slice to a static array.
- Added the
cudafeature that enables the support of rust-cuda for usingnalgebrafeatures with CUDA kernels written in Rust. - Added special-cases implementations for the 2x2 and 3x3 SVDs for better accuracy and performances.
- Added the methods
Matrix::polar,Matrix::try_polar, andSVD::to_polarto compute the polar decomposition of a matrix, based on its SVD. nalgebra-sparse: provide constructors for unsorted but otherwise valid data using the CSR format.nalgebra-sparse: added reading MatrixMarked data files to a sparseCooMatrix.
- Fixed a potential unsoundness with
matrix.get(i)andmatrix.get_mut(i)whereiis anusize, andmatrixis a matrix slice with non-default strides. - Fixed potential unsoundness with
vector.perpwherevectorisn’t actually a 2D vector as expected. - Fixed linkage issue with
nalgebra-lapack: the user ofnalgebra-lapackno longer have to addextern crate lapack-srcto theirmain.rs. - Fixed the
no-stdbuild ofnalgebra-glm. - Fix the
powandpow_mutfunctions (the result was incorrect for some exponent values).
- We updated to the version 0.6 of
simba. This means that the trait boundsT: na::RealField,na::ComplexField,na::SimdRealField,na:SimdComplexFieldno imply thatT: Copy(they only imply thatT: Clone). This may affect generic code. - The closure given to
apply,zip_apply,zip_zip_applymust now modify the first argument inplace, instead of returning a new value. This makes these methods more versatile, and avoid useless clones when using non-Copy scalar types. - The
Allocatortrait signature has been significantly modified in order to handle uninitialized matrices in a sound way.
Orthographic3::from_matrix_uncheckedis nowconst fn.Perspective3::from_matrix_uncheckedis nowconst fn.Rotation::from_matrix_uncheckedis nowconst fn.- The
Scalaris now automatically implemented for most'static + Clonetypes. Type that implementClonebut notCopyare now much safer to work with thanks to the refactoring of theAllocatorsystem.
- The conversion traits form the
bytemuckcrates are now implemented for the geometric types too. - Added operator overloading for
Transform * UnitComplex,UnitComplex * Transform,Transform ×= UnitComplex,Transform ÷= UnitComplex. - Added
Reflection::bias()to retrieve the bias of the reflection. - Added
Reflection1..Reflection6aliases for 1D to 6D reflections. - Added implementation of
FromandIntofor converting betweennalgebratypes and types fromglam 0.16andglam 0.17. These can be enabled by enabling theconvert-glam016, and/orconvert-glam017cargo features.
- Implement
HashforTransform. - Implement
BorrowandBorrowMutfor contiguous slices.
- 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 typePoint<T, const D: usize>is now an alias forOPoint. This changes doesn't affect any of the existing code usingPoint. However, it will allow the useOPointin 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
selfinstead of&self) but this should not have any practical infulances on existing codebase. - The
Point::newconstructors are no longer const-fn. This is due to some limitations in const-fn not allowing custom trait-bounds. Use thepoint!macro instead to build points in const environments. Dynamic::newandUnit::new_uncheckedare now const-fn.- Methods returning
Result<(), ()>now returnboolinstead.
- Fixed a potential unsoundess issue when converting a mutable slice to a
&mut[T].
- Fixed a bug in the conversion from
glam::Vec2orglam::DVec2toIsometry2.
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.
- Add macros
matrix!,dmatrix!,vector!,dvector!,point!for constructing matrices/vectors/points in a more convenient way. See #886 and #899. - Add
CooMatrix::reservetonalgebra-sparse. - Add basic support for serialization using
rkyv. Can be enabled with the featuresrkyv-serializeorrkyv-serialize-no-std.
- Fixed a potential unsoundness issue after deserializing an invalid
DVectorusingserde.
- Conversion from an array
[T; D]to an isometryIsometry<T, _, D>(as a translation). - Conversion from a static vector
SVector<T; D>to an isometryIsometry<T, _, D>(as a translation). - Conversion from a point
Point<T; D>to an isometryIsometry<T, _, D>(as a translation). - Conversion of an array
[T; D]from/to a translationTranslation<T, D>. - Conversion of a point
Point<T, D>to a translationTranslation<T, D>. - Conversion of the tuple of glam types
(Vec3, Quat)from/to anIsometry2orIsometry3. - Conversion of a glam type
Vec2/3/4from/to aTranslation2/3/4.
Fix a regression introduced in 0.26.0 preventing DVector from being serialized with serde.
This release integrates min-const-generics to nalgebra. See
our blog post
for details about this release.
- Add type aliases for unit vector, e.g.,
UnitVector3. - Add a
powandpow_mutfunction to square matrices. - Add
Cholesky::determinantto compute the determinant of a matrix decomposed with Cholesky. - Add the
serde-serialize-no-stdfeature to enable serialization of static matrices/vectors with serde, but without requiringstd.
- The
serdecrate isn't enabled by default now. Enable theserde-serializeor theserde-serialize-no-stdfeatures instead. - The
Const<const D: usize>type has been introduced to represent dimensions known at compile-time. This replaces the type-level integers fromtypenumas well as theU1, U2, ..., U127types fromnalgebra. TheseU1, U2, ..., U127are now just aliases forConst<D>, e.g.,type U2 = Const<2>. - The
ArrayStoragenow uses a standard array[[T; R]; C]instead of aGenericArray. - Many trait bounds were changed to accommodate const-generics. Most of these changes should be transparent wrt. non-generic code.
- The
MatrixMNalias has been deprecated. UseOMatrixorSMatrixinstead. - The
MatrixN<T, D>alias has been deprecated. UseOMatrix<T, D, D>orSMatrixinstead. - The
VectorN<T, D>alias has been deprecated. UseOVectororSVectorinstead. - The
Point,Translation,Isometry,Similarity, andTransformationtypes now take an integer for their dimension (instead of a type-level integer). - The type parameter order of
Isometry,Similarity,Transformationchanged to put the integer dimensions in the last position (this is required by the compiler). - The
::newconstructors of translations, points, matrices, and vectors of dimensions<= 6are nowconst fn, making them usable to define constant globals. TheQuaternion::newconstructor is also aconst fnnow.
- Fix a compilation error when only the
serde-serializefeature is enabled.
- The
Vector::simd_cap_magnitudemethod to cap the magnitude of the vector with SIMD components.
- A
convert-glamcargo feature to enable implementations ofFromtraits to convert betweenglamtypes andnalgebratypes. - A
convert-glam-uncheckedcargo feature to enable some extraglam/nalgebraconversions that may lead to unexpected results if used improperly. For example, this enables the conversion from aglam::Mat4to ana::Isometry3. This conversion will be cheap (without any check) but willlead to unexpected results if the glam matrix contains non-isometric components (like scaling for example). - A
castmethod has been added to most types. This can be used to change the type of the components of a given entity. Example:vector.cast::<f32>().
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-stdcargo feature when targeting a#[no-std]environment. - The
randcargo feature when targeting astdenvironment.
This updates all the dependencies of nalgebra to their latest version, including:
- rand 0.8
- proptest 1.0
- simba 0.4
Alongside this release of nalgebra, we are releasing nalgebra-sparse: a crate dedicated to sparse matrix
computation with nalgebra. The sparse module of nalgebraitself still exists for backward compatibility,
but it will be deprecated soon in favor of the nalgebra-sparse crate.
- Add
UnitDualQuaternion, a dual-quaternion with unit magnitude which can be used as an isometry transformation. - Add
UDU::new()andmatrix.udu()to compute the UDU factorization of a matrix. - Add
ColPivQR::new()andmatrix.col_piv_qr()to compute the QR decomposition with column pivoting of a matrix. - Add
from_basis_uncheckedto 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_magnitudeto cap the magnitude of a vector. - Add
UnitQuaternion::append_axisangle_linearizedto 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::SimdValueat the root of thenalgebracrate.
- The
DualQuaterniontype. 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.
- There is no blanket
impl<T> PartialEq for Unit<T>anymore. Instead, it is implemented specifically forUnitComplex,UnitQuaternionandUnit<Vector>.
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.
- The
Isometry::inv_mulmethod which is a more efficient way of doingisometry1.inverse() * isometry2.
In this release we improved the documentation of the matrix and vector types by:
- Grouping
implbocks 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
Matrixdirectly (instead of being aliases for other aliases).
- The
.inverse_transform_unit_vector(v)was added toRotation2/3,Isometry2/3,UnitQuaternion, andUnitComplex. It applies the corresponding rotation to a unit vectorUnit<Vector2/3>. - The
Point.map(f)andPoint.apply(f)to apply a function to each component of the point, similarly toVector.map(f)andVector.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 others set to zero. - The
Isometry.lerp_slerpandIsometry.try_lerp_slerpmethods to interpolate between two isometries using linear interpolation for the translational part, and spherical interpolation for the rotational part. - The
Rotation2.slerp,Rotation3.slerp, andUnitQuaternion.slerpmethod for spherical interpolation.
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.
- The
libmfeature that enableslibmwhen building forno-stdenvironment. - The
libm-forcefeature that enableslibmeven when building for a notno-stdenvironment. Cholesky::new_uncheckedwhich build a Cholesky decomposition without checking that its input is positive-definite. It can be used with SIMD types.- The
Defaulttrait is now implemented for matrices, and quaternions. They are all filled with zeros, except forUnitQuaternionwhich is initialized with the identity. - Matrix exponential
matrix.exp(). - The
Vector::ith(i, x)that builds a vector filled with zeros except for thei-th component set tox.
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 crate which are both simpler, and allow for significant optimizations like AoSoA SIMD.
Refer to the monthly dimforge blogpost for details about this switch and its benefits.
- It is now possible to use SIMD types like
simba::f32x4as scalar types for nalgebra's matrices and geometric types.
- Use of traits like
alga::general::{RealField, ComplexField}have now been replaced bysimba::scalar::{RealField, ComplexField}. - The implementation of traits from the alga crate (and well as the dependency to alga_) are now
omitted unless the
algacargo feature is activated.
- The
Negunary operator is no longer implemented forUnitComplexandUnitQuaternion. This caused hard-to-track errors when we mistakenly write, e.g.,-q * vinstead of-(q * v). - The
na::convert_uncheckedis no longer marked as unsafe.
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
FromandIntofor the conversion between matrix slices and standard (&[N]&mut [N]) slices.
- We started some major changes in order to allow non-Copy types to be used as scalar types inside of matrices/vectors.
.remove_rows_atandremove_columns_atwhich 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."
- It is now possible to get the
min/maxelement of unsigned integer matrices.
- Some infinite and reversed perspectives:
::infinite_perspective_rh_no,::infinite_perspective_rh_zo,::reversed_perspective_rh_zo, and::reversed_infinite_perspective_rh_zo.
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.
- 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_divfor quaternions. - Add
.renormalizetoUnit<...>andRotation3to correct potential drift due to repeated operations. Those drifts could cause them not to be pure rotations anymore.
.convolve_full(kernel)returns the convolution ofselfbykernel..convolve_valid(kernel)returns the convolution ofselfbykernelafter removal of all the elements relying on zero-padding..convolve_same(kernel)returns the convolution ofselfbykernelwith a result of the same size asself.
- Add the
::from_matrixconstructor too all rotation types to extract a rotation from a raw matrix. - Add the
::from_matrix_epsconstructor too all rotation types to extract a rotation from a raw matrix. This takes more argument than::from_matrixto 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 ofself.adjoint() * b. - Add
.ad_mul_to(b)which is the same as.ad_mulbut 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 toself.adjoint() * rhs..gerc(alpha, x, y, beta)equivalent toself = alpha * x * y.adjoint() + beta * self.hegercwhich is likegercbut for Hermitian matrices..sygerwhich is the new name of.ger_symmwhich is equivalent toself = alpha * x * y.transpose() + beta * self..sygemvwhich is the new name of.gemv_symmwhich is equivalent toself = alpha * a * x + beta * selfwithasymmetric..hegemv(alpha, a, x, beta)which is like.sygemvbut withaHermitian..gemv_ad(alpha, a, x, beta)which is equivalent toself = alpha * a.adjoint() * x + beta * self..gemm_ad(alpha, a, b, beta)which is equivalent toself = alpha * a.adjoint() * b + beta * self..icamax()which returns the index of the complex vector component with the greatest L1-norm.
Note that all the other BLAS operation will continue to work for all fields, including floats and complex numbers.
RealSchurhas been renamedSchurbecause it can now work with complex matrices.
- Add swizzling up to dimension 3 for vectors. For example, you can do
v.zxy()as an equivalent toVector3::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 toPoint3::new(p.z, p.x, p.y). - Add
.copy_from_sliceto copy matrix components from a slice in column-major order. - Add
.dotto quaternions. - Add
.zip_zip_mapfor iterating on three matrices simultaneously, and applying a closure to them. - Add
.slerpand.try_slerpto unit vectors. - Add
.lerpto vectors. - Add
.to_projectiveand.as_projectivetoPerspective3andOrthographic3in order to use them asProjective3structures. - Add
From/Intoimpls to allow the conversion of any transformation type to a matrix. - Add
Intoimpls to convert a matrix slice into an owned matrix. - Add
Point*::from_sliceto create a point from a slice. - Add
.map_with_locationto matrices to apply a map which passes the component indices to the user-defined closure alongside the component itself. - Add impl
From<Vector>forPoint. - Add impl
From<Vector4>forQuaternion. - Add impl
From<Vector>forTranslation. - Add the
::from_vecconstructor to construct a matrix from aVec(aDMatrixwill reuse the originalVecas-is for its storage). - Add
.to_homogeneousto 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 providedVecis 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 the matrix being extended. - Implement
Extend<Vec>for vectors with a dynamic storage. This will concatenate the vector with the givenVec. - Implement
Extend<Matrix<...>>for matrices with dynamic storage. This will concatenate the columns of both matrices. - Implement
Into<Vec>for theMatrixVecstorage. - Implement
Hashfor all matrices. - Add a
.len()method to retrieve the size of aMatrixVec.
- The orthographic projection no longer require that
bottom < top, thatleft < right, and thatznear < zfar. The only restriction now ith that they must not be equal (in which case the projection would be singular). - The
Point::from_coordinatesmethods is deprecated. UsePoint::frominstead. - The
.transform_pointand.transform_vectormethods are now inherent methods for matrices so that the user does not have to explicitly import theTransformtrait from the alga crate. - Renamed the matrix storage types:
MatrixArray->ArrayStorageandMatrixVec->VecStorage. - Renamed
.unwrap()to.into_inner()for geometric types that wrap another type. This is for the case ofUnit,Transform,Orthographic3,Perspective3,Rotation. - Deprecate several functions at the root of the crate (replaced by methods).
* Remove the `Deref` impl for `MatrixVec` as it could cause hard-to-understand compilation errors.
- 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).
All dependencies have been updated to their latest versions.
- Adjust
UnitQuaternions,Rotation3s, andRotation2s generated from theStandarddistribution to be uniformly distributed.
- Add a feature
stdwebto activate the dependency featurerand/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
Pointfrom an array by implementing theFromtrait. - Add support for generating uniformly distributed random unit column vectors using the
Standarddistribution.
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.
- Rename the
coremodule tobaseto avoid conflicts with thecorecrate implicitly imported when#![no_std]is enabled. - Constructors of the
MatrixSlice*types have been renamed fromnew_*tofrom_slice_*. This was necessary to avoid theincoherent_fundamental_implslint that is going to become a hard error.
- Add
UnitQuaternionconstructor::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(...)toUnitComplexto compute the rotation matrix between two 2D unit vectors. - Add methods
.axis_angle()toUnitComplexandUnitQuaternionin order to retrieve both the unit rotation axis, and the rotation angle simultaneously. - Add functions to construct a random matrix with a user-defined distribution:
::from_distribution(...).
- Allow the
Isometry * Unit<Vector>multiplication.
- Add blas-like operations:
.quadform(...)and.quadform_tr(...)to compute respectively the quadratic formsself = alpha * A.transpose() * B * A + beta * selfandalpha * A * B * A.transpose() + beta * self. Here,A, Bare matrices withBsquare, andalpha, betaare reals. - Add blas-like operations:
.gemv_tr(...)that behaves like.gemvexcept that the provided matrix is assumed to be transposed. - Add blas-like operations:
cmpy, cdpyfor component-wise multiplications and division with scalar factors:self <- alpha * self + beta * a * bself <- alpha * self + beta * a / b
.cross_matrix()returns the cross-product matrix of a given 3D vector, i.e., the matrixMsuch that for all vectorvwe haveM * v == self.cross(&v)..iamin()that returns the index of the vector entry with the smallest absolute value.- The
mintfeature that can be enabled in order to allow conversions from and to types of the mint crate. - Aliases for matrix and vector slices. Their are named by adding
Slicebefore the dimension numbers, i.e., a 3x5 matrix slice with dimensions known at compile-time is calledMatrixSlice3x5. A vector slice with dimensions unknown at compile-time is calledDVectorSlice. - Add functions for constructing matrix slices from a slice
&[N], e.g.,MatrixSlice2::new(...)andMatrixSlice2::new_with_strides(...). - The
::repeat(...)constructor that is an alternative name to::from_element(...). UnitQuaternion::scaled_rotation_between_axis(...)andUnitQuaternion::rotation_between_axis(...)that take Unit vectors instead of Vector as arguments.
The nalgebra-lapack crate has been updated. This now includes a broad range matrix decompositions using LAPACK bindings.
This adds support for serialization using the abomonation crate.
- 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 far), the step is the number of ignored row/columns between each row/column. Thus, a step of 0 means that no row/column is ignored. For example, a step of, say, 3 on previous versions should now bet set to 2.
- The trait
Axpyhas been replaced by a method.axpy. - The alias
MatrixNMis now deprecated. UseMatrixMNinstead (we reordered M and N to be in alphabetical order). - In-place componentwise multiplication and division
.component_mul_mut(...)and.component_div_mut(...)have been deprecated for a future renaming. Use.component_mul_assign(...)and.component_div_assign(...)instead.
alga::general::Realis now re-exported by nalgebra. elements.)::zeros(...)that creates a matrix filled with zeroes.::from_partial_diagonal(...)that creates a matrix from diagonal elements. The matrix can be rectangular. If not enough elements are provided, the rest of the diagonal is set to 0..conjugate_transpose()computes the transposed conjugate of a complex matrix..conjugate_transpose_to(...)computes the transposed conjugate of a complex matrix. The result written into a user-provided matrix..transpose_to(...)is the same as.transpose()but stores the result in the provided matrix..conjugate_transpose_to(...)is the same as.conjugate_transpose()but stores the result in the provided matrix.- Implements
IntoIteratorfor&Matrix,&mut MatrixandMatrix. .mul_to(...)multiplies two matrices and stores the result to the given buffer..tr_mul_to(...)left-multipliesself.transpose()to another matrix and stores the result to the given buffer..add_scalar(...)that adds a scalar to each component of a matrix..add_scalar_mut(...)that adds in-place a scalar to each component of a matrix..kronecker(a, b)computes the kronecker product (i.e. matrix tensor product) of two matrices..apply(f)replaces each component of a matrix with the results of the closurefcalled on each of them.
Pure Rust implementation of some Blas operations:
.iamax()returns the index of the maximum value of a vector..axpy(...)computesself = a * x + b * self..gemv(...)computesself = alpha * a * x + beta * selfwith a matrix and vectoraandx..ger(...)computesself = alpha * x^t * y + beta * selfwherexandyare vectors..gemm(...)computesself = alpha * a * b + beta * selfwhereaandbare matrices..gemv_symm(...)is the same as.gemvexcept thatselfis assumed symmetric..ger_symm(...)is the same as.gerexcept thatselfis 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..fill_with_identity(...)fills the matrix with the identity..fill_diagonal(...)fills the matrix diagonal with a single value..fill_row(...)fills a selected matrix row with a single value..fill_column(...)fills a selected matrix column with a single value..set_diagonal(...)sets the matrix diagonal..set_row(...)sets a selected row..set_column(...)sets a selected column..fill_lower_triangle(...)fills some sub-diagonals below the main diagonal with a value..fill_upper_triangle(...)fills some sub-diagonals above the main diagonal with a value..swap_rows(...)swaps two rows..swap_columns(...)swaps two columns.
Column removal:
.remove_column(...)removes one column..remove_fixed_columns<D>(...)removesDcolumns..remove_columns(...)removes a number of columns known at run-time.
Row removal:
.remove_row(...)removes one row..remove_fixed_rows<D>(...)removesDrows..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>(...)addsDcolumns 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>(...)addsDrows at the given position..insert_rows(...)adds at the given position a number of rows known at run-time.
The main change of this release is the update of the dependency serde to 1.0.
.trace()that computes the trace of a matrix (the sum of its diagonal elements.)
The website 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 crate.
All other mathematical traits, except
Axpyhave been removed from nalgebra. - Methods are now preferred to free functions because they do not require any trait to be used anymore.
- Most algebraic entities can be parametrized by type-level integers
to specify their dimensions. Using
Dynamicinstead of a type-level integer indicates that the dimension known at run-time only. - Statically-sized rectangular matrices.
- More transformation types have been added: unit-sized complex numbers (for
2D rotations), affine/projective/general transformations with
Affine2/3,Projective2/3, andTransform2/3. - Serde serialization is now supported instead of
rustc_serialize. Enable it with theserde-serializefeature. - Matrix slices are now implemented.
Lots of features including rectangular matrices, slices, and Serde serialization. Refer to the brand new website for more details. The following free-functions have been added as well:
::id()that returns the universal identity element of typeId.
::inf_sup()that returns both the infimum and supremum of a value at the same time.::partial_sort2()that attempts to sort two values in increasing order.::wrap()that moves a value to the given interval by adding or removing the interval width to it.
::cast->::convertpoint.as_vector()->point.coordsna::origin->P::origin()na::is_zero->.is_zero()(from num::Zero).transform->.transform_point/.transform_vector.translate->.translate_point::dimension::<P>->::dimension::<P::Vector>::angle_between->::angle
Componentwise multiplication and division has been replaced by methods:
- multiplication ->
.componentwise_mul,.componentwise_mul_mut. - division ->
.componentwise_div,.componentwise_div_mut.
The following free-functions are now replaced by methods (with the same names)
only:
::cross, ::cholesky, ::determinant, ::diagonal, ::eigen_qr (becomes
.eig), ::hessenberg, ::qr, ::to_homogeneous, ::to_rotation_matrix,
::transpose, ::shape.
The following free-functions are now replaced by static methods only:
::householder_matrixunder the name::new_householder_generic::identity::new_identityunder the name::identity::from_homogeneous::repeatunder the name::from_element
The following free-function are now replaced methods accessible through traits only:
::transform-> methods.transform_pointand.transform_vectorof thealga::linear::Transformationtrait.::inverse_transform-> methods.inverse_transform_pointand.inverse_transform_vectorof thealga::linear::ProjectiveTransformationtrait.::translate,::inverse_translate,::rotate,::inverse_rotate-> methods from thealga::linear::Similaritytrait instead. Those have the same names but end with_pointor_vector, e.g.,.translate_pointand.translate_vector.::orthonormal_subspace_basis-> method with the same name fromalga::linear::FiniteDimInnerSpace.::canonical_basis_elementand::canonical_basis-> methods with the same names fromalga::linear::FiniteDimVectorSpace.::rotation_between-> method with the same name from thealga::linear::Rotationtrait.::is_zero-> method with the same name fromnum::Zero.
-
The free functions
::prepend_rotation,::append_rotation,::append_rotation_wrt_center,::append_rotation_wrt_point,::append_transformation, and::append_translationhave been removed. Instead, create the rotation or translation object explicitly and use multiplication to compose it with anything else. -
The free function
::outerhas been removed. Use column-vector × row-vector multiplication instead. -
::approx_eq,::approx_eq_epshave been removed. Use therelative_eq!macro from the approx crate instead. -
::covariancehas been removed. There is no replacement for now. -
::meanhas been removed. There is no replacement for now. -
::sample_spherehas been removed. There is no replacement for now. -
::cross_matrixhas been removed. There is no replacement for now. -
::absolute_rotatehas been removed. There is no replacement for now. -
::rotation,::transformation,::translation,::inverse_rotation,::inverse_transformation,::inverse_translationhave been removed. Use the appropriate methods/field of each transformation type, e.g.,rotation.angle()androtation.axis().
Binary operations are now allowed between references as well. For example
Vector3<f32> + &Vector3<f32> is now possible.
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:
<T as ApproxEq>::approx_epsilon(). This replaces the old form:
ApproxEq::approx_epsilon(None::<T>).
- Renamed:
::from_col_vector->::from_column_vector::from_col_iter->::from_column_iter.col_slice->.column_slice.set_col->.set_column::canonical_basis_with_dim->::canonical_basis_with_dimension::from_elem->::from_elementDiagMut->DiagonalMutUnitQuaternion::newbecomesUnitQuaternion::from_scaled_axisorUnitQuaternion::from_axisangle. The new::newmethod now requires a not-normalized quaternion.
Method names starting with new_with_ now start with from_. This is more
idiomatic in Rust.
The Norm trait now uses an associated type instead of a type parameter.
Other similar trait changes are to be expected in the future, e.g., for the
Diagonal trait.
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_uncheckedPerspectiveMatrix3::new_with_matrix->PerspectiveMatrix3::from_matrix_uncheckedOrthographicMatrix3::new_with_matrix->OrthographicMatrix3::from_matrix_unchecked
- A
Unit<T>type that wraps normalized values. In particular,UnitQuaternion<N>is now an alias forUnit<Quaternion<N>>. .ln(),.exp()and.powf(..)for quaternions and unit quaternions.::from_parts(...)to build a quaternion from its scalar and vector parts.- The
Normtrait now has atry_normalize()that returnsNoneif the norm is too small. - The
BaseFloatandFloatVectortraits now inherit fromApproxEqas well. It is clear that performing computations with floats requires approximate equality.
Still WIP: add implementations of abstract algebra traits from the algebra
crate for vectors, rotations and points. To enable them, activate the
abstract_algebra feature.
- Almost everything (types, methods, and traits) now use fulls names instead
of abbreviations (e.g.
Vec3becomesVector3). Most changes are obvious. Note however that:::sqnormbecomes::norm_squared.::sqdistbecomes::distance_squared.::abs,::min, etc. did not change as this is a common name for absolute values on, e.g., the libc.- Dynamically sized structures keep the
Dprefix, e.g.,DMatbecomesDMatrix.
- All files with abbreviated names have been renamed to their full version,
e.g.,
vec.rsbecomesvector.rs.
- Added implementation of assignment operators (+=, -=, etc.) for everything.
- Points and vectors are now linked to each other with associated types (on the PointAsVector trait).
Announcement: a users forum has been created for nalgebra, ncollide, and nphysics. See
you there!
- Added a dependency to generic-array. Feature-gated:
requires
features="generic_sizes". - Added statically sized vectors with user-defined sizes:
VectorN. Feature-gated: requiresfeatures="generic_sizes". - Added similarity transformations (an uniform scale followed by a rotation followed by a
translation):
Similarity2,Similarity3.
- Removed zero-sized elements
Vector0,Point0. - Removed 4-dimensional transformations
Rotation4andIsometry4(which had an implementation too incomplete to be useful).
- 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_atreimplemented and renamed to::look_at_rhand::look_at_lhto agree with the computer graphics community (in particular, the GLM library). Use the::look_at_rhvariant to build a view matrix that may be successfully used withPerspandOrtho.- The old
{Isometry3, Rotation3}::look_atimplementations are now called::new_observer_frame. - Rename every
fovonPersptofovy. - Fixed the perspective and orthographic projection matrices.