Deplecate Dynamic and Dynamic::new

This commit is contained in:
Sébastien Crozet 2023-01-14 16:22:27 +01:00
parent 3508280929
commit 711ac67da9
36 changed files with 570 additions and 583 deletions

View File

@ -2,7 +2,7 @@
extern crate nalgebra as na; extern crate nalgebra as na;
use na::{DMatrix, Dynamic, Matrix2x3, Matrix3x2, Const}; use na::{DMatrix, Dyn, Matrix2x3, Matrix3x2, Const};
fn main() { fn main() {
// Matrices can be reshaped in-place without moving or copying values. // Matrices can be reshaped in-place without moving or copying values.
@ -46,9 +46,9 @@ fn main() {
], ],
); );
let dm3 = dm1.reshape_generic(Dynamic::new(6), Dynamic::new(2)); let dm3 = dm1.reshape_generic(Dyn(6), Dyn(2));
assert_eq!(dm3, dm2); assert_eq!(dm3, dm2);
// Invalid reshapings of dynamic matrices will panic at run-time. // Invalid reshapings of dynamic matrices will panic at run-time.
//let dm4 = dm3.reshape_generic(Dynamic::new(6), Dynamic::new(6)); //let dm4 = dm3.reshape_generic(Dyn(6), Dyn(6));
} }

View File

@ -191,8 +191,8 @@ pub fn dmatrix(stream: TokenStream) -> TokenStream {
let output = quote! { let output = quote! {
nalgebra::DMatrix::<_> nalgebra::DMatrix::<_>
::from_vec_storage(nalgebra::VecStorage::new( ::from_vec_storage(nalgebra::VecStorage::new(
nalgebra::Dynamic::new(#row_dim), nalgebra::Dyn(#row_dim),
nalgebra::Dynamic::new(#col_dim), nalgebra::Dyn(#col_dim),
vec!#array_tokens)) vec!#array_tokens))
}; };
@ -285,7 +285,7 @@ pub fn dvector(stream: TokenStream) -> TokenStream {
let output = quote! { let output = quote! {
nalgebra::DVector::<_> nalgebra::DVector::<_>
::from_vec_storage(nalgebra::VecStorage::new( ::from_vec_storage(nalgebra::VecStorage::new(
nalgebra::Dynamic::new(#len), nalgebra::Dyn(#len),
nalgebra::Const::<1>, nalgebra::Const::<1>,
vec!#array_tokens)) vec!#array_tokens))
}; };

View File

@ -10,7 +10,7 @@ use nalgebra::allocator::Allocator;
use nalgebra::base::storage::RawStorage; use nalgebra::base::storage::RawStorage;
use nalgebra::constraint::{DimEq, ShapeConstraint}; use nalgebra::constraint::{DimEq, ShapeConstraint};
use nalgebra::{ use nalgebra::{
ClosedAdd, ClosedDiv, ClosedMul, ClosedSub, DefaultAllocator, Dim, Dynamic, Matrix, OMatrix, ClosedAdd, ClosedDiv, ClosedMul, ClosedSub, DefaultAllocator, Dim, Dyn, Matrix, OMatrix,
Scalar, U1, Scalar, U1,
}; };
use num_traits::{One, Zero}; use num_traits::{One, Zero};
@ -273,8 +273,8 @@ macro_rules! impl_spmm_cs_dense {
// Implement ref-ref // Implement ref-ref
impl_spmm_cs_dense!(&'a $matrix_type_name<T>, &'a Matrix<T, R, C, S>, $spmm_fn, |lhs, rhs| { impl_spmm_cs_dense!(&'a $matrix_type_name<T>, &'a Matrix<T, R, C, S>, $spmm_fn, |lhs, rhs| {
let (_, ncols) = rhs.shape_generic(); let (_, ncols) = rhs.shape_generic();
let nrows = Dynamic::new(lhs.nrows()); let nrows = Dyn(lhs.nrows());
let mut result = OMatrix::<T, Dynamic, C>::zeros_generic(nrows, ncols); let mut result = OMatrix::<T, Dyn, C>::zeros_generic(nrows, ncols);
$spmm_fn(T::zero(), &mut result, T::one(), Op::NoOp(lhs), Op::NoOp(rhs)); $spmm_fn(T::zero(), &mut result, T::one(), Op::NoOp(lhs), Op::NoOp(rhs));
result result
}); });
@ -302,21 +302,21 @@ macro_rules! impl_spmm_cs_dense {
R: Dim, R: Dim,
C: Dim, C: Dim,
S: RawStorage<T, R, C>, S: RawStorage<T, R, C>,
DefaultAllocator: Allocator<T, Dynamic, C>, DefaultAllocator: Allocator<T, Dyn, C>,
// TODO: Is it possible to simplify these bounds? // TODO: Is it possible to simplify these bounds?
ShapeConstraint: ShapeConstraint:
// Bounds so that we can turn OMatrix<T, Dynamic, C> into a DMatrixSliceMut // Bounds so that we can turn OMatrix<T, Dyn, C> into a DMatrixSliceMut
DimEq<U1, <<DefaultAllocator as Allocator<T, Dynamic, C>>::Buffer as RawStorage<T, Dynamic, C>>::RStride> DimEq<U1, <<DefaultAllocator as Allocator<T, Dyn, C>>::Buffer as RawStorage<T, Dyn, C>>::RStride>
+ DimEq<C, Dynamic> + DimEq<C, Dyn>
+ DimEq<Dynamic, <<DefaultAllocator as Allocator<T, Dynamic, C>>::Buffer as RawStorage<T, Dynamic, C>>::CStride> + DimEq<Dyn, <<DefaultAllocator as Allocator<T, Dyn, C>>::Buffer as RawStorage<T, Dyn, C>>::CStride>
// Bounds so that we can turn &Matrix<T, R, C, S> into a DMatrixSlice // Bounds so that we can turn &Matrix<T, R, C, S> into a DMatrixSlice
+ DimEq<U1, S::RStride> + DimEq<U1, S::RStride>
+ DimEq<R, Dynamic> + DimEq<R, Dyn>
+ DimEq<Dynamic, S::CStride> + DimEq<Dyn, S::CStride>
{ {
// We need the column dimension to be generic, so that if RHS is a vector, then // We need the column dimension to be generic, so that if RHS is a vector, then
// we also get a vector (and not a matrix) // we also get a vector (and not a matrix)
type Output = OMatrix<T, Dynamic, C>; type Output = OMatrix<T, Dyn, C>;
fn mul(self, rhs: $dense_matrix_type) -> Self::Output { fn mul(self, rhs: $dense_matrix_type) -> Self::Output {
let $lhs = self; let $lhs = self;

View File

@ -1,5 +1,5 @@
#[cfg(any(feature = "alloc", feature = "std"))] #[cfg(any(feature = "alloc", feature = "std"))]
use crate::base::dimension::Dynamic; use crate::base::dimension::Dyn;
use crate::base::dimension::{U1, U2, U3, U4, U5, U6}; use crate::base::dimension::{U1, U2, U3, U4, U5, U6};
use crate::base::storage::Owned; use crate::base::storage::Owned;
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
@ -48,69 +48,69 @@ pub type SMatrix<T, const R: usize, const C: usize> =
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub type DMatrix<T> = Matrix<T, Dynamic, Dynamic, VecStorage<T, Dynamic, Dynamic>>; pub type DMatrix<T> = Matrix<T, Dyn, Dyn, VecStorage<T, Dyn, Dyn>>;
/// A heap-allocated, column-major, matrix with a dynamic number of rows and 1 columns. /// A heap-allocated, column-major, matrix with a dynamic number of rows and 1 columns.
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub type MatrixXx1<T> = Matrix<T, Dynamic, U1, VecStorage<T, Dynamic, U1>>; pub type MatrixXx1<T> = Matrix<T, Dyn, U1, VecStorage<T, Dyn, U1>>;
/// A heap-allocated, column-major, matrix with a dynamic number of rows and 2 columns. /// A heap-allocated, column-major, matrix with a dynamic number of rows and 2 columns.
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub type MatrixXx2<T> = Matrix<T, Dynamic, U2, VecStorage<T, Dynamic, U2>>; pub type MatrixXx2<T> = Matrix<T, Dyn, U2, VecStorage<T, Dyn, U2>>;
/// A heap-allocated, column-major, matrix with a dynamic number of rows and 3 columns. /// A heap-allocated, column-major, matrix with a dynamic number of rows and 3 columns.
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub type MatrixXx3<T> = Matrix<T, Dynamic, U3, VecStorage<T, Dynamic, U3>>; pub type MatrixXx3<T> = Matrix<T, Dyn, U3, VecStorage<T, Dyn, U3>>;
/// A heap-allocated, column-major, matrix with a dynamic number of rows and 4 columns. /// A heap-allocated, column-major, matrix with a dynamic number of rows and 4 columns.
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub type MatrixXx4<T> = Matrix<T, Dynamic, U4, VecStorage<T, Dynamic, U4>>; pub type MatrixXx4<T> = Matrix<T, Dyn, U4, VecStorage<T, Dyn, U4>>;
/// A heap-allocated, column-major, matrix with a dynamic number of rows and 5 columns. /// A heap-allocated, column-major, matrix with a dynamic number of rows and 5 columns.
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub type MatrixXx5<T> = Matrix<T, Dynamic, U5, VecStorage<T, Dynamic, U5>>; pub type MatrixXx5<T> = Matrix<T, Dyn, U5, VecStorage<T, Dyn, U5>>;
/// A heap-allocated, column-major, matrix with a dynamic number of rows and 6 columns. /// A heap-allocated, column-major, matrix with a dynamic number of rows and 6 columns.
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub type MatrixXx6<T> = Matrix<T, Dynamic, U6, VecStorage<T, Dynamic, U6>>; pub type MatrixXx6<T> = Matrix<T, Dyn, U6, VecStorage<T, Dyn, U6>>;
/// A heap-allocated, row-major, matrix with 1 rows and a dynamic number of columns. /// A heap-allocated, row-major, matrix with 1 rows and a dynamic number of columns.
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub type Matrix1xX<T> = Matrix<T, U1, Dynamic, VecStorage<T, U1, Dynamic>>; pub type Matrix1xX<T> = Matrix<T, U1, Dyn, VecStorage<T, U1, Dyn>>;
/// A heap-allocated, row-major, matrix with 2 rows and a dynamic number of columns. /// A heap-allocated, row-major, matrix with 2 rows and a dynamic number of columns.
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub type Matrix2xX<T> = Matrix<T, U2, Dynamic, VecStorage<T, U2, Dynamic>>; pub type Matrix2xX<T> = Matrix<T, U2, Dyn, VecStorage<T, U2, Dyn>>;
/// A heap-allocated, row-major, matrix with 3 rows and a dynamic number of columns. /// A heap-allocated, row-major, matrix with 3 rows and a dynamic number of columns.
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub type Matrix3xX<T> = Matrix<T, U3, Dynamic, VecStorage<T, U3, Dynamic>>; pub type Matrix3xX<T> = Matrix<T, U3, Dyn, VecStorage<T, U3, Dyn>>;
/// A heap-allocated, row-major, matrix with 4 rows and a dynamic number of columns. /// A heap-allocated, row-major, matrix with 4 rows and a dynamic number of columns.
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub type Matrix4xX<T> = Matrix<T, U4, Dynamic, VecStorage<T, U4, Dynamic>>; pub type Matrix4xX<T> = Matrix<T, U4, Dyn, VecStorage<T, U4, Dyn>>;
/// A heap-allocated, row-major, matrix with 5 rows and a dynamic number of columns. /// A heap-allocated, row-major, matrix with 5 rows and a dynamic number of columns.
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub type Matrix5xX<T> = Matrix<T, U5, Dynamic, VecStorage<T, U5, Dynamic>>; pub type Matrix5xX<T> = Matrix<T, U5, Dyn, VecStorage<T, U5, Dyn>>;
/// A heap-allocated, row-major, matrix with 6 rows and a dynamic number of columns. /// A heap-allocated, row-major, matrix with 6 rows and a dynamic number of columns.
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub type Matrix6xX<T> = Matrix<T, U6, Dynamic, VecStorage<T, U6, Dynamic>>; pub type Matrix6xX<T> = Matrix<T, U6, Dyn, VecStorage<T, U6, Dyn>>;
/// A stack-allocated, column-major, 1x1 square matrix. /// A stack-allocated, column-major, 1x1 square matrix.
/// ///
@ -276,7 +276,7 @@ pub type Matrix6x5<T> = Matrix<T, U6, U5, ArrayStorage<T, 6, 5>>;
*/ */
/// A dynamically sized column vector. /// A dynamically sized column vector.
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub type DVector<T> = Matrix<T, Dynamic, U1, VecStorage<T, Dynamic, U1>>; pub type DVector<T> = Matrix<T, Dyn, U1, VecStorage<T, Dyn, U1>>;
/// An owned D-dimensional column vector. /// An owned D-dimensional column vector.
pub type OVector<T, D> = Matrix<T, D, U1, Owned<T, D, U1>>; pub type OVector<T, D> = Matrix<T, D, U1, Owned<T, D, U1>>;
@ -316,7 +316,7 @@ pub type Vector6<T> = Matrix<T, U6, U1, ArrayStorage<T, 6, 1>>;
*/ */
/// A dynamically sized row vector. /// A dynamically sized row vector.
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub type RowDVector<T> = Matrix<T, U1, Dynamic, VecStorage<T, U1, Dynamic>>; pub type RowDVector<T> = Matrix<T, U1, Dyn, VecStorage<T, U1, Dyn>>;
/// An owned D-dimensional row vector. /// An owned D-dimensional row vector.
pub type RowOVector<T, D> = Matrix<T, U1, D, Owned<T, U1, D>>; pub type RowOVector<T, D> = Matrix<T, U1, D, Owned<T, U1, D>>;

View File

@ -1,4 +1,4 @@
use crate::base::dimension::{Dynamic, U1, U2, U3, U4, U5, U6}; use crate::base::dimension::{Dyn, U1, U2, U3, U4, U5, U6};
use crate::base::matrix_view::{ViewStorage, ViewStorageMut}; use crate::base::matrix_view::{ViewStorage, ViewStorageMut};
use crate::base::{Const, Matrix}; use crate::base::{Const, Matrix};
use crate::slice_deprecation_note; use crate::slice_deprecation_note;
@ -22,8 +22,8 @@ pub type SMatrixSlice<'a, T, const R: usize, const C: usize> =
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(DMatrixView)] #[deprecated = slice_deprecation_note!(DMatrixView)]
pub type DMatrixSlice<'a, T, RStride = U1, CStride = Dynamic> = pub type DMatrixSlice<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, Dynamic, ViewStorage<'a, T, Dynamic, Dynamic, RStride, CStride>>; Matrix<T, Dyn, Dyn, ViewStorage<'a, T, Dyn, Dyn, RStride, CStride>>;
/// A column-major 1x1 matrix slice. /// A column-major 1x1 matrix slice.
/// ///
@ -251,52 +251,52 @@ pub type MatrixSlice6x5<'a, T, RStride = U1, CStride = U6> =
/// A column-major matrix slice with 1 row and a number of columns chosen at runtime. /// A column-major matrix slice with 1 row and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixView1xX)] #[deprecated = slice_deprecation_note!(MatrixView1xX)]
pub type MatrixSlice1xX<'a, T, RStride = U1, CStride = U1> = pub type MatrixSlice1xX<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, Dynamic, ViewStorage<'a, T, U1, Dynamic, RStride, CStride>>; Matrix<T, U1, Dyn, ViewStorage<'a, T, U1, Dyn, RStride, CStride>>;
/// A column-major matrix slice with 2 rows and a number of columns chosen at runtime. /// A column-major matrix slice with 2 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixView2xX)] #[deprecated = slice_deprecation_note!(MatrixView2xX)]
pub type MatrixSlice2xX<'a, T, RStride = U1, CStride = U2> = pub type MatrixSlice2xX<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, Dynamic, ViewStorage<'a, T, U2, Dynamic, RStride, CStride>>; Matrix<T, U2, Dyn, ViewStorage<'a, T, U2, Dyn, RStride, CStride>>;
/// A column-major matrix slice with 3 rows and a number of columns chosen at runtime. /// A column-major matrix slice with 3 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixView3xX)] #[deprecated = slice_deprecation_note!(MatrixView3xX)]
pub type MatrixSlice3xX<'a, T, RStride = U1, CStride = U3> = pub type MatrixSlice3xX<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, Dynamic, ViewStorage<'a, T, U3, Dynamic, RStride, CStride>>; Matrix<T, U3, Dyn, ViewStorage<'a, T, U3, Dyn, RStride, CStride>>;
/// A column-major matrix slice with 4 rows and a number of columns chosen at runtime. /// A column-major matrix slice with 4 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixView4xX)] #[deprecated = slice_deprecation_note!(MatrixView4xX)]
pub type MatrixSlice4xX<'a, T, RStride = U1, CStride = U4> = pub type MatrixSlice4xX<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, Dynamic, ViewStorage<'a, T, U4, Dynamic, RStride, CStride>>; Matrix<T, U4, Dyn, ViewStorage<'a, T, U4, Dyn, RStride, CStride>>;
/// A column-major matrix slice with 5 rows and a number of columns chosen at runtime. /// A column-major matrix slice with 5 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixView5xX)] #[deprecated = slice_deprecation_note!(MatrixView5xX)]
pub type MatrixSlice5xX<'a, T, RStride = U1, CStride = U5> = pub type MatrixSlice5xX<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, Dynamic, ViewStorage<'a, T, U5, Dynamic, RStride, CStride>>; Matrix<T, U5, Dyn, ViewStorage<'a, T, U5, Dyn, RStride, CStride>>;
/// A column-major matrix slice with 6 rows and a number of columns chosen at runtime. /// A column-major matrix slice with 6 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixView6xX)] #[deprecated = slice_deprecation_note!(MatrixView6xX)]
pub type MatrixSlice6xX<'a, T, RStride = U1, CStride = U6> = pub type MatrixSlice6xX<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, Dynamic, ViewStorage<'a, T, U6, Dynamic, RStride, CStride>>; Matrix<T, U6, Dyn, ViewStorage<'a, T, U6, Dyn, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 1 column. /// A column-major matrix slice with a number of rows chosen at runtime and 1 column.
#[deprecated = slice_deprecation_note!(MatrixViewXx1)] #[deprecated = slice_deprecation_note!(MatrixViewXx1)]
pub type MatrixSliceXx1<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixSliceXx1<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U1, ViewStorage<'a, T, Dynamic, U1, RStride, CStride>>; Matrix<T, Dyn, U1, ViewStorage<'a, T, Dyn, U1, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 2 columns. /// A column-major matrix slice with a number of rows chosen at runtime and 2 columns.
#[deprecated = slice_deprecation_note!(MatrixViewXx2)] #[deprecated = slice_deprecation_note!(MatrixViewXx2)]
pub type MatrixSliceXx2<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixSliceXx2<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U2, ViewStorage<'a, T, Dynamic, U2, RStride, CStride>>; Matrix<T, Dyn, U2, ViewStorage<'a, T, Dyn, U2, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 3 columns. /// A column-major matrix slice with a number of rows chosen at runtime and 3 columns.
#[deprecated = slice_deprecation_note!(MatrixViewXx3)] #[deprecated = slice_deprecation_note!(MatrixViewXx3)]
pub type MatrixSliceXx3<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixSliceXx3<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U3, ViewStorage<'a, T, Dynamic, U3, RStride, CStride>>; Matrix<T, Dyn, U3, ViewStorage<'a, T, Dyn, U3, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 4 columns. /// A column-major matrix slice with a number of rows chosen at runtime and 4 columns.
#[deprecated = slice_deprecation_note!(MatrixViewXx4)] #[deprecated = slice_deprecation_note!(MatrixViewXx4)]
pub type MatrixSliceXx4<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixSliceXx4<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U4, ViewStorage<'a, T, Dynamic, U4, RStride, CStride>>; Matrix<T, Dyn, U4, ViewStorage<'a, T, Dyn, U4, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 5 columns. /// A column-major matrix slice with a number of rows chosen at runtime and 5 columns.
#[deprecated = slice_deprecation_note!(MatrixViewXx5)] #[deprecated = slice_deprecation_note!(MatrixViewXx5)]
pub type MatrixSliceXx5<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixSliceXx5<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U5, ViewStorage<'a, T, Dynamic, U5, RStride, CStride>>; Matrix<T, Dyn, U5, ViewStorage<'a, T, Dyn, U5, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 6 columns. /// A column-major matrix slice with a number of rows chosen at runtime and 6 columns.
#[deprecated = slice_deprecation_note!(MatrixViewXx6)] #[deprecated = slice_deprecation_note!(MatrixViewXx6)]
pub type MatrixSliceXx6<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixSliceXx6<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U6, ViewStorage<'a, T, Dynamic, U6, RStride, CStride>>; Matrix<T, Dyn, U6, ViewStorage<'a, T, Dyn, U6, RStride, CStride>>;
/// A column vector slice with dimensions known at compile-time. /// A column vector slice with dimensions known at compile-time.
/// ///
@ -314,8 +314,8 @@ pub type SVectorSlice<'a, T, const D: usize> =
/// A column vector slice dynamic numbers of rows and columns. /// A column vector slice dynamic numbers of rows and columns.
#[deprecated = slice_deprecation_note!(DVectorView)] #[deprecated = slice_deprecation_note!(DVectorView)]
pub type DVectorSlice<'a, T, RStride = U1, CStride = Dynamic> = pub type DVectorSlice<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U1, ViewStorage<'a, T, Dynamic, U1, RStride, CStride>>; Matrix<T, Dyn, U1, ViewStorage<'a, T, Dyn, U1, RStride, CStride>>;
/// A 1D column vector slice. /// A 1D column vector slice.
/// ///
@ -386,8 +386,8 @@ pub type SMatrixSliceMut<'a, T, const R: usize, const C: usize> =
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(DMatrixViewMut)] #[deprecated = slice_deprecation_note!(DMatrixViewMut)]
pub type DMatrixSliceMut<'a, T, RStride = U1, CStride = Dynamic> = pub type DMatrixSliceMut<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, Dynamic, ViewStorageMut<'a, T, Dynamic, Dynamic, RStride, CStride>>; Matrix<T, Dyn, Dyn, ViewStorageMut<'a, T, Dyn, Dyn, RStride, CStride>>;
/// A column-major 1x1 matrix slice. /// A column-major 1x1 matrix slice.
/// ///
@ -615,52 +615,52 @@ pub type MatrixSliceMut6x5<'a, T, RStride = U1, CStride = U6> =
/// A column-major matrix slice with 1 row and a number of columns chosen at runtime. /// A column-major matrix slice with 1 row and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixViewMut1xX)] #[deprecated = slice_deprecation_note!(MatrixViewMut1xX)]
pub type MatrixSliceMut1xX<'a, T, RStride = U1, CStride = U1> = pub type MatrixSliceMut1xX<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, Dynamic, ViewStorageMut<'a, T, U1, Dynamic, RStride, CStride>>; Matrix<T, U1, Dyn, ViewStorageMut<'a, T, U1, Dyn, RStride, CStride>>;
/// A column-major matrix slice with 2 rows and a number of columns chosen at runtime. /// A column-major matrix slice with 2 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixViewMut2xX)] #[deprecated = slice_deprecation_note!(MatrixViewMut2xX)]
pub type MatrixSliceMut2xX<'a, T, RStride = U1, CStride = U2> = pub type MatrixSliceMut2xX<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, Dynamic, ViewStorageMut<'a, T, U2, Dynamic, RStride, CStride>>; Matrix<T, U2, Dyn, ViewStorageMut<'a, T, U2, Dyn, RStride, CStride>>;
/// A column-major matrix slice with 3 rows and a number of columns chosen at runtime. /// A column-major matrix slice with 3 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixViewMut3xX)] #[deprecated = slice_deprecation_note!(MatrixViewMut3xX)]
pub type MatrixSliceMut3xX<'a, T, RStride = U1, CStride = U3> = pub type MatrixSliceMut3xX<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, Dynamic, ViewStorageMut<'a, T, U3, Dynamic, RStride, CStride>>; Matrix<T, U3, Dyn, ViewStorageMut<'a, T, U3, Dyn, RStride, CStride>>;
/// A column-major matrix slice with 4 rows and a number of columns chosen at runtime. /// A column-major matrix slice with 4 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixViewMut4xX)] #[deprecated = slice_deprecation_note!(MatrixViewMut4xX)]
pub type MatrixSliceMut4xX<'a, T, RStride = U1, CStride = U4> = pub type MatrixSliceMut4xX<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, Dynamic, ViewStorageMut<'a, T, U4, Dynamic, RStride, CStride>>; Matrix<T, U4, Dyn, ViewStorageMut<'a, T, U4, Dyn, RStride, CStride>>;
/// A column-major matrix slice with 5 rows and a number of columns chosen at runtime. /// A column-major matrix slice with 5 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixViewMut5xX)] #[deprecated = slice_deprecation_note!(MatrixViewMut5xX)]
pub type MatrixSliceMut5xX<'a, T, RStride = U1, CStride = U5> = pub type MatrixSliceMut5xX<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, Dynamic, ViewStorageMut<'a, T, U5, Dynamic, RStride, CStride>>; Matrix<T, U5, Dyn, ViewStorageMut<'a, T, U5, Dyn, RStride, CStride>>;
/// A column-major matrix slice with 6 rows and a number of columns chosen at runtime. /// A column-major matrix slice with 6 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixViewMut6xX)] #[deprecated = slice_deprecation_note!(MatrixViewMut6xX)]
pub type MatrixSliceMut6xX<'a, T, RStride = U1, CStride = U6> = pub type MatrixSliceMut6xX<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, Dynamic, ViewStorageMut<'a, T, U6, Dynamic, RStride, CStride>>; Matrix<T, U6, Dyn, ViewStorageMut<'a, T, U6, Dyn, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 1 column. /// A column-major matrix slice with a number of rows chosen at runtime and 1 column.
#[deprecated = slice_deprecation_note!(MatrixViewMutXx1)] #[deprecated = slice_deprecation_note!(MatrixViewMutXx1)]
pub type MatrixSliceMutXx1<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixSliceMutXx1<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U1, ViewStorageMut<'a, T, Dynamic, U1, RStride, CStride>>; Matrix<T, Dyn, U1, ViewStorageMut<'a, T, Dyn, U1, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 2 columns. /// A column-major matrix slice with a number of rows chosen at runtime and 2 columns.
#[deprecated = slice_deprecation_note!(MatrixViewMutXx2)] #[deprecated = slice_deprecation_note!(MatrixViewMutXx2)]
pub type MatrixSliceMutXx2<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixSliceMutXx2<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U2, ViewStorageMut<'a, T, Dynamic, U2, RStride, CStride>>; Matrix<T, Dyn, U2, ViewStorageMut<'a, T, Dyn, U2, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 3 columns. /// A column-major matrix slice with a number of rows chosen at runtime and 3 columns.
#[deprecated = slice_deprecation_note!(MatrixViewMutXx3)] #[deprecated = slice_deprecation_note!(MatrixViewMutXx3)]
pub type MatrixSliceMutXx3<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixSliceMutXx3<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U3, ViewStorageMut<'a, T, Dynamic, U3, RStride, CStride>>; Matrix<T, Dyn, U3, ViewStorageMut<'a, T, Dyn, U3, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 4 columns. /// A column-major matrix slice with a number of rows chosen at runtime and 4 columns.
#[deprecated = slice_deprecation_note!(MatrixViewMutXx4)] #[deprecated = slice_deprecation_note!(MatrixViewMutXx4)]
pub type MatrixSliceMutXx4<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixSliceMutXx4<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U4, ViewStorageMut<'a, T, Dynamic, U4, RStride, CStride>>; Matrix<T, Dyn, U4, ViewStorageMut<'a, T, Dyn, U4, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 5 columns. /// A column-major matrix slice with a number of rows chosen at runtime and 5 columns.
#[deprecated = slice_deprecation_note!(MatrixViewMutXx5)] #[deprecated = slice_deprecation_note!(MatrixViewMutXx5)]
pub type MatrixSliceMutXx5<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixSliceMutXx5<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U5, ViewStorageMut<'a, T, Dynamic, U5, RStride, CStride>>; Matrix<T, Dyn, U5, ViewStorageMut<'a, T, Dyn, U5, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 6 columns. /// A column-major matrix slice with a number of rows chosen at runtime and 6 columns.
#[deprecated = slice_deprecation_note!(MatrixViewMutXx6)] #[deprecated = slice_deprecation_note!(MatrixViewMutXx6)]
pub type MatrixSliceMutXx6<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixSliceMutXx6<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U6, ViewStorageMut<'a, T, Dynamic, U6, RStride, CStride>>; Matrix<T, Dyn, U6, ViewStorageMut<'a, T, Dyn, U6, RStride, CStride>>;
/// A column vector slice with dimensions known at compile-time. /// A column vector slice with dimensions known at compile-time.
/// ///
@ -680,8 +680,8 @@ pub type SVectorSliceMut<'a, T, const D: usize> =
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(DVectorViewMut)] #[deprecated = slice_deprecation_note!(DVectorViewMut)]
pub type DVectorSliceMut<'a, T, RStride = U1, CStride = Dynamic> = pub type DVectorSliceMut<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U1, ViewStorageMut<'a, T, Dynamic, U1, RStride, CStride>>; Matrix<T, Dyn, U1, ViewStorageMut<'a, T, Dyn, U1, RStride, CStride>>;
/// A 1D column vector slice. /// A 1D column vector slice.
/// ///

View File

@ -1,4 +1,4 @@
use crate::base::dimension::{Dynamic, U1, U2, U3, U4, U5, U6}; use crate::base::dimension::{Dyn, U1, U2, U3, U4, U5, U6};
use crate::base::matrix_view::{ViewStorage, ViewStorageMut}; use crate::base::matrix_view::{ViewStorage, ViewStorageMut};
use crate::base::{Const, Matrix}; use crate::base::{Const, Matrix};
@ -19,8 +19,8 @@ pub type SMatrixView<'a, T, const R: usize, const C: usize> =
/// A column-major matrix view dynamic numbers of rows and columns. /// A column-major matrix view dynamic numbers of rows and columns.
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type DMatrixView<'a, T, RStride = U1, CStride = Dynamic> = pub type DMatrixView<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, Dynamic, ViewStorage<'a, T, Dynamic, Dynamic, RStride, CStride>>; Matrix<T, Dyn, Dyn, ViewStorage<'a, T, Dyn, Dyn, RStride, CStride>>;
/// A column-major 1x1 matrix view. /// A column-major 1x1 matrix view.
/// ///
@ -211,41 +211,41 @@ pub type MatrixView6x5<'a, T, RStride = U1, CStride = U6> =
/// A column-major matrix view with 1 row and a number of columns chosen at runtime. /// A column-major matrix view with 1 row and a number of columns chosen at runtime.
pub type MatrixView1xX<'a, T, RStride = U1, CStride = U1> = pub type MatrixView1xX<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, Dynamic, ViewStorage<'a, T, U1, Dynamic, RStride, CStride>>; Matrix<T, U1, Dyn, ViewStorage<'a, T, U1, Dyn, RStride, CStride>>;
/// A column-major matrix view with 2 rows and a number of columns chosen at runtime. /// A column-major matrix view with 2 rows and a number of columns chosen at runtime.
pub type MatrixView2xX<'a, T, RStride = U1, CStride = U2> = pub type MatrixView2xX<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, Dynamic, ViewStorage<'a, T, U2, Dynamic, RStride, CStride>>; Matrix<T, U2, Dyn, ViewStorage<'a, T, U2, Dyn, RStride, CStride>>;
/// A column-major matrix view with 3 rows and a number of columns chosen at runtime. /// A column-major matrix view with 3 rows and a number of columns chosen at runtime.
pub type MatrixView3xX<'a, T, RStride = U1, CStride = U3> = pub type MatrixView3xX<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, Dynamic, ViewStorage<'a, T, U3, Dynamic, RStride, CStride>>; Matrix<T, U3, Dyn, ViewStorage<'a, T, U3, Dyn, RStride, CStride>>;
/// A column-major matrix view with 4 rows and a number of columns chosen at runtime. /// A column-major matrix view with 4 rows and a number of columns chosen at runtime.
pub type MatrixView4xX<'a, T, RStride = U1, CStride = U4> = pub type MatrixView4xX<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, Dynamic, ViewStorage<'a, T, U4, Dynamic, RStride, CStride>>; Matrix<T, U4, Dyn, ViewStorage<'a, T, U4, Dyn, RStride, CStride>>;
/// A column-major matrix view with 5 rows and a number of columns chosen at runtime. /// A column-major matrix view with 5 rows and a number of columns chosen at runtime.
pub type MatrixView5xX<'a, T, RStride = U1, CStride = U5> = pub type MatrixView5xX<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, Dynamic, ViewStorage<'a, T, U5, Dynamic, RStride, CStride>>; Matrix<T, U5, Dyn, ViewStorage<'a, T, U5, Dyn, RStride, CStride>>;
/// A column-major matrix view with 6 rows and a number of columns chosen at runtime. /// A column-major matrix view with 6 rows and a number of columns chosen at runtime.
pub type MatrixView6xX<'a, T, RStride = U1, CStride = U6> = pub type MatrixView6xX<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, Dynamic, ViewStorage<'a, T, U6, Dynamic, RStride, CStride>>; Matrix<T, U6, Dyn, ViewStorage<'a, T, U6, Dyn, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 1 column. /// A column-major matrix view with a number of rows chosen at runtime and 1 column.
pub type MatrixViewXx1<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixViewXx1<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U1, ViewStorage<'a, T, Dynamic, U1, RStride, CStride>>; Matrix<T, Dyn, U1, ViewStorage<'a, T, Dyn, U1, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 2 columns. /// A column-major matrix view with a number of rows chosen at runtime and 2 columns.
pub type MatrixViewXx2<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixViewXx2<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U2, ViewStorage<'a, T, Dynamic, U2, RStride, CStride>>; Matrix<T, Dyn, U2, ViewStorage<'a, T, Dyn, U2, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 3 columns. /// A column-major matrix view with a number of rows chosen at runtime and 3 columns.
pub type MatrixViewXx3<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixViewXx3<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U3, ViewStorage<'a, T, Dynamic, U3, RStride, CStride>>; Matrix<T, Dyn, U3, ViewStorage<'a, T, Dyn, U3, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 4 columns. /// A column-major matrix view with a number of rows chosen at runtime and 4 columns.
pub type MatrixViewXx4<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixViewXx4<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U4, ViewStorage<'a, T, Dynamic, U4, RStride, CStride>>; Matrix<T, Dyn, U4, ViewStorage<'a, T, Dyn, U4, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 5 columns. /// A column-major matrix view with a number of rows chosen at runtime and 5 columns.
pub type MatrixViewXx5<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixViewXx5<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U5, ViewStorage<'a, T, Dynamic, U5, RStride, CStride>>; Matrix<T, Dyn, U5, ViewStorage<'a, T, Dyn, U5, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 6 columns. /// A column-major matrix view with a number of rows chosen at runtime and 6 columns.
pub type MatrixViewXx6<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixViewXx6<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U6, ViewStorage<'a, T, Dynamic, U6, RStride, CStride>>; Matrix<T, Dyn, U6, ViewStorage<'a, T, Dyn, U6, RStride, CStride>>;
/// A column vector view with dimensions known at compile-time. /// A column vector view with dimensions known at compile-time.
/// ///
@ -260,8 +260,8 @@ pub type SVectorView<'a, T, const D: usize> =
Matrix<T, Const<D>, Const<1>, ViewStorage<'a, T, Const<D>, Const<1>, Const<1>, Const<D>>>; Matrix<T, Const<D>, Const<1>, ViewStorage<'a, T, Const<D>, Const<1>, Const<1>, Const<D>>>;
/// A column vector view dynamic numbers of rows and columns. /// A column vector view dynamic numbers of rows and columns.
pub type DVectorView<'a, T, RStride = U1, CStride = Dynamic> = pub type DVectorView<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U1, ViewStorage<'a, T, Dynamic, U1, RStride, CStride>>; Matrix<T, Dyn, U1, ViewStorage<'a, T, Dyn, U1, RStride, CStride>>;
/// A 1D column vector view. /// A 1D column vector view.
/// ///
@ -311,8 +311,8 @@ pub type SMatrixViewMut<'a, T, const R: usize, const C: usize> =
/// A column-major matrix view dynamic numbers of rows and columns. /// A column-major matrix view dynamic numbers of rows and columns.
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type DMatrixViewMut<'a, T, RStride = U1, CStride = Dynamic> = pub type DMatrixViewMut<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, Dynamic, ViewStorageMut<'a, T, Dynamic, Dynamic, RStride, CStride>>; Matrix<T, Dyn, Dyn, ViewStorageMut<'a, T, Dyn, Dyn, RStride, CStride>>;
/// A column-major 1x1 matrix view. /// A column-major 1x1 matrix view.
/// ///
@ -503,41 +503,41 @@ pub type MatrixViewMut6x5<'a, T, RStride = U1, CStride = U6> =
/// A column-major matrix view with 1 row and a number of columns chosen at runtime. /// A column-major matrix view with 1 row and a number of columns chosen at runtime.
pub type MatrixViewMut1xX<'a, T, RStride = U1, CStride = U1> = pub type MatrixViewMut1xX<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, Dynamic, ViewStorageMut<'a, T, U1, Dynamic, RStride, CStride>>; Matrix<T, U1, Dyn, ViewStorageMut<'a, T, U1, Dyn, RStride, CStride>>;
/// A column-major matrix view with 2 rows and a number of columns chosen at runtime. /// A column-major matrix view with 2 rows and a number of columns chosen at runtime.
pub type MatrixViewMut2xX<'a, T, RStride = U1, CStride = U2> = pub type MatrixViewMut2xX<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, Dynamic, ViewStorageMut<'a, T, U2, Dynamic, RStride, CStride>>; Matrix<T, U2, Dyn, ViewStorageMut<'a, T, U2, Dyn, RStride, CStride>>;
/// A column-major matrix view with 3 rows and a number of columns chosen at runtime. /// A column-major matrix view with 3 rows and a number of columns chosen at runtime.
pub type MatrixViewMut3xX<'a, T, RStride = U1, CStride = U3> = pub type MatrixViewMut3xX<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, Dynamic, ViewStorageMut<'a, T, U3, Dynamic, RStride, CStride>>; Matrix<T, U3, Dyn, ViewStorageMut<'a, T, U3, Dyn, RStride, CStride>>;
/// A column-major matrix view with 4 rows and a number of columns chosen at runtime. /// A column-major matrix view with 4 rows and a number of columns chosen at runtime.
pub type MatrixViewMut4xX<'a, T, RStride = U1, CStride = U4> = pub type MatrixViewMut4xX<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, Dynamic, ViewStorageMut<'a, T, U4, Dynamic, RStride, CStride>>; Matrix<T, U4, Dyn, ViewStorageMut<'a, T, U4, Dyn, RStride, CStride>>;
/// A column-major matrix view with 5 rows and a number of columns chosen at runtime. /// A column-major matrix view with 5 rows and a number of columns chosen at runtime.
pub type MatrixViewMut5xX<'a, T, RStride = U1, CStride = U5> = pub type MatrixViewMut5xX<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, Dynamic, ViewStorageMut<'a, T, U5, Dynamic, RStride, CStride>>; Matrix<T, U5, Dyn, ViewStorageMut<'a, T, U5, Dyn, RStride, CStride>>;
/// A column-major matrix view with 6 rows and a number of columns chosen at runtime. /// A column-major matrix view with 6 rows and a number of columns chosen at runtime.
pub type MatrixViewMut6xX<'a, T, RStride = U1, CStride = U6> = pub type MatrixViewMut6xX<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, Dynamic, ViewStorageMut<'a, T, U6, Dynamic, RStride, CStride>>; Matrix<T, U6, Dyn, ViewStorageMut<'a, T, U6, Dyn, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 1 column. /// A column-major matrix view with a number of rows chosen at runtime and 1 column.
pub type MatrixViewMutXx1<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixViewMutXx1<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U1, ViewStorageMut<'a, T, Dynamic, U1, RStride, CStride>>; Matrix<T, Dyn, U1, ViewStorageMut<'a, T, Dyn, U1, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 2 columns. /// A column-major matrix view with a number of rows chosen at runtime and 2 columns.
pub type MatrixViewMutXx2<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixViewMutXx2<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U2, ViewStorageMut<'a, T, Dynamic, U2, RStride, CStride>>; Matrix<T, Dyn, U2, ViewStorageMut<'a, T, Dyn, U2, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 3 columns. /// A column-major matrix view with a number of rows chosen at runtime and 3 columns.
pub type MatrixViewMutXx3<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixViewMutXx3<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U3, ViewStorageMut<'a, T, Dynamic, U3, RStride, CStride>>; Matrix<T, Dyn, U3, ViewStorageMut<'a, T, Dyn, U3, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 4 columns. /// A column-major matrix view with a number of rows chosen at runtime and 4 columns.
pub type MatrixViewMutXx4<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixViewMutXx4<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U4, ViewStorageMut<'a, T, Dynamic, U4, RStride, CStride>>; Matrix<T, Dyn, U4, ViewStorageMut<'a, T, Dyn, U4, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 5 columns. /// A column-major matrix view with a number of rows chosen at runtime and 5 columns.
pub type MatrixViewMutXx5<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixViewMutXx5<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U5, ViewStorageMut<'a, T, Dynamic, U5, RStride, CStride>>; Matrix<T, Dyn, U5, ViewStorageMut<'a, T, Dyn, U5, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 6 columns. /// A column-major matrix view with a number of rows chosen at runtime and 6 columns.
pub type MatrixViewMutXx6<'a, T, RStride = U1, CStride = Dynamic> = pub type MatrixViewMutXx6<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U6, ViewStorageMut<'a, T, Dynamic, U6, RStride, CStride>>; Matrix<T, Dyn, U6, ViewStorageMut<'a, T, Dyn, U6, RStride, CStride>>;
/// A column vector view with dimensions known at compile-time. /// A column vector view with dimensions known at compile-time.
/// ///
@ -554,8 +554,8 @@ pub type SVectorViewMut<'a, T, const D: usize> =
/// A column vector view dynamic numbers of rows and columns. /// A column vector view dynamic numbers of rows and columns.
/// ///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.** /// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type DVectorViewMut<'a, T, RStride = U1, CStride = Dynamic> = pub type DVectorViewMut<'a, T, RStride = U1, CStride = Dyn> =
Matrix<T, Dynamic, U1, ViewStorageMut<'a, T, Dynamic, U1, RStride, CStride>>; Matrix<T, Dyn, U1, ViewStorageMut<'a, T, Dyn, U1, RStride, CStride>>;
/// A 1D column vector view. /// A 1D column vector view.
/// ///

View File

@ -15,7 +15,7 @@ use std::mem::MaybeUninit;
/// ///
/// An allocator is said to be: /// An allocator is said to be:
/// static: if `R` and `C` both implement `DimName`. /// static: if `R` and `C` both implement `DimName`.
/// dynamic: if either one (or both) of `R` or `C` is equal to `Dynamic`. /// dynamic: if either one (or both) of `R` or `C` is equal to `Dyn`.
/// ///
/// Every allocator must be both static and dynamic. Though not all implementations may share the /// Every allocator must be both static and dynamic. Though not all implementations may share the
/// same `Buffer` type. /// same `Buffer` type.

View File

@ -7,7 +7,7 @@ use crate::base::blas_uninit::{axcpy_uninit, gemm_uninit, gemv_uninit};
use crate::base::constraint::{ use crate::base::constraint::{
AreMultipliable, DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint, AreMultipliable, DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint,
}; };
use crate::base::dimension::{Const, Dim, Dynamic, U1, U2, U3, U4}; use crate::base::dimension::{Const, Dim, Dyn, U1, U2, U3, U4};
use crate::base::storage::{Storage, StorageMut}; use crate::base::storage::{Storage, StorageMut};
use crate::base::uninit::Init; use crate::base::uninit::Init;
use crate::base::{ use crate::base::{
@ -890,7 +890,7 @@ where
for j in 0..dim1 { for j in 0..dim1 {
let val = unsafe { conjugate(y.vget_unchecked(j).clone()) }; let val = unsafe { conjugate(y.vget_unchecked(j).clone()) };
let subdim = Dynamic::new(dim1 - j); let subdim = Dyn(dim1 - j);
// TODO: avoid bound checks. // TODO: avoid bound checks.
self.generic_view_mut((j, j), (subdim, Const::<1>)).axpy( self.generic_view_mut((j, j), (subdim, Const::<1>)).axpy(
alpha.clone() * val, alpha.clone() * val,

View File

@ -18,7 +18,7 @@ use std::mem;
use crate::base::constraint::{ use crate::base::constraint::{
AreMultipliable, DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint, AreMultipliable, DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint,
}; };
use crate::base::dimension::{Dim, Dynamic, U1}; use crate::base::dimension::{Dim, Dyn, U1};
use crate::base::storage::{RawStorage, RawStorageMut}; use crate::base::storage::{RawStorage, RawStorageMut};
use crate::base::uninit::InitStatus; use crate::base::uninit::InitStatus;
use crate::base::{Matrix, Scalar, Vector}; use crate::base::{Matrix, Scalar, Vector};
@ -209,16 +209,16 @@ pub unsafe fn gemm_uninit<
#[cfg(feature = "std")] #[cfg(feature = "std")]
{ {
// We assume large matrices will be Dynamic but small matrices static. // We assume large matrices will be Dyn but small matrices static.
// We could use matrixmultiply for large statically-sized matrices but the performance // We could use matrixmultiply for large statically-sized matrices but the performance
// threshold to activate it would be different from SMALL_DIM because our code optimizes // threshold to activate it would be different from SMALL_DIM because our code optimizes
// better for statically-sized matrices. // better for statically-sized matrices.
if R1::is::<Dynamic>() if R1::is::<Dyn>()
|| C1::is::<Dynamic>() || C1::is::<Dyn>()
|| R2::is::<Dynamic>() || R2::is::<Dyn>()
|| C2::is::<Dynamic>() || C2::is::<Dyn>()
|| R3::is::<Dynamic>() || R3::is::<Dyn>()
|| C3::is::<Dynamic>() || C3::is::<Dyn>()
{ {
// matrixmultiply can be used only if the std feature is available. // matrixmultiply can be used only if the std feature is available.
let nrows1 = y.nrows(); let nrows1 = y.nrows();

View File

@ -1,6 +1,6 @@
//! Compatibility constraints between matrix shapes, e.g., for addition or multiplication. //! Compatibility constraints between matrix shapes, e.g., for addition or multiplication.
use crate::base::dimension::{Dim, DimName, Dynamic}; use crate::base::dimension::{Dim, DimName, Dyn};
/// A type used in `where` clauses for enforcing constraints. /// A type used in `where` clauses for enforcing constraints.
#[derive(Copy, Clone, Debug)] #[derive(Copy, Clone, Debug)]
@ -25,11 +25,11 @@ impl<D: Dim> DimEq<D, D> for ShapeConstraint {
type Representative = D; type Representative = D;
} }
impl<D: DimName> DimEq<D, Dynamic> for ShapeConstraint { impl<D: DimName> DimEq<D, Dyn> for ShapeConstraint {
type Representative = D; type Representative = D;
} }
impl<D: DimName> DimEq<Dynamic, D> for ShapeConstraint { impl<D: DimName> DimEq<Dyn, D> for ShapeConstraint {
type Representative = D; type Representative = D;
} }
@ -47,11 +47,11 @@ macro_rules! equality_trait_decl(
type Representative = D; type Representative = D;
} }
impl<D: DimName> $Trait<D, Dynamic> for ShapeConstraint { impl<D: DimName> $Trait<D, Dyn> for ShapeConstraint {
type Representative = D; type Representative = D;
} }
impl<D: DimName> $Trait<Dynamic, D> for ShapeConstraint { impl<D: DimName> $Trait<Dyn, D> for ShapeConstraint {
type Representative = D; type Representative = D;
} }
)*} )*}
@ -82,10 +82,10 @@ impl<D: Dim> SameDimension<D, D> for ShapeConstraint {
type Representative = D; type Representative = D;
} }
impl<D: DimName> SameDimension<D, Dynamic> for ShapeConstraint { impl<D: DimName> SameDimension<D, Dyn> for ShapeConstraint {
type Representative = D; type Representative = D;
} }
impl<D: DimName> SameDimension<Dynamic, D> for ShapeConstraint { impl<D: DimName> SameDimension<Dyn, D> for ShapeConstraint {
type Representative = D; type Representative = D;
} }

View File

@ -19,7 +19,7 @@ use typenum::{self, Cmp, Greater};
use simba::scalar::{ClosedAdd, ClosedMul}; use simba::scalar::{ClosedAdd, ClosedMul};
use crate::base::allocator::Allocator; use crate::base::allocator::Allocator;
use crate::base::dimension::{Dim, DimName, Dynamic, ToTypenum}; use crate::base::dimension::{Dim, DimName, Dyn, ToTypenum};
use crate::base::storage::RawStorage; use crate::base::storage::RawStorage;
use crate::base::{ use crate::base::{
ArrayStorage, Const, DefaultAllocator, Matrix, OMatrix, OVector, Scalar, Unit, Vector, ArrayStorage, Const, DefaultAllocator, Matrix, OMatrix, OVector, Scalar, Unit, Vector,
@ -317,12 +317,12 @@ where
/// ///
/// # Example /// # Example
/// ``` /// ```
/// # use nalgebra::{Dynamic, DMatrix, Matrix, Const}; /// # use nalgebra::{Dyn, DMatrix, Matrix, Const};
/// ///
/// let vec = vec![0, 1, 2, 3, 4, 5]; /// let vec = vec![0, 1, 2, 3, 4, 5];
/// let vec_ptr = vec.as_ptr(); /// let vec_ptr = vec.as_ptr();
/// ///
/// let matrix = Matrix::from_vec_generic(Dynamic::new(vec.len()), Const::<1>, vec); /// let matrix = Matrix::from_vec_generic(Dyn(vec.len()), Const::<1>, vec);
/// let matrix_storage_ptr = matrix.data.as_vec().as_ptr(); /// let matrix_storage_ptr = matrix.data.as_vec().as_ptr();
/// ///
/// // `matrix` is backed by exactly the same `Vec` as it was constructed from. /// // `matrix` is backed by exactly the same `Vec` as it was constructed from.
@ -656,35 +656,35 @@ where
} }
/// # Constructors of matrices with a dynamic number of columns /// # Constructors of matrices with a dynamic number of columns
impl<T: Scalar, R: DimName> OMatrix<T, R, Dynamic> impl<T: Scalar, R: DimName> OMatrix<T, R, Dyn>
where where
DefaultAllocator: Allocator<T, R, Dynamic>, DefaultAllocator: Allocator<T, R, Dyn>,
{ {
impl_constructors!(R, Dynamic; impl_constructors!(R, Dyn;
=> R: DimName; => R: DimName;
R::name(), Dynamic::new(ncols); R::name(), Dyn(ncols);
ncols); ncols);
} }
/// # Constructors of dynamic vectors and matrices with a dynamic number of rows /// # Constructors of dynamic vectors and matrices with a dynamic number of rows
impl<T: Scalar, C: DimName> OMatrix<T, Dynamic, C> impl<T: Scalar, C: DimName> OMatrix<T, Dyn, C>
where where
DefaultAllocator: Allocator<T, Dynamic, C>, DefaultAllocator: Allocator<T, Dyn, C>,
{ {
impl_constructors!(Dynamic, C; impl_constructors!(Dyn, C;
=> C: DimName; => C: DimName;
Dynamic::new(nrows), C::name(); Dyn(nrows), C::name();
nrows); nrows);
} }
/// # Constructors of fully dynamic matrices /// # Constructors of fully dynamic matrices
impl<T: Scalar> OMatrix<T, Dynamic, Dynamic> impl<T: Scalar> OMatrix<T, Dyn, Dyn>
where where
DefaultAllocator: Allocator<T, Dynamic, Dynamic>, DefaultAllocator: Allocator<T, Dyn, Dyn>,
{ {
impl_constructors!(Dynamic, Dynamic; impl_constructors!(Dyn, Dyn;
; ;
Dynamic::new(nrows), Dynamic::new(ncols); Dyn(nrows), Dyn(ncols);
nrows, ncols); nrows, ncols);
} }
@ -790,19 +790,19 @@ impl_constructors_from_data!(data; R, C; // Arguments for Matri
R::name(), C::name(); // Arguments for `_generic` constructors. R::name(), C::name(); // Arguments for `_generic` constructors.
); // Arguments for non-generic constructors. ); // Arguments for non-generic constructors.
impl_constructors_from_data!(data; R, Dynamic; impl_constructors_from_data!(data; R, Dyn;
=> R: DimName; => R: DimName;
R::name(), Dynamic::new(data.len() / R::dim()); R::name(), Dyn(data.len() / R::dim());
); );
impl_constructors_from_data!(data; Dynamic, C; impl_constructors_from_data!(data; Dyn, C;
=> C: DimName; => C: DimName;
Dynamic::new(data.len() / C::dim()), C::name(); Dyn(data.len() / C::dim()), C::name();
); );
impl_constructors_from_data!(data; Dynamic, Dynamic; impl_constructors_from_data!(data; Dyn, Dyn;
; ;
Dynamic::new(nrows), Dynamic::new(ncols); Dyn(nrows), Dyn(ncols);
nrows, ncols); nrows, ncols);
/* /*

View File

@ -1,4 +1,4 @@
use crate::base::dimension::{Const, Dim, DimName, Dynamic}; use crate::base::dimension::{Const, Dim, DimName, Dyn};
use crate::base::matrix_view::{ViewStorage, ViewStorageMut}; use crate::base::matrix_view::{ViewStorage, ViewStorageMut};
use crate::base::{MatrixView, MatrixViewMut, Scalar}; use crate::base::{MatrixView, MatrixViewMut, Scalar};
@ -12,7 +12,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
/// ///
/// # Safety /// # Safety
/// This method is unsafe because the input data array is not checked to contain enough elements. /// This method is unsafe because the input data array is not checked to contain enough elements.
/// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`. /// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dyn()`.
#[inline] #[inline]
pub unsafe fn from_slice_with_strides_generic_unchecked( pub unsafe fn from_slice_with_strides_generic_unchecked(
data: &'a [T], data: &'a [T],
@ -33,7 +33,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
/// Creates a matrix view from an array and with dimensions and strides specified by generic types instances. /// Creates a matrix view from an array and with dimensions and strides specified by generic types instances.
/// ///
/// Panics if the input data array dose not contain enough elements. /// Panics if the input data array dose not contain enough elements.
/// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`. /// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dyn()`.
#[inline] #[inline]
pub fn from_slice_with_strides_generic( pub fn from_slice_with_strides_generic(
data: &'a [T], data: &'a [T],
@ -62,7 +62,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim> MatrixView<'a, T, R, C> {
/// ///
/// # Safety /// # Safety
/// This method is unsafe because the input data array is not checked to contain enough elements. /// This method is unsafe because the input data array is not checked to contain enough elements.
/// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`. /// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dyn()`.
#[inline] #[inline]
pub unsafe fn from_slice_generic_unchecked( pub unsafe fn from_slice_generic_unchecked(
data: &'a [T], data: &'a [T],
@ -78,7 +78,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim> MatrixView<'a, T, R, C> {
/// Creates a matrix view from an array and with dimensions and strides specified by generic types instances. /// Creates a matrix view from an array and with dimensions and strides specified by generic types instances.
/// ///
/// Panics if the input data array dose not contain enough elements. /// Panics if the input data array dose not contain enough elements.
/// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`. /// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dyn()`.
#[inline] #[inline]
pub fn from_slice_generic(data: &'a [T], nrows: R, ncols: C) -> Self { pub fn from_slice_generic(data: &'a [T], nrows: R, ncols: C) -> Self {
Self::from_slice_with_strides_generic(data, nrows, ncols, Const::<1>, nrows) Self::from_slice_with_strides_generic(data, nrows, ncols, Const::<1>, nrows)
@ -103,19 +103,19 @@ macro_rules! impl_constructors(
} }
} }
impl<'a, T: Scalar, $($DimIdent: $DimBound, )*> MatrixView<'a, T, $($Dims,)* Dynamic, Dynamic> { impl<'a, T: Scalar, $($DimIdent: $DimBound, )*> MatrixView<'a, T, $($Dims,)* Dyn, Dyn> {
/// Creates a new matrix view with the specified strides from the given data array. /// Creates a new matrix view with the specified strides from the given data array.
/// ///
/// Panics if `data` does not contain enough elements. /// Panics if `data` does not contain enough elements.
#[inline] #[inline]
pub fn from_slice_with_strides(data: &'a [T], $($args: usize,)* rstride: usize, cstride: usize) -> Self { pub fn from_slice_with_strides(data: &'a [T], $($args: usize,)* rstride: usize, cstride: usize) -> Self {
Self::from_slice_with_strides_generic(data, $($gargs,)* Dynamic::new(rstride), Dynamic::new(cstride)) Self::from_slice_with_strides_generic(data, $($gargs,)* Dyn(rstride), Dyn(cstride))
} }
/// Creates, without bound checking, a new matrix view with the specified strides from the given data array. /// Creates, without bound checking, a new matrix view with the specified strides from the given data array.
#[inline] #[inline]
pub unsafe fn from_slice_with_strides_unchecked(data: &'a [T], start: usize, $($args: usize,)* rstride: usize, cstride: usize) -> Self { pub unsafe fn from_slice_with_strides_unchecked(data: &'a [T], start: usize, $($args: usize,)* rstride: usize, cstride: usize) -> Self {
Self::from_slice_with_strides_generic_unchecked(data, start, $($gargs,)* Dynamic::new(rstride), Dynamic::new(cstride)) Self::from_slice_with_strides_generic_unchecked(data, start, $($gargs,)* Dyn(rstride), Dyn(cstride))
} }
} }
} }
@ -127,19 +127,19 @@ impl_constructors!(R, C; // Arguments for Matrix<T, ...,
R::name(), C::name(); // Arguments for `_generic` constructors. R::name(), C::name(); // Arguments for `_generic` constructors.
); // Arguments for non-generic constructors. ); // Arguments for non-generic constructors.
impl_constructors!(R, Dynamic; impl_constructors!(R, Dyn;
=> R: DimName; => R: DimName;
R::name(), Dynamic::new(ncols); R::name(), Dyn(ncols);
ncols); ncols);
impl_constructors!(Dynamic, C; impl_constructors!(Dyn, C;
=> C: DimName; => C: DimName;
Dynamic::new(nrows), C::name(); Dyn(nrows), C::name();
nrows); nrows);
impl_constructors!(Dynamic, Dynamic; impl_constructors!(Dyn, Dyn;
; ;
Dynamic::new(nrows), Dynamic::new(ncols); Dyn(nrows), Dyn(ncols);
nrows, ncols); nrows, ncols);
/// # Creating mutable matrix views from `&mut [T]` /// # Creating mutable matrix views from `&mut [T]`
@ -150,7 +150,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
/// ///
/// # Safety /// # Safety
/// This method is unsafe because the input data array is not checked to contain enough elements. /// This method is unsafe because the input data array is not checked to contain enough elements.
/// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`. /// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dyn()`.
#[inline] #[inline]
pub unsafe fn from_slice_with_strides_generic_unchecked( pub unsafe fn from_slice_with_strides_generic_unchecked(
data: &'a mut [T], data: &'a mut [T],
@ -171,7 +171,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
/// Creates a mutable matrix view from an array and with dimensions and strides specified by generic types instances. /// Creates a mutable matrix view from an array and with dimensions and strides specified by generic types instances.
/// ///
/// Panics if the input data array dose not contain enough elements. /// Panics if the input data array dose not contain enough elements.
/// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`. /// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dyn()`.
#[inline] #[inline]
pub fn from_slice_with_strides_generic( pub fn from_slice_with_strides_generic(
data: &'a mut [T], data: &'a mut [T],
@ -222,7 +222,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim> MatrixViewMut<'a, T, R, C> {
/// ///
/// # Safety /// # Safety
/// This method is unsafe because the input data array is not checked to contain enough elements. /// This method is unsafe because the input data array is not checked to contain enough elements.
/// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`. /// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dyn()`.
#[inline] #[inline]
pub unsafe fn from_slice_generic_unchecked( pub unsafe fn from_slice_generic_unchecked(
data: &'a mut [T], data: &'a mut [T],
@ -238,7 +238,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim> MatrixViewMut<'a, T, R, C> {
/// Creates a mutable matrix view from an array and with dimensions and strides specified by generic types instances. /// Creates a mutable matrix view from an array and with dimensions and strides specified by generic types instances.
/// ///
/// Panics if the input data array dose not contain enough elements. /// Panics if the input data array dose not contain enough elements.
/// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`. /// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dyn()`.
#[inline] #[inline]
pub fn from_slice_generic(data: &'a mut [T], nrows: R, ncols: C) -> Self { pub fn from_slice_generic(data: &'a mut [T], nrows: R, ncols: C) -> Self {
Self::from_slice_with_strides_generic(data, nrows, ncols, Const::<1>, nrows) Self::from_slice_with_strides_generic(data, nrows, ncols, Const::<1>, nrows)
@ -263,21 +263,21 @@ macro_rules! impl_constructors_mut(
} }
} }
impl<'a, T: Scalar, $($DimIdent: $DimBound, )*> MatrixViewMut<'a, T, $($Dims,)* Dynamic, Dynamic> { impl<'a, T: Scalar, $($DimIdent: $DimBound, )*> MatrixViewMut<'a, T, $($Dims,)* Dyn, Dyn> {
/// Creates a new mutable matrix view with the specified strides from the given data array. /// Creates a new mutable matrix view with the specified strides from the given data array.
/// ///
/// Panics if `data` does not contain enough elements. /// Panics if `data` does not contain enough elements.
#[inline] #[inline]
pub fn from_slice_with_strides_mut(data: &'a mut [T], $($args: usize,)* rstride: usize, cstride: usize) -> Self { pub fn from_slice_with_strides_mut(data: &'a mut [T], $($args: usize,)* rstride: usize, cstride: usize) -> Self {
Self::from_slice_with_strides_generic( Self::from_slice_with_strides_generic(
data, $($gargs,)* Dynamic::new(rstride), Dynamic::new(cstride)) data, $($gargs,)* Dyn(rstride), Dyn(cstride))
} }
/// Creates, without bound checking, a new mutable matrix view with the specified strides from the given data array. /// Creates, without bound checking, a new mutable matrix view with the specified strides from the given data array.
#[inline] #[inline]
pub unsafe fn from_slice_with_strides_unchecked(data: &'a mut [T], start: usize, $($args: usize,)* rstride: usize, cstride: usize) -> Self { pub unsafe fn from_slice_with_strides_unchecked(data: &'a mut [T], start: usize, $($args: usize,)* rstride: usize, cstride: usize) -> Self {
Self::from_slice_with_strides_generic_unchecked( Self::from_slice_with_strides_generic_unchecked(
data, start, $($gargs,)* Dynamic::new(rstride), Dynamic::new(cstride)) data, start, $($gargs,)* Dyn(rstride), Dyn(cstride))
} }
} }
} }
@ -289,17 +289,17 @@ impl_constructors_mut!(R, C; // Arguments for Matrix<T,
R::name(), C::name(); // Arguments for `_generic` constructors. R::name(), C::name(); // Arguments for `_generic` constructors.
); // Arguments for non-generic constructors. ); // Arguments for non-generic constructors.
impl_constructors_mut!(R, Dynamic; impl_constructors_mut!(R, Dyn;
=> R: DimName; => R: DimName;
R::name(), Dynamic::new(ncols); R::name(), Dyn(ncols);
ncols); ncols);
impl_constructors_mut!(Dynamic, C; impl_constructors_mut!(Dyn, C;
=> C: DimName; => C: DimName;
Dynamic::new(nrows), C::name(); Dyn(nrows), C::name();
nrows); nrows);
impl_constructors_mut!(Dynamic, Dynamic; impl_constructors_mut!(Dyn, Dyn;
; ;
Dynamic::new(nrows), Dynamic::new(ncols); Dyn(nrows), Dyn(ncols);
nrows, ncols); nrows, ncols);

View File

@ -9,7 +9,7 @@ use simba::simd::{PrimitiveSimdValue, SimdValue};
use crate::base::allocator::{Allocator, SameShapeAllocator}; use crate::base::allocator::{Allocator, SameShapeAllocator};
use crate::base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; use crate::base::constraint::{SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
use crate::base::dimension::Dynamic; use crate::base::dimension::Dyn;
use crate::base::dimension::{ use crate::base::dimension::{
Const, Dim, DimName, U1, U10, U11, U12, U13, U14, U15, U16, U2, U3, U4, U5, U6, U7, U8, U9, Const, Dim, DimName, U1, U10, U11, U12, U13, U14, U15, U16, U2, U3, U4, U5, U6, U7, U8, U9,
}; };
@ -302,29 +302,29 @@ where
} }
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, T, C, RStride, CStride> From<MatrixView<'a, T, Dynamic, C, RStride, CStride>> impl<'a, T, C, RStride, CStride> From<MatrixView<'a, T, Dyn, C, RStride, CStride>>
for Matrix<T, Dynamic, C, VecStorage<T, Dynamic, C>> for Matrix<T, Dyn, C, VecStorage<T, Dyn, C>>
where where
T: Scalar, T: Scalar,
C: Dim, C: Dim,
RStride: Dim, RStride: Dim,
CStride: Dim, CStride: Dim,
{ {
fn from(matrix_view: MatrixView<'a, T, Dynamic, C, RStride, CStride>) -> Self { fn from(matrix_view: MatrixView<'a, T, Dyn, C, RStride, CStride>) -> Self {
matrix_view.into_owned() matrix_view.into_owned()
} }
} }
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, T, R, RStride, CStride> From<MatrixView<'a, T, R, Dynamic, RStride, CStride>> impl<'a, T, R, RStride, CStride> From<MatrixView<'a, T, R, Dyn, RStride, CStride>>
for Matrix<T, R, Dynamic, VecStorage<T, R, Dynamic>> for Matrix<T, R, Dyn, VecStorage<T, R, Dyn>>
where where
T: Scalar, T: Scalar,
R: DimName, R: DimName,
RStride: Dim, RStride: Dim,
CStride: Dim, CStride: Dim,
{ {
fn from(matrix_view: MatrixView<'a, T, R, Dynamic, RStride, CStride>) -> Self { fn from(matrix_view: MatrixView<'a, T, R, Dyn, RStride, CStride>) -> Self {
matrix_view.into_owned() matrix_view.into_owned()
} }
} }
@ -343,29 +343,29 @@ where
} }
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, T, C, RStride, CStride> From<MatrixViewMut<'a, T, Dynamic, C, RStride, CStride>> impl<'a, T, C, RStride, CStride> From<MatrixViewMut<'a, T, Dyn, C, RStride, CStride>>
for Matrix<T, Dynamic, C, VecStorage<T, Dynamic, C>> for Matrix<T, Dyn, C, VecStorage<T, Dyn, C>>
where where
T: Scalar, T: Scalar,
C: Dim, C: Dim,
RStride: Dim, RStride: Dim,
CStride: Dim, CStride: Dim,
{ {
fn from(matrix_view: MatrixViewMut<'a, T, Dynamic, C, RStride, CStride>) -> Self { fn from(matrix_view: MatrixViewMut<'a, T, Dyn, C, RStride, CStride>) -> Self {
matrix_view.into_owned() matrix_view.into_owned()
} }
} }
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, T, R, RStride, CStride> From<MatrixViewMut<'a, T, R, Dynamic, RStride, CStride>> impl<'a, T, R, RStride, CStride> From<MatrixViewMut<'a, T, R, Dyn, RStride, CStride>>
for Matrix<T, R, Dynamic, VecStorage<T, R, Dynamic>> for Matrix<T, R, Dyn, VecStorage<T, R, Dyn>>
where where
T: Scalar, T: Scalar,
R: DimName, R: DimName,
RStride: Dim, RStride: Dim,
CStride: Dim, CStride: Dim,
{ {
fn from(matrix_view: MatrixViewMut<'a, T, R, Dynamic, RStride, CStride>) -> Self { fn from(matrix_view: MatrixViewMut<'a, T, R, Dyn, RStride, CStride>) -> Self {
matrix_view.into_owned() matrix_view.into_owned()
} }
} }

View File

@ -13,7 +13,7 @@ use super::Const;
use crate::base::allocator::{Allocator, Reallocator}; use crate::base::allocator::{Allocator, Reallocator};
use crate::base::array_storage::ArrayStorage; use crate::base::array_storage::ArrayStorage;
#[cfg(any(feature = "alloc", feature = "std"))] #[cfg(any(feature = "alloc", feature = "std"))]
use crate::base::dimension::Dynamic; use crate::base::dimension::Dyn;
use crate::base::dimension::{Dim, DimName}; use crate::base::dimension::{Dim, DimName};
use crate::base::storage::{RawStorage, RawStorageMut}; use crate::base::storage::{RawStorage, RawStorageMut};
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
@ -82,15 +82,15 @@ impl<T: Scalar, const R: usize, const C: usize> Allocator<T, Const<R>, Const<C>>
} }
} }
// Dynamic - Static // Dyn - Static
// Dynamic - Dynamic // Dyn - Dyn
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<T: Scalar, C: Dim> Allocator<T, Dynamic, C> for DefaultAllocator { impl<T: Scalar, C: Dim> Allocator<T, Dyn, C> for DefaultAllocator {
type Buffer = VecStorage<T, Dynamic, C>; type Buffer = VecStorage<T, Dyn, C>;
type BufferUninit = VecStorage<MaybeUninit<T>, Dynamic, C>; type BufferUninit = VecStorage<MaybeUninit<T>, Dyn, C>;
#[inline] #[inline]
fn allocate_uninit(nrows: Dynamic, ncols: C) -> VecStorage<MaybeUninit<T>, Dynamic, C> { fn allocate_uninit(nrows: Dyn, ncols: C) -> VecStorage<MaybeUninit<T>, Dyn, C> {
let mut data = Vec::new(); let mut data = Vec::new();
let length = nrows.value() * ncols.value(); let length = nrows.value() * ncols.value();
data.reserve_exact(length); data.reserve_exact(length);
@ -99,9 +99,7 @@ impl<T: Scalar, C: Dim> Allocator<T, Dynamic, C> for DefaultAllocator {
} }
#[inline] #[inline]
unsafe fn assume_init( unsafe fn assume_init(uninit: VecStorage<MaybeUninit<T>, Dyn, C>) -> VecStorage<T, Dyn, C> {
uninit: VecStorage<MaybeUninit<T>, Dynamic, C>,
) -> VecStorage<T, Dynamic, C> {
// Avoids a double-drop. // Avoids a double-drop.
let (nrows, ncols) = uninit.shape(); let (nrows, ncols) = uninit.shape();
let vec: Vec<_> = uninit.into(); let vec: Vec<_> = uninit.into();
@ -117,7 +115,7 @@ impl<T: Scalar, C: Dim> Allocator<T, Dynamic, C> for DefaultAllocator {
#[inline] #[inline]
fn allocate_from_iterator<I: IntoIterator<Item = T>>( fn allocate_from_iterator<I: IntoIterator<Item = T>>(
nrows: Dynamic, nrows: Dyn,
ncols: C, ncols: C,
iter: I, iter: I,
) -> Self::Buffer { ) -> Self::Buffer {
@ -130,14 +128,14 @@ impl<T: Scalar, C: Dim> Allocator<T, Dynamic, C> for DefaultAllocator {
} }
} }
// Static - Dynamic // Static - Dyn
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<T: Scalar, R: DimName> Allocator<T, R, Dynamic> for DefaultAllocator { impl<T: Scalar, R: DimName> Allocator<T, R, Dyn> for DefaultAllocator {
type Buffer = VecStorage<T, R, Dynamic>; type Buffer = VecStorage<T, R, Dyn>;
type BufferUninit = VecStorage<MaybeUninit<T>, R, Dynamic>; type BufferUninit = VecStorage<MaybeUninit<T>, R, Dyn>;
#[inline] #[inline]
fn allocate_uninit(nrows: R, ncols: Dynamic) -> VecStorage<MaybeUninit<T>, R, Dynamic> { fn allocate_uninit(nrows: R, ncols: Dyn) -> VecStorage<MaybeUninit<T>, R, Dyn> {
let mut data = Vec::new(); let mut data = Vec::new();
let length = nrows.value() * ncols.value(); let length = nrows.value() * ncols.value();
data.reserve_exact(length); data.reserve_exact(length);
@ -147,9 +145,7 @@ impl<T: Scalar, R: DimName> Allocator<T, R, Dynamic> for DefaultAllocator {
} }
#[inline] #[inline]
unsafe fn assume_init( unsafe fn assume_init(uninit: VecStorage<MaybeUninit<T>, R, Dyn>) -> VecStorage<T, R, Dyn> {
uninit: VecStorage<MaybeUninit<T>, R, Dynamic>,
) -> VecStorage<T, R, Dynamic> {
// Avoids a double-drop. // Avoids a double-drop.
let (nrows, ncols) = uninit.shape(); let (nrows, ncols) = uninit.shape();
let vec: Vec<_> = uninit.into(); let vec: Vec<_> = uninit.into();
@ -166,7 +162,7 @@ impl<T: Scalar, R: DimName> Allocator<T, R, Dynamic> for DefaultAllocator {
#[inline] #[inline]
fn allocate_from_iterator<I: IntoIterator<Item = T>>( fn allocate_from_iterator<I: IntoIterator<Item = T>>(
nrows: R, nrows: R,
ncols: Dynamic, ncols: Dyn,
iter: I, iter: I,
) -> Self::Buffer { ) -> Self::Buffer {
let it = iter.into_iter(); let it = iter.into_iter();
@ -215,20 +211,20 @@ where
} }
} }
// Static × Static -> Dynamic × Any // Static × Static -> Dyn × Any
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<T: Scalar, CTo, const RFROM: usize, const CFROM: usize> impl<T: Scalar, CTo, const RFROM: usize, const CFROM: usize>
Reallocator<T, Const<RFROM>, Const<CFROM>, Dynamic, CTo> for DefaultAllocator Reallocator<T, Const<RFROM>, Const<CFROM>, Dyn, CTo> for DefaultAllocator
where where
CTo: Dim, CTo: Dim,
{ {
#[inline] #[inline]
unsafe fn reallocate_copy( unsafe fn reallocate_copy(
rto: Dynamic, rto: Dyn,
cto: CTo, cto: CTo,
buf: ArrayStorage<T, RFROM, CFROM>, buf: ArrayStorage<T, RFROM, CFROM>,
) -> VecStorage<MaybeUninit<T>, Dynamic, CTo> { ) -> VecStorage<MaybeUninit<T>, Dyn, CTo> {
let mut res = <Self as Allocator<T, Dynamic, CTo>>::allocate_uninit(rto, cto); let mut res = <Self as Allocator<T, Dyn, CTo>>::allocate_uninit(rto, cto);
let (rfrom, cfrom) = buf.shape(); let (rfrom, cfrom) = buf.shape();
@ -246,20 +242,20 @@ where
} }
} }
// Static × Static -> Static × Dynamic // Static × Static -> Static × Dyn
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<T: Scalar, RTo, const RFROM: usize, const CFROM: usize> impl<T: Scalar, RTo, const RFROM: usize, const CFROM: usize>
Reallocator<T, Const<RFROM>, Const<CFROM>, RTo, Dynamic> for DefaultAllocator Reallocator<T, Const<RFROM>, Const<CFROM>, RTo, Dyn> for DefaultAllocator
where where
RTo: DimName, RTo: DimName,
{ {
#[inline] #[inline]
unsafe fn reallocate_copy( unsafe fn reallocate_copy(
rto: RTo, rto: RTo,
cto: Dynamic, cto: Dyn,
buf: ArrayStorage<T, RFROM, CFROM>, buf: ArrayStorage<T, RFROM, CFROM>,
) -> VecStorage<MaybeUninit<T>, RTo, Dynamic> { ) -> VecStorage<MaybeUninit<T>, RTo, Dyn> {
let mut res = <Self as Allocator<T, RTo, Dynamic>>::allocate_uninit(rto, cto); let mut res = <Self as Allocator<T, RTo, Dyn>>::allocate_uninit(rto, cto);
let (rfrom, cfrom) = buf.shape(); let (rfrom, cfrom) = buf.shape();
@ -279,60 +275,58 @@ where
// All conversion from a dynamic buffer to a dynamic buffer. // All conversion from a dynamic buffer to a dynamic buffer.
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<T: Scalar, CFrom: Dim, CTo: Dim> Reallocator<T, Dynamic, CFrom, Dynamic, CTo> impl<T: Scalar, CFrom: Dim, CTo: Dim> Reallocator<T, Dyn, CFrom, Dyn, CTo> for DefaultAllocator {
for DefaultAllocator
{
#[inline] #[inline]
unsafe fn reallocate_copy( unsafe fn reallocate_copy(
rto: Dynamic, rto: Dyn,
cto: CTo, cto: CTo,
buf: VecStorage<T, Dynamic, CFrom>, buf: VecStorage<T, Dyn, CFrom>,
) -> VecStorage<MaybeUninit<T>, Dynamic, CTo> { ) -> VecStorage<MaybeUninit<T>, Dyn, CTo> {
let new_buf = buf.resize(rto.value() * cto.value()); let new_buf = buf.resize(rto.value() * cto.value());
VecStorage::new(rto, cto, new_buf) VecStorage::new(rto, cto, new_buf)
} }
} }
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<T: Scalar, CFrom: Dim, RTo: DimName> Reallocator<T, Dynamic, CFrom, RTo, Dynamic> impl<T: Scalar, CFrom: Dim, RTo: DimName> Reallocator<T, Dyn, CFrom, RTo, Dyn>
for DefaultAllocator for DefaultAllocator
{ {
#[inline] #[inline]
unsafe fn reallocate_copy( unsafe fn reallocate_copy(
rto: RTo, rto: RTo,
cto: Dynamic, cto: Dyn,
buf: VecStorage<T, Dynamic, CFrom>, buf: VecStorage<T, Dyn, CFrom>,
) -> VecStorage<MaybeUninit<T>, RTo, Dynamic> { ) -> VecStorage<MaybeUninit<T>, RTo, Dyn> {
let new_buf = buf.resize(rto.value() * cto.value()); let new_buf = buf.resize(rto.value() * cto.value());
VecStorage::new(rto, cto, new_buf) VecStorage::new(rto, cto, new_buf)
} }
} }
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<T: Scalar, RFrom: DimName, CTo: Dim> Reallocator<T, RFrom, Dynamic, Dynamic, CTo> impl<T: Scalar, RFrom: DimName, CTo: Dim> Reallocator<T, RFrom, Dyn, Dyn, CTo>
for DefaultAllocator for DefaultAllocator
{ {
#[inline] #[inline]
unsafe fn reallocate_copy( unsafe fn reallocate_copy(
rto: Dynamic, rto: Dyn,
cto: CTo, cto: CTo,
buf: VecStorage<T, RFrom, Dynamic>, buf: VecStorage<T, RFrom, Dyn>,
) -> VecStorage<MaybeUninit<T>, Dynamic, CTo> { ) -> VecStorage<MaybeUninit<T>, Dyn, CTo> {
let new_buf = buf.resize(rto.value() * cto.value()); let new_buf = buf.resize(rto.value() * cto.value());
VecStorage::new(rto, cto, new_buf) VecStorage::new(rto, cto, new_buf)
} }
} }
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<T: Scalar, RFrom: DimName, RTo: DimName> Reallocator<T, RFrom, Dynamic, RTo, Dynamic> impl<T: Scalar, RFrom: DimName, RTo: DimName> Reallocator<T, RFrom, Dyn, RTo, Dyn>
for DefaultAllocator for DefaultAllocator
{ {
#[inline] #[inline]
unsafe fn reallocate_copy( unsafe fn reallocate_copy(
rto: RTo, rto: RTo,
cto: Dynamic, cto: Dyn,
buf: VecStorage<T, RFrom, Dynamic>, buf: VecStorage<T, RFrom, Dyn>,
) -> VecStorage<MaybeUninit<T>, RTo, Dynamic> { ) -> VecStorage<MaybeUninit<T>, RTo, Dyn> {
let new_buf = buf.resize(rto.value() * cto.value()); let new_buf = buf.resize(rto.value() * cto.value());
VecStorage::new(rto, cto, new_buf) VecStorage::new(rto, cto, new_buf)
} }

View File

@ -24,19 +24,20 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer};
#[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))] #[cfg_attr(feature = "cuda", derive(cust_core::DeviceCopy))]
pub struct Dyn(pub usize); pub struct Dyn(pub usize);
// TODO: Deprecate? #[deprecated(note = "use Dyn instead.")]
pub type Dynamic = Dyn; pub type Dynamic = Dyn;
impl Dynamic { impl Dyn {
/// A dynamic size equal to `value`. /// A dynamic size equal to `value`.
#[inline] #[inline]
#[deprecated(note = "use Dyn(value) instead.")]
pub const fn new(value: usize) -> Self { pub const fn new(value: usize) -> Self {
Self(value) Self(value)
} }
} }
#[cfg(feature = "serde-serialize-no-std")] #[cfg(feature = "serde-serialize-no-std")]
impl Serialize for Dynamic { impl Serialize for Dyn {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where where
S: Serializer, S: Serializer,
@ -46,25 +47,25 @@ impl Serialize for Dynamic {
} }
#[cfg(feature = "serde-serialize-no-std")] #[cfg(feature = "serde-serialize-no-std")]
impl<'de> Deserialize<'de> for Dynamic { impl<'de> Deserialize<'de> for Dyn {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where where
D: Deserializer<'de>, D: Deserializer<'de>,
{ {
usize::deserialize(deserializer).map(|x| Dynamic::new(x)) usize::deserialize(deserializer).map(|x| Dyn(x))
} }
} }
/// Trait implemented by `Dynamic`. /// Trait implemented by `Dyn`.
pub trait IsDynamic {} pub trait IsDynamic {}
/// Trait implemented by `Dynamic` and type-level integers different from `U1`. /// Trait implemented by `Dyn` and type-level integers different from `U1`.
pub trait IsNotStaticOne {} pub trait IsNotStaticOne {}
impl IsDynamic for Dynamic {} impl IsDynamic for Dyn {}
impl IsNotStaticOne for Dynamic {} impl IsNotStaticOne for Dyn {}
/// Trait implemented by any type that can be used as a dimension. This includes type-level /// Trait implemented by any type that can be used as a dimension. This includes type-level
/// integers and `Dynamic` (for dimensions not known at compile-time). /// integers and `Dyn` (for dimensions not known at compile-time).
pub unsafe trait Dim: Any + Debug + Copy + PartialEq + Send + Sync { pub unsafe trait Dim: Any + Debug + Copy + PartialEq + Send + Sync {
#[inline(always)] #[inline(always)]
fn is<D: Dim>() -> bool { fn is<D: Dim>() -> bool {
@ -72,7 +73,7 @@ pub unsafe trait Dim: Any + Debug + Copy + PartialEq + Send + Sync {
} }
/// Gets the compile-time value of `Self`. Returns `None` if it is not known, i.e., if `Self = /// Gets the compile-time value of `Self`. Returns `None` if it is not known, i.e., if `Self =
/// Dynamic`. /// Dyn`.
fn try_to_usize() -> Option<usize>; fn try_to_usize() -> Option<usize>;
/// Gets the run-time value of `self`. For type-level integers, this is the same as /// Gets the run-time value of `self`. For type-level integers, this is the same as
@ -84,7 +85,7 @@ pub unsafe trait Dim: Any + Debug + Copy + PartialEq + Send + Sync {
fn from_usize(dim: usize) -> Self; fn from_usize(dim: usize) -> Self;
} }
unsafe impl Dim for Dynamic { unsafe impl Dim for Dyn {
#[inline] #[inline]
fn try_to_usize() -> Option<usize> { fn try_to_usize() -> Option<usize> {
None None
@ -92,7 +93,7 @@ unsafe impl Dim for Dynamic {
#[inline] #[inline]
fn from_usize(dim: usize) -> Self { fn from_usize(dim: usize) -> Self {
Self::new(dim) Self(dim)
} }
#[inline] #[inline]
@ -101,21 +102,21 @@ unsafe impl Dim for Dynamic {
} }
} }
impl Add<usize> for Dynamic { impl Add<usize> for Dyn {
type Output = Dynamic; type Output = Dyn;
#[inline] #[inline]
fn add(self, rhs: usize) -> Self { fn add(self, rhs: usize) -> Self {
Self::new(self.0 + rhs) Self(self.0 + rhs)
} }
} }
impl Sub<usize> for Dynamic { impl Sub<usize> for Dyn {
type Output = Dynamic; type Output = Dyn;
#[inline] #[inline]
fn sub(self, rhs: usize) -> Self { fn sub(self, rhs: usize) -> Self {
Self::new(self.0 - rhs) Self(self.0 - rhs)
} }
} }
@ -153,22 +154,22 @@ macro_rules! dim_ops(
} }
} }
impl<D: Dim> $DimOp<D> for Dynamic { impl<D: Dim> $DimOp<D> for Dyn {
type Output = Dynamic; type Output = Dyn;
#[inline] #[inline]
fn $op(self, other: D) -> Dynamic { fn $op(self, other: D) -> Dyn {
Dynamic::new($op_path(self.value(), other.value())) Dyn($op_path(self.value(), other.value()))
} }
} }
// TODO: use Const<T> instead of D: DimName? // TODO: use Const<T> instead of D: DimName?
impl<D: DimName> $DimOp<Dynamic> for D { impl<D: DimName> $DimOp<Dyn> for D {
type Output = Dynamic; type Output = Dyn;
#[inline] #[inline]
fn $op(self, other: Dynamic) -> Dynamic { fn $op(self, other: Dyn) -> Dyn {
Dynamic::new($op_path(self.value(), other.value())) Dyn($op_path(self.value(), other.value()))
} }
} }

View File

@ -7,7 +7,7 @@ use std::ptr;
use crate::base::allocator::{Allocator, Reallocator}; use crate::base::allocator::{Allocator, Reallocator};
use crate::base::constraint::{DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint}; use crate::base::constraint::{DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
use crate::base::dimension::Dynamic; use crate::base::dimension::Dyn;
use crate::base::dimension::{Const, Dim, DimAdd, DimDiff, DimMin, DimMinimum, DimSub, DimSum, U1}; use crate::base::dimension::{Const, Dim, DimAdd, DimDiff, DimMin, DimMinimum, DimSub, DimSum, U1};
use crate::base::storage::{RawStorage, RawStorageMut, ReshapableStorage}; use crate::base::storage::{RawStorage, RawStorageMut, ReshapableStorage};
use crate::base::{DefaultAllocator, Matrix, OMatrix, RowVector, Scalar, Vector}; use crate::base::{DefaultAllocator, Matrix, OMatrix, RowVector, Scalar, Vector};
@ -48,15 +48,15 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
/// Creates a new matrix by extracting the given set of rows from `self`. /// Creates a new matrix by extracting the given set of rows from `self`.
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
#[must_use] #[must_use]
pub fn select_rows<'a, I>(&self, irows: I) -> OMatrix<T, Dynamic, C> pub fn select_rows<'a, I>(&self, irows: I) -> OMatrix<T, Dyn, C>
where where
I: IntoIterator<Item = &'a usize>, I: IntoIterator<Item = &'a usize>,
I::IntoIter: ExactSizeIterator + Clone, I::IntoIter: ExactSizeIterator + Clone,
DefaultAllocator: Allocator<T, Dynamic, C>, DefaultAllocator: Allocator<T, Dyn, C>,
{ {
let irows = irows.into_iter(); let irows = irows.into_iter();
let ncols = self.shape_generic().1; let ncols = self.shape_generic().1;
let mut res = Matrix::uninit(Dynamic::new(irows.len()), ncols); let mut res = Matrix::uninit(Dyn(irows.len()), ncols);
// First, check that all the indices from irows are valid. // First, check that all the indices from irows are valid.
// This will allow us to use unchecked access in the inner loop. // This will allow us to use unchecked access in the inner loop.
@ -85,15 +85,15 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
/// Creates a new matrix by extracting the given set of columns from `self`. /// Creates a new matrix by extracting the given set of columns from `self`.
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
#[must_use] #[must_use]
pub fn select_columns<'a, I>(&self, icols: I) -> OMatrix<T, R, Dynamic> pub fn select_columns<'a, I>(&self, icols: I) -> OMatrix<T, R, Dyn>
where where
I: IntoIterator<Item = &'a usize>, I: IntoIterator<Item = &'a usize>,
I::IntoIter: ExactSizeIterator, I::IntoIter: ExactSizeIterator,
DefaultAllocator: Allocator<T, R, Dynamic>, DefaultAllocator: Allocator<T, R, Dyn>,
{ {
let icols = icols.into_iter(); let icols = icols.into_iter();
let nrows = self.shape_generic().0; let nrows = self.shape_generic().0;
let mut res = Matrix::uninit(nrows, Dynamic::new(icols.len())); let mut res = Matrix::uninit(nrows, Dyn(icols.len()));
for (destination, source) in icols.enumerate() { for (destination, source) in icols.enumerate() {
// NOTE: this is basically a copy_frow but wrapping the values insnide of MaybeUninit. // NOTE: this is basically a copy_frow but wrapping the values insnide of MaybeUninit.
@ -359,10 +359,10 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
/// Removes all columns in `indices` /// Removes all columns in `indices`
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub fn remove_columns_at(self, indices: &[usize]) -> OMatrix<T, R, Dynamic> pub fn remove_columns_at(self, indices: &[usize]) -> OMatrix<T, R, Dyn>
where where
C: DimSub<Dynamic, Output = Dynamic>, C: DimSub<Dyn, Output = Dyn>,
DefaultAllocator: Reallocator<T, R, C, R, Dynamic>, DefaultAllocator: Reallocator<T, R, C, R, Dyn>,
{ {
let mut m = self.into_owned(); let mut m = self.into_owned();
let (nrows, ncols) = m.shape_generic(); let (nrows, ncols) = m.shape_generic();
@ -400,7 +400,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
unsafe { unsafe {
let new_data = DefaultAllocator::reallocate_copy( let new_data = DefaultAllocator::reallocate_copy(
nrows, nrows,
ncols.sub(Dynamic::from_usize(offset)), ncols.sub(Dyn::from_usize(offset)),
m.data, m.data,
); );
@ -410,10 +410,10 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
/// Removes all rows in `indices` /// Removes all rows in `indices`
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub fn remove_rows_at(self, indices: &[usize]) -> OMatrix<T, Dynamic, C> pub fn remove_rows_at(self, indices: &[usize]) -> OMatrix<T, Dyn, C>
where where
R: DimSub<Dynamic, Output = Dynamic>, R: DimSub<Dyn, Output = Dyn>,
DefaultAllocator: Reallocator<T, R, C, Dynamic, C>, DefaultAllocator: Reallocator<T, R, C, Dyn, C>,
{ {
let mut m = self.into_owned(); let mut m = self.into_owned();
let (nrows, ncols) = m.shape_generic(); let (nrows, ncols) = m.shape_generic();
@ -448,7 +448,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
// be assumed to be initialized. // be assumed to be initialized.
unsafe { unsafe {
let new_data = DefaultAllocator::reallocate_copy( let new_data = DefaultAllocator::reallocate_copy(
nrows.sub(Dynamic::from_usize(offset / ncols.value())), nrows.sub(Dyn::from_usize(offset / ncols.value())),
ncols, ncols,
m.data, m.data,
); );
@ -474,12 +474,12 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
/// Removes `n` consecutive columns from this matrix, starting with the `i`-th (included). /// Removes `n` consecutive columns from this matrix, starting with the `i`-th (included).
#[inline] #[inline]
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub fn remove_columns(self, i: usize, n: usize) -> OMatrix<T, R, Dynamic> pub fn remove_columns(self, i: usize, n: usize) -> OMatrix<T, R, Dyn>
where where
C: DimSub<Dynamic, Output = Dynamic>, C: DimSub<Dyn, Output = Dyn>,
DefaultAllocator: Reallocator<T, R, C, R, Dynamic>, DefaultAllocator: Reallocator<T, R, C, R, Dyn>,
{ {
self.remove_columns_generic(i, Dynamic::new(n)) self.remove_columns_generic(i, Dyn(n))
} }
/// Removes `nremove.value()` columns from this matrix, starting with the `i`-th (included). /// Removes `nremove.value()` columns from this matrix, starting with the `i`-th (included).
@ -569,12 +569,12 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
/// Removes `n` consecutive rows from this matrix, starting with the `i`-th (included). /// Removes `n` consecutive rows from this matrix, starting with the `i`-th (included).
#[inline] #[inline]
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub fn remove_rows(self, i: usize, n: usize) -> OMatrix<T, Dynamic, C> pub fn remove_rows(self, i: usize, n: usize) -> OMatrix<T, Dyn, C>
where where
R: DimSub<Dynamic, Output = Dynamic>, R: DimSub<Dyn, Output = Dyn>,
DefaultAllocator: Reallocator<T, R, C, Dynamic, C>, DefaultAllocator: Reallocator<T, R, C, Dyn, C>,
{ {
self.remove_rows_generic(i, Dynamic::new(n)) self.remove_rows_generic(i, Dyn(n))
} }
/// Removes `nremove.value()` rows from this matrix, starting with the `i`-th (included). /// Removes `nremove.value()` rows from this matrix, starting with the `i`-th (included).
@ -659,12 +659,12 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
/// Inserts `n` columns filled with `val` starting at the `i-th` position. /// Inserts `n` columns filled with `val` starting at the `i-th` position.
#[inline] #[inline]
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub fn insert_columns(self, i: usize, n: usize, val: T) -> OMatrix<T, R, Dynamic> pub fn insert_columns(self, i: usize, n: usize, val: T) -> OMatrix<T, R, Dyn>
where where
C: DimAdd<Dynamic, Output = Dynamic>, C: DimAdd<Dyn, Output = Dyn>,
DefaultAllocator: Reallocator<T, R, C, R, Dynamic>, DefaultAllocator: Reallocator<T, R, C, R, Dyn>,
{ {
let mut res = unsafe { self.insert_columns_generic_uninitialized(i, Dynamic::new(n)) }; let mut res = unsafe { self.insert_columns_generic_uninitialized(i, Dyn(n)) };
res.columns_mut(i, n) res.columns_mut(i, n)
.fill_with(|| MaybeUninit::new(val.clone())); .fill_with(|| MaybeUninit::new(val.clone()));
@ -752,12 +752,12 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
/// Inserts `n` rows filled with `val` starting at the `i-th` position. /// Inserts `n` rows filled with `val` starting at the `i-th` position.
#[inline] #[inline]
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub fn insert_rows(self, i: usize, n: usize, val: T) -> OMatrix<T, Dynamic, C> pub fn insert_rows(self, i: usize, n: usize, val: T) -> OMatrix<T, Dyn, C>
where where
R: DimAdd<Dynamic, Output = Dynamic>, R: DimAdd<Dyn, Output = Dyn>,
DefaultAllocator: Reallocator<T, R, C, Dynamic, C>, DefaultAllocator: Reallocator<T, R, C, Dyn, C>,
{ {
let mut res = unsafe { self.insert_rows_generic_uninitialized(i, Dynamic::new(n)) }; let mut res = unsafe { self.insert_rows_generic_uninitialized(i, Dyn(n)) };
res.rows_mut(i, n) res.rows_mut(i, n)
.fill_with(|| MaybeUninit::new(val.clone())); .fill_with(|| MaybeUninit::new(val.clone()));
@ -815,11 +815,11 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
/// The values are copied such that `self[(i, j)] == result[(i, j)]`. If the result has more /// The values are copied such that `self[(i, j)] == result[(i, j)]`. If the result has more
/// rows and/or columns than `self`, then the extra rows or columns are filled with `val`. /// rows and/or columns than `self`, then the extra rows or columns are filled with `val`.
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub fn resize(self, new_nrows: usize, new_ncols: usize, val: T) -> OMatrix<T, Dynamic, Dynamic> pub fn resize(self, new_nrows: usize, new_ncols: usize, val: T) -> OMatrix<T, Dyn, Dyn>
where where
DefaultAllocator: Reallocator<T, R, C, Dynamic, Dynamic>, DefaultAllocator: Reallocator<T, R, C, Dyn, Dyn>,
{ {
self.resize_generic(Dynamic::new(new_nrows), Dynamic::new(new_ncols), val) self.resize_generic(Dyn(new_nrows), Dyn(new_ncols), val)
} }
/// Resizes this matrix vertically, i.e., so that it contains `new_nrows` rows while keeping the same number of columns. /// Resizes this matrix vertically, i.e., so that it contains `new_nrows` rows while keeping the same number of columns.
@ -827,12 +827,12 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
/// The values are copied such that `self[(i, j)] == result[(i, j)]`. If the result has more /// The values are copied such that `self[(i, j)] == result[(i, j)]`. If the result has more
/// rows than `self`, then the extra rows are filled with `val`. /// rows than `self`, then the extra rows are filled with `val`.
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub fn resize_vertically(self, new_nrows: usize, val: T) -> OMatrix<T, Dynamic, C> pub fn resize_vertically(self, new_nrows: usize, val: T) -> OMatrix<T, Dyn, C>
where where
DefaultAllocator: Reallocator<T, R, C, Dynamic, C>, DefaultAllocator: Reallocator<T, R, C, Dyn, C>,
{ {
let ncols = self.shape_generic().1; let ncols = self.shape_generic().1;
self.resize_generic(Dynamic::new(new_nrows), ncols, val) self.resize_generic(Dyn(new_nrows), ncols, val)
} }
/// Resizes this matrix horizontally, i.e., so that it contains `new_ncolumns` columns while keeping the same number of columns. /// Resizes this matrix horizontally, i.e., so that it contains `new_ncolumns` columns while keeping the same number of columns.
@ -840,12 +840,12 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
/// The values are copied such that `self[(i, j)] == result[(i, j)]`. If the result has more /// The values are copied such that `self[(i, j)] == result[(i, j)]`. If the result has more
/// columns than `self`, then the extra columns are filled with `val`. /// columns than `self`, then the extra columns are filled with `val`.
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub fn resize_horizontally(self, new_ncols: usize, val: T) -> OMatrix<T, R, Dynamic> pub fn resize_horizontally(self, new_ncols: usize, val: T) -> OMatrix<T, R, Dyn>
where where
DefaultAllocator: Reallocator<T, R, C, R, Dynamic>, DefaultAllocator: Reallocator<T, R, C, R, Dyn>,
{ {
let nrows = self.shape_generic().0; let nrows = self.shape_generic().0;
self.resize_generic(nrows, Dynamic::new(new_ncols), val) self.resize_generic(nrows, Dyn(new_ncols), val)
} }
/// Resizes this matrix so that it contains `R2::value()` rows and `C2::value()` columns. /// Resizes this matrix so that it contains `R2::value()` rows and `C2::value()` columns.
@ -962,7 +962,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
/// # Examples /// # Examples
/// ///
/// ``` /// ```
/// # use nalgebra::{Matrix3x2, Matrix2x3, DMatrix, Const, Dynamic}; /// # use nalgebra::{Matrix3x2, Matrix2x3, DMatrix, Const, Dyn};
/// ///
/// let m1 = Matrix2x3::new( /// let m1 = Matrix2x3::new(
/// 1.1, 1.2, 1.3, /// 1.1, 1.2, 1.3,
@ -998,7 +998,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
/// 0.0, 0.0, /// 0.0, 0.0,
/// ], /// ],
/// ); /// );
/// let reshaped = dm1.reshape_generic(Dynamic::new(6), Dynamic::new(2)); /// let reshaped = dm1.reshape_generic(Dyn(6), Dyn(2));
/// assert_eq!(reshaped, dm2); /// assert_eq!(reshaped, dm2);
/// ``` /// ```
pub fn reshape_generic<R2, C2>( pub fn reshape_generic<R2, C2>(
@ -1018,7 +1018,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
/// # In-place resizing /// # In-place resizing
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<T: Scalar> OMatrix<T, Dynamic, Dynamic> { impl<T: Scalar> OMatrix<T, Dyn, Dyn> {
/// Resizes this matrix in-place. /// Resizes this matrix in-place.
/// ///
/// The values are copied such that `self[(i, j)] == result[(i, j)]`. If the result has more /// The values are copied such that `self[(i, j)] == result[(i, j)]`. If the result has more
@ -1027,7 +1027,7 @@ impl<T: Scalar> OMatrix<T, Dynamic, Dynamic> {
/// Defined only for owned fully-dynamic matrices, i.e., `DMatrix`. /// Defined only for owned fully-dynamic matrices, i.e., `DMatrix`.
pub fn resize_mut(&mut self, new_nrows: usize, new_ncols: usize, val: T) pub fn resize_mut(&mut self, new_nrows: usize, new_ncols: usize, val: T)
where where
DefaultAllocator: Reallocator<T, Dynamic, Dynamic, Dynamic, Dynamic>, DefaultAllocator: Reallocator<T, Dyn, Dyn, Dyn, Dyn>,
{ {
// TODO: avoid the clone. // TODO: avoid the clone.
*self = self.clone().resize(new_nrows, new_ncols, val); *self = self.clone().resize(new_nrows, new_ncols, val);
@ -1035,9 +1035,9 @@ impl<T: Scalar> OMatrix<T, Dynamic, Dynamic> {
} }
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<T: Scalar, C: Dim> OMatrix<T, Dynamic, C> impl<T: Scalar, C: Dim> OMatrix<T, Dyn, C>
where where
DefaultAllocator: Allocator<T, Dynamic, C>, DefaultAllocator: Allocator<T, Dyn, C>,
{ {
/// Changes the number of rows of this matrix in-place. /// Changes the number of rows of this matrix in-place.
/// ///
@ -1048,7 +1048,7 @@ where
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub fn resize_vertically_mut(&mut self, new_nrows: usize, val: T) pub fn resize_vertically_mut(&mut self, new_nrows: usize, val: T)
where where
DefaultAllocator: Reallocator<T, Dynamic, C, Dynamic, C>, DefaultAllocator: Reallocator<T, Dyn, C, Dyn, C>,
{ {
// TODO: avoid the clone. // TODO: avoid the clone.
*self = self.clone().resize_vertically(new_nrows, val); *self = self.clone().resize_vertically(new_nrows, val);
@ -1056,9 +1056,9 @@ where
} }
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<T: Scalar, R: Dim> OMatrix<T, R, Dynamic> impl<T: Scalar, R: Dim> OMatrix<T, R, Dyn>
where where
DefaultAllocator: Allocator<T, R, Dynamic>, DefaultAllocator: Allocator<T, R, Dyn>,
{ {
/// Changes the number of column of this matrix in-place. /// Changes the number of column of this matrix in-place.
/// ///
@ -1069,7 +1069,7 @@ where
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
pub fn resize_horizontally_mut(&mut self, new_ncols: usize, val: T) pub fn resize_horizontally_mut(&mut self, new_ncols: usize, val: T)
where where
DefaultAllocator: Reallocator<T, R, Dynamic, R, Dynamic>, DefaultAllocator: Reallocator<T, R, Dyn, R, Dyn>,
{ {
// TODO: avoid the clone. // TODO: avoid the clone.
*self = self.clone().resize_horizontally(new_ncols, val); *self = self.clone().resize_horizontally(new_ncols, val);
@ -1167,7 +1167,7 @@ unsafe fn extend_rows<T>(data: &mut [T], nrows: usize, ncols: usize, i: usize, n
/// Extend the number of columns of the `Matrix` with elements from /// Extend the number of columns of the `Matrix` with elements from
/// a given iterator. /// a given iterator.
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<T, R, S> Extend<T> for Matrix<T, R, Dynamic, S> impl<T, R, S> Extend<T> for Matrix<T, R, Dyn, S>
where where
T: Scalar, T: Scalar,
R: Dim, R: Dim,
@ -1178,7 +1178,7 @@ where
/// ///
/// # Example /// # Example
/// ``` /// ```
/// # use nalgebra::{DMatrix, Dynamic, Matrix, OMatrix, Matrix3}; /// # use nalgebra::{DMatrix, Dyn, Matrix, OMatrix, Matrix3};
/// ///
/// let data = vec![0, 1, 2, // column 1 /// let data = vec![0, 1, 2, // column 1
/// 3, 4, 5]; // column 2 /// 3, 4, 5]; // column 2
@ -1198,7 +1198,7 @@ where
/// `Matrix`. /// `Matrix`.
/// ///
/// ```should_panic /// ```should_panic
/// # use nalgebra::{DMatrix, Dynamic, OMatrix}; /// # use nalgebra::{DMatrix, Dyn, OMatrix};
/// let data = vec![0, 1, 2, // column 1 /// let data = vec![0, 1, 2, // column 1
/// 3, 4, 5]; // column 2 /// 3, 4, 5]; // column 2
/// ///
@ -1215,7 +1215,7 @@ where
/// Extend the number of rows of the `Vector` with elements from /// Extend the number of rows of the `Vector` with elements from
/// a given iterator. /// a given iterator.
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<T, S> Extend<T> for Matrix<T, Dynamic, U1, S> impl<T, S> Extend<T> for Matrix<T, Dyn, U1, S>
where where
T: Scalar, T: Scalar,
S: Extend<T>, S: Extend<T>,
@ -1236,7 +1236,7 @@ where
} }
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl<T, R, S, RV, SV> Extend<Vector<T, RV, SV>> for Matrix<T, R, Dynamic, S> impl<T, R, S, RV, SV> Extend<Vector<T, RV, SV>> for Matrix<T, R, Dyn, S>
where where
T: Scalar, T: Scalar,
R: Dim, R: Dim,

View File

@ -3,7 +3,7 @@
use crate::base::storage::{RawStorage, RawStorageMut}; use crate::base::storage::{RawStorage, RawStorageMut};
use crate::base::{ use crate::base::{
Const, Dim, DimDiff, DimName, DimSub, Dynamic, Matrix, MatrixView, MatrixViewMut, Scalar, U1, Const, Dim, DimDiff, DimName, DimSub, Dyn, Matrix, MatrixView, MatrixViewMut, Scalar, U1,
}; };
use std::ops; use std::ops;
@ -49,7 +49,7 @@ fn dimrange_usize() {
} }
impl<D: Dim> DimRange<D> for ops::Range<usize> { impl<D: Dim> DimRange<D> for ops::Range<usize> {
type Length = Dynamic; type Length = Dyn;
#[inline(always)] #[inline(always)]
fn lower(&self, _: D) -> usize { fn lower(&self, _: D) -> usize {
@ -58,7 +58,7 @@ impl<D: Dim> DimRange<D> for ops::Range<usize> {
#[inline(always)] #[inline(always)]
fn length(&self, _: D) -> Self::Length { fn length(&self, _: D) -> Self::Length {
Dynamic::new(self.end.saturating_sub(self.start)) Dyn(self.end.saturating_sub(self.start))
} }
#[inline(always)] #[inline(always)]
@ -74,24 +74,24 @@ fn dimrange_range_usize() {
assert!(DimRange::contained_by(&(0..1), Const::<1>)); assert!(DimRange::contained_by(&(0..1), Const::<1>));
assert!(DimRange::contained_by( assert!(DimRange::contained_by(
&((usize::MAX - 1)..usize::MAX), &((usize::MAX - 1)..usize::MAX),
Dynamic::new(usize::MAX) Dyn(usize::MAX)
)); ));
assert_eq!( assert_eq!(
DimRange::length(&((usize::MAX - 1)..usize::MAX), Dynamic::new(usize::MAX)), DimRange::length(&((usize::MAX - 1)..usize::MAX), Dyn(usize::MAX)),
Dynamic::new(1) Dyn(1)
); );
assert_eq!( assert_eq!(
DimRange::length(&(usize::MAX..(usize::MAX - 1)), Dynamic::new(usize::MAX)), DimRange::length(&(usize::MAX..(usize::MAX - 1)), Dyn(usize::MAX)),
Dynamic::new(0) Dyn(0)
); );
assert_eq!( assert_eq!(
DimRange::length(&(usize::MAX..usize::MAX), Dynamic::new(usize::MAX)), DimRange::length(&(usize::MAX..usize::MAX), Dyn(usize::MAX)),
Dynamic::new(0) Dyn(0)
); );
} }
impl<D: Dim> DimRange<D> for ops::RangeFrom<usize> { impl<D: Dim> DimRange<D> for ops::RangeFrom<usize> {
type Length = Dynamic; type Length = Dyn;
#[inline(always)] #[inline(always)]
fn lower(&self, _: D) -> usize { fn lower(&self, _: D) -> usize {
@ -116,16 +116,13 @@ fn dimrange_rangefrom_usize() {
assert!(DimRange::contained_by(&(0..), Const::<1>)); assert!(DimRange::contained_by(&(0..), Const::<1>));
assert!(DimRange::contained_by( assert!(DimRange::contained_by(
&((usize::MAX - 1)..), &((usize::MAX - 1)..),
Dynamic::new(usize::MAX) Dyn(usize::MAX)
)); ));
assert_eq!( assert_eq!(
DimRange::length(&((usize::MAX - 1)..), Dynamic::new(usize::MAX)), DimRange::length(&((usize::MAX - 1)..), Dyn(usize::MAX)),
Dynamic::new(1) Dyn(1)
);
assert_eq!(
DimRange::length(&(usize::MAX..), Dynamic::new(usize::MAX)),
Dynamic::new(0)
); );
assert_eq!(DimRange::length(&(usize::MAX..), Dyn(usize::MAX)), Dyn(0));
} }
impl<D: Dim, T: Dim> DimRange<D> for ops::RangeFrom<T> impl<D: Dim, T: Dim> DimRange<D> for ops::RangeFrom<T>
@ -181,7 +178,7 @@ fn dimrange_rangefull() {
} }
impl<D: Dim> DimRange<D> for ops::RangeInclusive<usize> { impl<D: Dim> DimRange<D> for ops::RangeInclusive<usize> {
type Length = Dynamic; type Length = Dyn;
#[inline(always)] #[inline(always)]
fn lower(&self, _: D) -> usize { fn lower(&self, _: D) -> usize {
@ -190,7 +187,7 @@ impl<D: Dim> DimRange<D> for ops::RangeInclusive<usize> {
#[inline(always)] #[inline(always)]
fn length(&self, _: D) -> Self::Length { fn length(&self, _: D) -> Self::Length {
Dynamic::new(if self.end() < self.start() { Dyn(if self.end() < self.start() {
0 0
} else { } else {
self.end().wrapping_sub(self.start().wrapping_sub(1)) self.end().wrapping_sub(self.start().wrapping_sub(1))
@ -209,33 +206,33 @@ fn dimrange_rangeinclusive_usize() {
assert!(DimRange::contained_by(&(0..=0), Const::<1>)); assert!(DimRange::contained_by(&(0..=0), Const::<1>));
assert!(!DimRange::contained_by( assert!(!DimRange::contained_by(
&(usize::MAX..=usize::MAX), &(usize::MAX..=usize::MAX),
Dynamic::new(usize::MAX) Dyn(usize::MAX)
)); ));
assert!(!DimRange::contained_by( assert!(!DimRange::contained_by(
&((usize::MAX - 1)..=usize::MAX), &((usize::MAX - 1)..=usize::MAX),
Dynamic::new(usize::MAX) Dyn(usize::MAX)
)); ));
assert!(DimRange::contained_by( assert!(DimRange::contained_by(
&((usize::MAX - 1)..=(usize::MAX - 1)), &((usize::MAX - 1)..=(usize::MAX - 1)),
Dynamic::new(usize::MAX) Dyn(usize::MAX)
)); ));
assert_eq!(DimRange::length(&(0..=0), Const::<1>), Dynamic::new(1)); assert_eq!(DimRange::length(&(0..=0), Const::<1>), Dyn(1));
assert_eq!( assert_eq!(
DimRange::length(&((usize::MAX - 1)..=usize::MAX), Dynamic::new(usize::MAX)), DimRange::length(&((usize::MAX - 1)..=usize::MAX), Dyn(usize::MAX)),
Dynamic::new(2) Dyn(2)
); );
assert_eq!( assert_eq!(
DimRange::length(&(usize::MAX..=(usize::MAX - 1)), Dynamic::new(usize::MAX)), DimRange::length(&(usize::MAX..=(usize::MAX - 1)), Dyn(usize::MAX)),
Dynamic::new(0) Dyn(0)
); );
assert_eq!( assert_eq!(
DimRange::length(&(usize::MAX..=usize::MAX), Dynamic::new(usize::MAX)), DimRange::length(&(usize::MAX..=usize::MAX), Dyn(usize::MAX)),
Dynamic::new(1) Dyn(1)
); );
} }
impl<D: Dim> DimRange<D> for ops::RangeTo<usize> { impl<D: Dim> DimRange<D> for ops::RangeTo<usize> {
type Length = Dynamic; type Length = Dyn;
#[inline(always)] #[inline(always)]
fn lower(&self, _: D) -> usize { fn lower(&self, _: D) -> usize {
@ -244,7 +241,7 @@ impl<D: Dim> DimRange<D> for ops::RangeTo<usize> {
#[inline(always)] #[inline(always)]
fn length(&self, _: D) -> Self::Length { fn length(&self, _: D) -> Self::Length {
Dynamic::new(self.end) Dyn(self.end)
} }
#[inline(always)] #[inline(always)]
@ -260,20 +257,20 @@ fn dimrange_rangeto_usize() {
assert!(DimRange::contained_by(&(..0), Const::<1>)); assert!(DimRange::contained_by(&(..0), Const::<1>));
assert!(DimRange::contained_by( assert!(DimRange::contained_by(
&(..(usize::MAX - 1)), &(..(usize::MAX - 1)),
Dynamic::new(usize::MAX) Dyn(usize::MAX)
)); ));
assert_eq!( assert_eq!(
DimRange::length(&(..(usize::MAX - 1)), Dynamic::new(usize::MAX)), DimRange::length(&(..(usize::MAX - 1)), Dyn(usize::MAX)),
Dynamic::new(usize::MAX - 1) Dyn(usize::MAX - 1)
); );
assert_eq!( assert_eq!(
DimRange::length(&(..usize::MAX), Dynamic::new(usize::MAX)), DimRange::length(&(..usize::MAX), Dyn(usize::MAX)),
Dynamic::new(usize::MAX) Dyn(usize::MAX)
); );
} }
impl<D: Dim> DimRange<D> for ops::RangeToInclusive<usize> { impl<D: Dim> DimRange<D> for ops::RangeToInclusive<usize> {
type Length = Dynamic; type Length = Dyn;
#[inline(always)] #[inline(always)]
fn lower(&self, _: D) -> usize { fn lower(&self, _: D) -> usize {
@ -282,7 +279,7 @@ impl<D: Dim> DimRange<D> for ops::RangeToInclusive<usize> {
#[inline(always)] #[inline(always)]
fn length(&self, _: D) -> Self::Length { fn length(&self, _: D) -> Self::Length {
Dynamic::new(self.end + 1) Dyn(self.end + 1)
} }
#[inline(always)] #[inline(always)]
@ -296,17 +293,14 @@ fn dimrange_rangetoinclusive_usize() {
assert!(!DimRange::contained_by(&(..=0), Const::<0>)); assert!(!DimRange::contained_by(&(..=0), Const::<0>));
assert!(!DimRange::contained_by(&(..=1), Const::<0>)); assert!(!DimRange::contained_by(&(..=1), Const::<0>));
assert!(DimRange::contained_by(&(..=0), Const::<1>)); assert!(DimRange::contained_by(&(..=0), Const::<1>));
assert!(!DimRange::contained_by( assert!(!DimRange::contained_by(&(..=(usize::MAX)), Dyn(usize::MAX)));
&(..=(usize::MAX)),
Dynamic::new(usize::MAX)
));
assert!(DimRange::contained_by( assert!(DimRange::contained_by(
&(..=(usize::MAX - 1)), &(..=(usize::MAX - 1)),
Dynamic::new(usize::MAX) Dyn(usize::MAX)
)); ));
assert_eq!( assert_eq!(
DimRange::length(&(..=(usize::MAX - 1)), Dynamic::new(usize::MAX)), DimRange::length(&(..=(usize::MAX - 1)), Dyn(usize::MAX)),
Dynamic::new(usize::MAX) Dyn(usize::MAX)
); );
} }
@ -742,12 +736,12 @@ macro_rules! impl_index_pairs {
impl_index_pairs! { impl_index_pairs! {
index R with { index R with {
[<> usize => U1], [<> usize => U1],
[<> ops::Range<usize> => Dynamic], [<> ops::Range<usize> => Dyn],
[<> ops::RangeFrom<usize> => Dynamic], [<> ops::RangeFrom<usize> => Dyn],
[<> ops::RangeFull => R], [<> ops::RangeFull => R],
[<> ops::RangeInclusive<usize> => Dynamic], [<> ops::RangeInclusive<usize> => Dyn],
[<> ops::RangeTo<usize> => Dynamic], [<> ops::RangeTo<usize> => Dyn],
[<> ops::RangeToInclusive<usize> => Dynamic], [<> ops::RangeToInclusive<usize> => Dyn],
[<I: Dim> ops::RangeFrom<I> [<I: Dim> ops::RangeFrom<I>
=> DimDiff<R, I> => DimDiff<R, I>
@ -755,12 +749,12 @@ impl_index_pairs! {
} }
index C with { index C with {
[<> usize => U1], [<> usize => U1],
[<> ops::Range<usize> => Dynamic], [<> ops::Range<usize> => Dyn],
[<> ops::RangeFrom<usize> => Dynamic], [<> ops::RangeFrom<usize> => Dyn],
[<> ops::RangeFull => C], [<> ops::RangeFull => C],
[<> ops::RangeInclusive<usize> => Dynamic], [<> ops::RangeInclusive<usize> => Dyn],
[<> ops::RangeTo<usize> => Dynamic], [<> ops::RangeTo<usize> => Dyn],
[<> ops::RangeToInclusive<usize> => Dynamic], [<> ops::RangeToInclusive<usize> => Dyn],
[<J: DimName> ops::RangeFrom<J> [<J: DimName> ops::RangeFrom<J>
=> DimDiff<C, J> => DimDiff<C, J>

View File

@ -32,7 +32,7 @@ use crate::{ArrayStorage, SMatrix, SimdComplexField, Storage, UninitMatrix};
use crate::storage::IsContiguous; use crate::storage::IsContiguous;
use crate::uninit::{Init, InitStatus, Uninit}; use crate::uninit::{Init, InitStatus, Uninit};
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
use crate::{DMatrix, DVector, Dynamic, RowDVector, VecStorage}; use crate::{DMatrix, DVector, Dyn, RowDVector, VecStorage};
use std::mem::MaybeUninit; use std::mem::MaybeUninit;
/// A square matrix. /// A square matrix.
@ -146,13 +146,13 @@ pub type MatrixCross<T, R1, C1, R2, C2> =
/// - type-level unsigned integer constants (e.g. `U1024`, `U10000`) from the `typenum::` crate. /// - type-level unsigned integer constants (e.g. `U1024`, `U10000`) from the `typenum::` crate.
/// Using those, you will not get error messages as nice as for numbers smaller than 128 defined on /// Using those, you will not get error messages as nice as for numbers smaller than 128 defined on
/// the `nalgebra::` module. /// the `nalgebra::` module.
/// - the special value `Dynamic` from the `nalgebra::` root module. This indicates that the /// - the special value `Dyn` from the `nalgebra::` root module. This indicates that the
/// specified dimension is not known at compile-time. Note that this will generally imply that the /// specified dimension is not known at compile-time. Note that this will generally imply that the
/// matrix data storage `S` performs a dynamic allocation and contains extra metadata for the /// matrix data storage `S` performs a dynamic allocation and contains extra metadata for the
/// matrix shape. /// matrix shape.
/// ///
/// Note that mixing `Dynamic` with type-level unsigned integers is allowed. Actually, a /// Note that mixing `Dyn` with type-level unsigned integers is allowed. Actually, a
/// dynamically-sized column vector should be represented as a `Matrix<T, Dynamic, U1, S>` (given /// dynamically-sized column vector should be represented as a `Matrix<T, Dyn, U1, S>` (given
/// some concrete types for `T` and a compatible data storage type `S`). /// some concrete types for `T` and a compatible data storage type `S`).
#[repr(C)] #[repr(C)]
#[derive(Clone, Copy)] #[derive(Clone, Copy)]
@ -341,7 +341,7 @@ impl<T> DMatrix<T> {
/// ///
/// This method exists primarily as a workaround for the fact that `from_data` can not /// This method exists primarily as a workaround for the fact that `from_data` can not
/// work in `const fn` contexts. /// work in `const fn` contexts.
pub const fn from_vec_storage(storage: VecStorage<T, Dynamic, Dynamic>) -> Self { pub const fn from_vec_storage(storage: VecStorage<T, Dyn, Dyn>) -> Self {
// This is sound because the dimensions of the matrix and the storage are guaranteed // This is sound because the dimensions of the matrix and the storage are guaranteed
// to be the same // to be the same
unsafe { Self::from_data_statically_unchecked(storage) } unsafe { Self::from_data_statically_unchecked(storage) }
@ -356,7 +356,7 @@ impl<T> DVector<T> {
/// ///
/// This method exists primarily as a workaround for the fact that `from_data` can not /// This method exists primarily as a workaround for the fact that `from_data` can not
/// work in `const fn` contexts. /// work in `const fn` contexts.
pub const fn from_vec_storage(storage: VecStorage<T, Dynamic, U1>) -> Self { pub const fn from_vec_storage(storage: VecStorage<T, Dyn, U1>) -> Self {
// This is sound because the dimensions of the matrix and the storage are guaranteed // This is sound because the dimensions of the matrix and the storage are guaranteed
// to be the same // to be the same
unsafe { Self::from_data_statically_unchecked(storage) } unsafe { Self::from_data_statically_unchecked(storage) }
@ -371,7 +371,7 @@ impl<T> RowDVector<T> {
/// ///
/// This method exists primarily as a workaround for the fact that `from_data` can not /// This method exists primarily as a workaround for the fact that `from_data` can not
/// work in `const fn` contexts. /// work in `const fn` contexts.
pub const fn from_vec_storage(storage: VecStorage<T, U1, Dynamic>) -> Self { pub const fn from_vec_storage(storage: VecStorage<T, U1, Dyn>) -> Self {
// This is sound because the dimensions of the matrix and the storage are guaranteed // This is sound because the dimensions of the matrix and the storage are guaranteed
// to be the same // to be the same
unsafe { Self::from_data_statically_unchecked(storage) } unsafe { Self::from_data_statically_unchecked(storage) }
@ -417,7 +417,7 @@ impl<T, R: Dim, C: Dim, S: RawStorage<T, R, C>> Matrix<T, R, C, S> {
(nrows.value(), ncols.value()) (nrows.value(), ncols.value())
} }
/// The shape of this matrix wrapped into their representative types (`Const` or `Dynamic`). /// The shape of this matrix wrapped into their representative types (`Const` or `Dyn`).
#[inline] #[inline]
#[must_use] #[must_use]
pub fn shape_generic(&self) -> (R, C) { pub fn shape_generic(&self) -> (R, C) {

View File

@ -4,7 +4,7 @@ use std::slice;
use crate::base::allocator::Allocator; use crate::base::allocator::Allocator;
use crate::base::default_allocator::DefaultAllocator; use crate::base::default_allocator::DefaultAllocator;
use crate::base::dimension::{Const, Dim, DimName, Dynamic, IsNotStaticOne, U1}; use crate::base::dimension::{Const, Dim, DimName, Dyn, IsNotStaticOne, U1};
use crate::base::iter::MatrixIter; use crate::base::iter::MatrixIter;
use crate::base::storage::{IsContiguous, Owned, RawStorage, RawStorageMut, Storage}; use crate::base::storage::{IsContiguous, Owned, RawStorage, RawStorageMut, Storage};
use crate::base::{Matrix, Scalar}; use crate::base::{Matrix, Scalar};
@ -60,8 +60,8 @@ macro_rules! view_storage_impl (
} }
} }
// Dynamic is arbitrary. It's just to be able to call the constructors with `Slice::` // Dyn is arbitrary. It's just to be able to call the constructors with `Slice::`
impl<'a, T, R: Dim, C: Dim> $T<'a, T, R, C, Dynamic, Dynamic> { impl<'a, T, R: Dim, C: Dim> $T<'a, T, R, C, Dyn, Dyn> {
/// Create a new matrix view without bounds checking. /// Create a new matrix view without bounds checking.
#[inline] #[inline]
pub unsafe fn new_unchecked<RStor, CStor, S>(storage: $SRef, start: (usize, usize), shape: (R, C)) pub unsafe fn new_unchecked<RStor, CStor, S>(storage: $SRef, start: (usize, usize), shape: (R, C))
@ -180,7 +180,7 @@ macro_rules! storage_impl(
#[inline] #[inline]
fn is_contiguous(&self) -> bool { fn is_contiguous(&self) -> bool {
// Common cases that can be deduced at compile-time even if one of the dimensions // Common cases that can be deduced at compile-time even if one of the dimensions
// is Dynamic. // is Dyn.
if (RStride::is::<U1>() && C::is::<U1>()) || // Column vector. if (RStride::is::<U1>() && C::is::<U1>()) || // Column vector.
(CStride::is::<U1>() && R::is::<U1>()) { // Row vector. (CStride::is::<U1>() && R::is::<U1>()) { // Row vector.
true true
@ -325,24 +325,24 @@ macro_rules! matrix_view_impl (
/// Returns a view containing the `n` first elements of the i-th row of this matrix. /// Returns a view containing the `n` first elements of the i-th row of this matrix.
#[inline] #[inline]
pub fn $row_part($me: $Me, i: usize, n: usize) -> $MatrixView<'_, T, U1, Dynamic, S::RStride, S::CStride> { pub fn $row_part($me: $Me, i: usize, n: usize) -> $MatrixView<'_, T, U1, Dyn, S::RStride, S::CStride> {
$me.$generic_view((i, 0), (Const::<1>, Dynamic::new(n))) $me.$generic_view((i, 0), (Const::<1>, Dyn(n)))
} }
/// Extracts from this matrix a set of consecutive rows. /// Extracts from this matrix a set of consecutive rows.
#[inline] #[inline]
pub fn $rows($me: $Me, first_row: usize, nrows: usize) pub fn $rows($me: $Me, first_row: usize, nrows: usize)
-> $MatrixView<'_, T, Dynamic, C, S::RStride, S::CStride> { -> $MatrixView<'_, T, Dyn, C, S::RStride, S::CStride> {
$me.$rows_generic(first_row, Dynamic::new(nrows)) $me.$rows_generic(first_row, Dyn(nrows))
} }
/// Extracts from this matrix a set of consecutive rows regularly skipping `step` rows. /// Extracts from this matrix a set of consecutive rows regularly skipping `step` rows.
#[inline] #[inline]
pub fn $rows_with_step($me: $Me, first_row: usize, nrows: usize, step: usize) pub fn $rows_with_step($me: $Me, first_row: usize, nrows: usize, step: usize)
-> $MatrixView<'_, T, Dynamic, C, Dynamic, S::CStride> { -> $MatrixView<'_, T, Dyn, C, Dyn, S::CStride> {
$me.$rows_generic_with_step(first_row, Dynamic::new(nrows), step) $me.$rows_generic_with_step(first_row, Dyn(nrows), step)
} }
/// Extracts a compile-time number of consecutive rows from this matrix. /// Extracts a compile-time number of consecutive rows from this matrix.
@ -357,7 +357,7 @@ macro_rules! matrix_view_impl (
/// rows. /// rows.
#[inline] #[inline]
pub fn $fixed_rows_with_step<const RVIEW: usize>($me: $Me, first_row: usize, step: usize) pub fn $fixed_rows_with_step<const RVIEW: usize>($me: $Me, first_row: usize, step: usize)
-> $MatrixView<'_, T, Const<RVIEW>, C, Dynamic, S::CStride> { -> $MatrixView<'_, T, Const<RVIEW>, C, Dyn, S::CStride> {
$me.$rows_generic_with_step(first_row, Const::<RVIEW>, step) $me.$rows_generic_with_step(first_row, Const::<RVIEW>, step)
} }
@ -383,14 +383,14 @@ macro_rules! matrix_view_impl (
/// argument may or may not be values known at compile-time. /// argument may or may not be values known at compile-time.
#[inline] #[inline]
pub fn $rows_generic_with_step<RView>($me: $Me, row_start: usize, nrows: RView, step: usize) pub fn $rows_generic_with_step<RView>($me: $Me, row_start: usize, nrows: RView, step: usize)
-> $MatrixView<'_, T, RView, C, Dynamic, S::CStride> -> $MatrixView<'_, T, RView, C, Dyn, S::CStride>
where RView: Dim { where RView: Dim {
let my_shape = $me.shape_generic(); let my_shape = $me.shape_generic();
let my_strides = $me.data.strides(); let my_strides = $me.data.strides();
$me.assert_view_index((row_start, 0), (nrows.value(), my_shape.1.value()), (step, 0)); $me.assert_view_index((row_start, 0), (nrows.value(), my_shape.1.value()), (step, 0));
let strides = (Dynamic::new((step + 1) * my_strides.0.value()), my_strides.1); let strides = (Dyn((step + 1) * my_strides.0.value()), my_strides.1);
let shape = (nrows, my_shape.1); let shape = (nrows, my_shape.1);
unsafe { unsafe {
@ -412,25 +412,25 @@ macro_rules! matrix_view_impl (
/// Returns a view containing the `n` first elements of the i-th column of this matrix. /// Returns a view containing the `n` first elements of the i-th column of this matrix.
#[inline] #[inline]
pub fn $column_part($me: $Me, i: usize, n: usize) -> $MatrixView<'_, T, Dynamic, U1, S::RStride, S::CStride> { pub fn $column_part($me: $Me, i: usize, n: usize) -> $MatrixView<'_, T, Dyn, U1, S::RStride, S::CStride> {
$me.$generic_view((0, i), (Dynamic::new(n), Const::<1>)) $me.$generic_view((0, i), (Dyn(n), Const::<1>))
} }
/// Extracts from this matrix a set of consecutive columns. /// Extracts from this matrix a set of consecutive columns.
#[inline] #[inline]
pub fn $columns($me: $Me, first_col: usize, ncols: usize) pub fn $columns($me: $Me, first_col: usize, ncols: usize)
-> $MatrixView<'_, T, R, Dynamic, S::RStride, S::CStride> { -> $MatrixView<'_, T, R, Dyn, S::RStride, S::CStride> {
$me.$columns_generic(first_col, Dynamic::new(ncols)) $me.$columns_generic(first_col, Dyn(ncols))
} }
/// Extracts from this matrix a set of consecutive columns regularly skipping `step` /// Extracts from this matrix a set of consecutive columns regularly skipping `step`
/// columns. /// columns.
#[inline] #[inline]
pub fn $columns_with_step($me: $Me, first_col: usize, ncols: usize, step: usize) pub fn $columns_with_step($me: $Me, first_col: usize, ncols: usize, step: usize)
-> $MatrixView<'_, T, R, Dynamic, S::RStride, Dynamic> { -> $MatrixView<'_, T, R, Dyn, S::RStride, Dyn> {
$me.$columns_generic_with_step(first_col, Dynamic::new(ncols), step) $me.$columns_generic_with_step(first_col, Dyn(ncols), step)
} }
/// Extracts a compile-time number of consecutive columns from this matrix. /// Extracts a compile-time number of consecutive columns from this matrix.
@ -445,7 +445,7 @@ macro_rules! matrix_view_impl (
/// `step` columns. /// `step` columns.
#[inline] #[inline]
pub fn $fixed_columns_with_step<const CVIEW: usize>($me: $Me, first_col: usize, step: usize) pub fn $fixed_columns_with_step<const CVIEW: usize>($me: $Me, first_col: usize, step: usize)
-> $MatrixView<'_, T, R, Const<CVIEW>, S::RStride, Dynamic> { -> $MatrixView<'_, T, R, Const<CVIEW>, S::RStride, Dyn> {
$me.$columns_generic_with_step(first_col, Const::<CVIEW>, step) $me.$columns_generic_with_step(first_col, Const::<CVIEW>, step)
} }
@ -471,14 +471,14 @@ macro_rules! matrix_view_impl (
/// or may not be values known at compile-time. /// or may not be values known at compile-time.
#[inline] #[inline]
pub fn $columns_generic_with_step<CView: Dim>($me: $Me, first_col: usize, ncols: CView, step: usize) pub fn $columns_generic_with_step<CView: Dim>($me: $Me, first_col: usize, ncols: CView, step: usize)
-> $MatrixView<'_, T, R, CView, S::RStride, Dynamic> { -> $MatrixView<'_, T, R, CView, S::RStride, Dyn> {
let my_shape = $me.shape_generic(); let my_shape = $me.shape_generic();
let my_strides = $me.data.strides(); let my_strides = $me.data.strides();
$me.assert_view_index((0, first_col), (my_shape.0.value(), ncols.value()), (0, step)); $me.assert_view_index((0, first_col), (my_shape.0.value(), ncols.value()), (0, step));
let strides = (my_strides.0, Dynamic::new((step + 1) * my_strides.1.value())); let strides = (my_strides.0, Dyn((step + 1) * my_strides.1.value()));
let shape = (my_shape.0, ncols); let shape = (my_shape.0, ncols);
unsafe { unsafe {
@ -497,7 +497,7 @@ macro_rules! matrix_view_impl (
#[inline] #[inline]
#[deprecated = slice_deprecation_note!($view)] #[deprecated = slice_deprecation_note!($view)]
pub fn $slice($me: $Me, start: (usize, usize), shape: (usize, usize)) pub fn $slice($me: $Me, start: (usize, usize), shape: (usize, usize))
-> $MatrixView<'_, T, Dynamic, Dynamic, S::RStride, S::CStride> { -> $MatrixView<'_, T, Dyn, Dyn, S::RStride, S::CStride> {
$me.$view(start, shape) $me.$view(start, shape)
} }
@ -505,10 +505,10 @@ macro_rules! matrix_view_impl (
/// consecutive elements. /// consecutive elements.
#[inline] #[inline]
pub fn $view($me: $Me, start: (usize, usize), shape: (usize, usize)) pub fn $view($me: $Me, start: (usize, usize), shape: (usize, usize))
-> $MatrixView<'_, T, Dynamic, Dynamic, S::RStride, S::CStride> { -> $MatrixView<'_, T, Dyn, Dyn, S::RStride, S::CStride> {
$me.assert_view_index(start, shape, (0, 0)); $me.assert_view_index(start, shape, (0, 0));
let shape = (Dynamic::new(shape.0), Dynamic::new(shape.1)); let shape = (Dyn(shape.0), Dyn(shape.1));
unsafe { unsafe {
let data = $ViewStorage::new_unchecked($data, start, shape); let data = $ViewStorage::new_unchecked($data, start, shape);
@ -523,7 +523,7 @@ macro_rules! matrix_view_impl (
#[inline] #[inline]
#[deprecated = slice_deprecation_note!($view_with_steps)] #[deprecated = slice_deprecation_note!($view_with_steps)]
pub fn $slice_with_steps($me: $Me, start: (usize, usize), shape: (usize, usize), steps: (usize, usize)) pub fn $slice_with_steps($me: $Me, start: (usize, usize), shape: (usize, usize), steps: (usize, usize))
-> $MatrixView<'_, T, Dynamic, Dynamic, Dynamic, Dynamic> { -> $MatrixView<'_, T, Dyn, Dyn, Dyn, Dyn> {
$me.$view_with_steps(start, shape, steps) $me.$view_with_steps(start, shape, steps)
} }
@ -533,8 +533,8 @@ macro_rules! matrix_view_impl (
/// original matrix. /// original matrix.
#[inline] #[inline]
pub fn $view_with_steps($me: $Me, start: (usize, usize), shape: (usize, usize), steps: (usize, usize)) pub fn $view_with_steps($me: $Me, start: (usize, usize), shape: (usize, usize), steps: (usize, usize))
-> $MatrixView<'_, T, Dynamic, Dynamic, Dynamic, Dynamic> { -> $MatrixView<'_, T, Dyn, Dyn, Dyn, Dyn> {
let shape = (Dynamic::new(shape.0), Dynamic::new(shape.1)); let shape = (Dyn(shape.0), Dyn(shape.1));
$me.$generic_view_with_steps(start, shape, steps) $me.$generic_view_with_steps(start, shape, steps)
} }
@ -569,7 +569,7 @@ macro_rules! matrix_view_impl (
#[inline] #[inline]
#[deprecated = slice_deprecation_note!($fixed_view_with_steps)] #[deprecated = slice_deprecation_note!($fixed_view_with_steps)]
pub fn $fixed_slice_with_steps<const RVIEW: usize, const CVIEW: usize>($me: $Me, start: (usize, usize), steps: (usize, usize)) pub fn $fixed_slice_with_steps<const RVIEW: usize, const CVIEW: usize>($me: $Me, start: (usize, usize), steps: (usize, usize))
-> $MatrixView<'_, T, Const<RVIEW>, Const<CVIEW>, Dynamic, Dynamic> { -> $MatrixView<'_, T, Const<RVIEW>, Const<CVIEW>, Dyn, Dyn> {
$me.$fixed_view_with_steps(start, steps) $me.$fixed_view_with_steps(start, steps)
} }
@ -579,7 +579,7 @@ macro_rules! matrix_view_impl (
/// the original matrix. /// the original matrix.
#[inline] #[inline]
pub fn $fixed_view_with_steps<const RVIEW: usize, const CVIEW: usize>($me: $Me, start: (usize, usize), steps: (usize, usize)) pub fn $fixed_view_with_steps<const RVIEW: usize, const CVIEW: usize>($me: $Me, start: (usize, usize), steps: (usize, usize))
-> $MatrixView<'_, T, Const<RVIEW>, Const<CVIEW>, Dynamic, Dynamic> { -> $MatrixView<'_, T, Const<RVIEW>, Const<CVIEW>, Dyn, Dyn> {
let shape = (Const::<RVIEW>, Const::<CVIEW>); let shape = (Const::<RVIEW>, Const::<CVIEW>);
$me.$generic_view_with_steps(start, shape, steps) $me.$generic_view_with_steps(start, shape, steps)
} }
@ -616,7 +616,7 @@ macro_rules! matrix_view_impl (
start: (usize, usize), start: (usize, usize),
shape: (RView, CView), shape: (RView, CView),
steps: (usize, usize)) steps: (usize, usize))
-> $MatrixView<'_, T, RView, CView, Dynamic, Dynamic> -> $MatrixView<'_, T, RView, CView, Dyn, Dyn>
where RView: Dim, where RView: Dim,
CView: Dim { CView: Dim {
$me.$generic_view_with_steps(start, shape, steps) $me.$generic_view_with_steps(start, shape, steps)
@ -628,15 +628,15 @@ macro_rules! matrix_view_impl (
start: (usize, usize), start: (usize, usize),
shape: (RView, CView), shape: (RView, CView),
steps: (usize, usize)) steps: (usize, usize))
-> $MatrixView<'_, T, RView, CView, Dynamic, Dynamic> -> $MatrixView<'_, T, RView, CView, Dyn, Dyn>
where RView: Dim, where RView: Dim,
CView: Dim { CView: Dim {
$me.assert_view_index(start, (shape.0.value(), shape.1.value()), steps); $me.assert_view_index(start, (shape.0.value(), shape.1.value()), steps);
let my_strides = $me.data.strides(); let my_strides = $me.data.strides();
let strides = (Dynamic::new((steps.0 + 1) * my_strides.0.value()), let strides = (Dyn((steps.0 + 1) * my_strides.0.value()),
Dynamic::new((steps.1 + 1) * my_strides.1.value())); Dyn((steps.1 + 1) * my_strides.1.value()));
unsafe { unsafe {
let data = $ViewStorage::new_with_strides_unchecked($data, start, shape, strides); let data = $ViewStorage::new_with_strides_unchecked($data, start, shape, strides);
@ -860,7 +860,7 @@ impl<D: Dim> DimRange<D> for usize {
} }
impl<D: Dim> DimRange<D> for Range<usize> { impl<D: Dim> DimRange<D> for Range<usize> {
type Size = Dynamic; type Size = Dyn;
#[inline(always)] #[inline(always)]
fn begin(&self, _: D) -> usize { fn begin(&self, _: D) -> usize {
@ -874,12 +874,12 @@ impl<D: Dim> DimRange<D> for Range<usize> {
#[inline(always)] #[inline(always)]
fn size(&self, _: D) -> Self::Size { fn size(&self, _: D) -> Self::Size {
Dynamic::new(self.end - self.start) Dyn(self.end - self.start)
} }
} }
impl<D: Dim> DimRange<D> for RangeFrom<usize> { impl<D: Dim> DimRange<D> for RangeFrom<usize> {
type Size = Dynamic; type Size = Dyn;
#[inline(always)] #[inline(always)]
fn begin(&self, _: D) -> usize { fn begin(&self, _: D) -> usize {
@ -893,12 +893,12 @@ impl<D: Dim> DimRange<D> for RangeFrom<usize> {
#[inline(always)] #[inline(always)]
fn size(&self, dim: D) -> Self::Size { fn size(&self, dim: D) -> Self::Size {
Dynamic::new(dim.value() - self.start) Dyn(dim.value() - self.start)
} }
} }
impl<D: Dim> DimRange<D> for RangeTo<usize> { impl<D: Dim> DimRange<D> for RangeTo<usize> {
type Size = Dynamic; type Size = Dyn;
#[inline(always)] #[inline(always)]
fn begin(&self, _: D) -> usize { fn begin(&self, _: D) -> usize {
@ -912,7 +912,7 @@ impl<D: Dim> DimRange<D> for RangeTo<usize> {
#[inline(always)] #[inline(always)]
fn size(&self, _: D) -> Self::Size { fn size(&self, _: D) -> Self::Size {
Dynamic::new(self.end) Dyn(self.end)
} }
} }
@ -936,7 +936,7 @@ impl<D: Dim> DimRange<D> for RangeFull {
} }
impl<D: Dim> DimRange<D> for RangeInclusive<usize> { impl<D: Dim> DimRange<D> for RangeInclusive<usize> {
type Size = Dynamic; type Size = Dyn;
#[inline(always)] #[inline(always)]
fn begin(&self, _: D) -> usize { fn begin(&self, _: D) -> usize {
@ -950,7 +950,7 @@ impl<D: Dim> DimRange<D> for RangeInclusive<usize> {
#[inline(always)] #[inline(always)]
fn size(&self, _: D) -> Self::Size { fn size(&self, _: D) -> Self::Size {
Dynamic::new(*self.end() + 1 - *self.start()) Dyn(*self.end() + 1 - *self.start())
} }
} }

View File

@ -11,7 +11,7 @@ use crate::base::blas_uninit::gemm_uninit;
use crate::base::constraint::{ use crate::base::constraint::{
AreMultipliable, DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint, AreMultipliable, DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint,
}; };
use crate::base::dimension::{Dim, DimMul, DimName, DimProd, Dynamic}; use crate::base::dimension::{Dim, DimMul, DimName, DimProd, Dyn};
use crate::base::storage::{Storage, StorageMut}; use crate::base::storage::{Storage, StorageMut};
use crate::base::uninit::Uninit; use crate::base::uninit::Uninit;
use crate::base::{DefaultAllocator, Matrix, MatrixSum, OMatrix, Scalar, VectorView}; use crate::base::{DefaultAllocator, Matrix, MatrixSum, OMatrix, Scalar, VectorView};
@ -374,10 +374,10 @@ where
} }
} }
impl<T, C: Dim> iter::Sum for OMatrix<T, Dynamic, C> impl<T, C: Dim> iter::Sum for OMatrix<T, Dyn, C>
where where
T: Scalar + ClosedAdd + Zero, T: Scalar + ClosedAdd + Zero,
DefaultAllocator: Allocator<T, Dynamic, C>, DefaultAllocator: Allocator<T, Dyn, C>,
{ {
/// # Example /// # Example
/// ``` /// ```
@ -395,7 +395,7 @@ where
/// # use nalgebra::DMatrix; /// # use nalgebra::DMatrix;
/// iter::empty::<DMatrix<f64>>().sum::<DMatrix<f64>>(); // panics! /// iter::empty::<DMatrix<f64>>().sum::<DMatrix<f64>>(); // panics!
/// ``` /// ```
fn sum<I: Iterator<Item = OMatrix<T, Dynamic, C>>>(mut iter: I) -> OMatrix<T, Dynamic, C> { fn sum<I: Iterator<Item = OMatrix<T, Dyn, C>>>(mut iter: I) -> OMatrix<T, Dyn, C> {
if let Some(first) = iter.next() { if let Some(first) = iter.next() {
iter.fold(first, |acc, x| acc + x) iter.fold(first, |acc, x| acc + x)
} else { } else {
@ -414,10 +414,10 @@ where
} }
} }
impl<'a, T, C: Dim> iter::Sum<&'a OMatrix<T, Dynamic, C>> for OMatrix<T, Dynamic, C> impl<'a, T, C: Dim> iter::Sum<&'a OMatrix<T, Dyn, C>> for OMatrix<T, Dyn, C>
where where
T: Scalar + ClosedAdd + Zero, T: Scalar + ClosedAdd + Zero,
DefaultAllocator: Allocator<T, Dynamic, C>, DefaultAllocator: Allocator<T, Dyn, C>,
{ {
/// # Example /// # Example
/// ``` /// ```
@ -435,7 +435,7 @@ where
/// # use nalgebra::DMatrix; /// # use nalgebra::DMatrix;
/// iter::empty::<&DMatrix<f64>>().sum::<DMatrix<f64>>(); // panics! /// iter::empty::<&DMatrix<f64>>().sum::<DMatrix<f64>>(); // panics!
/// ``` /// ```
fn sum<I: Iterator<Item = &'a OMatrix<T, Dynamic, C>>>(mut iter: I) -> OMatrix<T, Dynamic, C> { fn sum<I: Iterator<Item = &'a OMatrix<T, Dyn, C>>>(mut iter: I) -> OMatrix<T, Dyn, C> {
if let Some(first) = iter.next() { if let Some(first) = iter.next() {
iter.fold(first.clone(), |acc, x| acc + x) iter.fold(first.clone(), |acc, x| acc + x)
} else { } else {

View File

@ -4,7 +4,7 @@ use alloc::vec::Vec;
use crate::base::allocator::Allocator; use crate::base::allocator::Allocator;
use crate::base::constraint::{SameNumberOfRows, ShapeConstraint}; use crate::base::constraint::{SameNumberOfRows, ShapeConstraint};
use crate::base::default_allocator::DefaultAllocator; use crate::base::default_allocator::DefaultAllocator;
use crate::base::dimension::{Dim, DimName, Dynamic, U1}; use crate::base::dimension::{Dim, DimName, Dyn, U1};
use crate::base::storage::{IsContiguous, Owned, RawStorage, RawStorageMut, ReshapableStorage}; use crate::base::storage::{IsContiguous, Owned, RawStorage, RawStorageMut, ReshapableStorage};
use crate::base::{Scalar, Vector}; use crate::base::{Scalar, Vector};
@ -188,13 +188,13 @@ impl<T, R: Dim, C: Dim> From<VecStorage<T, R, C>> for Vec<T> {
/* /*
* *
* Dynamic Static * Dyn Static
* Dynamic Dynamic * Dyn Dyn
* *
*/ */
unsafe impl<T, C: Dim> RawStorage<T, Dynamic, C> for VecStorage<T, Dynamic, C> { unsafe impl<T, C: Dim> RawStorage<T, Dyn, C> for VecStorage<T, Dyn, C> {
type RStride = U1; type RStride = U1;
type CStride = Dynamic; type CStride = Dyn;
#[inline] #[inline]
fn ptr(&self) -> *const T { fn ptr(&self) -> *const T {
@ -202,7 +202,7 @@ unsafe impl<T, C: Dim> RawStorage<T, Dynamic, C> for VecStorage<T, Dynamic, C> {
} }
#[inline] #[inline]
fn shape(&self) -> (Dynamic, C) { fn shape(&self) -> (Dyn, C) {
(self.nrows, self.ncols) (self.nrows, self.ncols)
} }
@ -222,28 +222,28 @@ unsafe impl<T, C: Dim> RawStorage<T, Dynamic, C> for VecStorage<T, Dynamic, C> {
} }
} }
unsafe impl<T: Scalar, C: Dim> Storage<T, Dynamic, C> for VecStorage<T, Dynamic, C> unsafe impl<T: Scalar, C: Dim> Storage<T, Dyn, C> for VecStorage<T, Dyn, C>
where where
DefaultAllocator: Allocator<T, Dynamic, C, Buffer = Self>, DefaultAllocator: Allocator<T, Dyn, C, Buffer = Self>,
{ {
#[inline] #[inline]
fn into_owned(self) -> Owned<T, Dynamic, C> fn into_owned(self) -> Owned<T, Dyn, C>
where where
DefaultAllocator: Allocator<T, Dynamic, C>, DefaultAllocator: Allocator<T, Dyn, C>,
{ {
self self
} }
#[inline] #[inline]
fn clone_owned(&self) -> Owned<T, Dynamic, C> fn clone_owned(&self) -> Owned<T, Dyn, C>
where where
DefaultAllocator: Allocator<T, Dynamic, C>, DefaultAllocator: Allocator<T, Dyn, C>,
{ {
self.clone() self.clone()
} }
} }
unsafe impl<T, R: DimName> RawStorage<T, R, Dynamic> for VecStorage<T, R, Dynamic> { unsafe impl<T, R: DimName> RawStorage<T, R, Dyn> for VecStorage<T, R, Dyn> {
type RStride = U1; type RStride = U1;
type CStride = R; type CStride = R;
@ -253,7 +253,7 @@ unsafe impl<T, R: DimName> RawStorage<T, R, Dynamic> for VecStorage<T, R, Dynami
} }
#[inline] #[inline]
fn shape(&self) -> (R, Dynamic) { fn shape(&self) -> (R, Dyn) {
(self.nrows, self.ncols) (self.nrows, self.ncols)
} }
@ -273,22 +273,22 @@ unsafe impl<T, R: DimName> RawStorage<T, R, Dynamic> for VecStorage<T, R, Dynami
} }
} }
unsafe impl<T: Scalar, R: DimName> Storage<T, R, Dynamic> for VecStorage<T, R, Dynamic> unsafe impl<T: Scalar, R: DimName> Storage<T, R, Dyn> for VecStorage<T, R, Dyn>
where where
DefaultAllocator: Allocator<T, R, Dynamic, Buffer = Self>, DefaultAllocator: Allocator<T, R, Dyn, Buffer = Self>,
{ {
#[inline] #[inline]
fn into_owned(self) -> Owned<T, R, Dynamic> fn into_owned(self) -> Owned<T, R, Dyn>
where where
DefaultAllocator: Allocator<T, R, Dynamic>, DefaultAllocator: Allocator<T, R, Dyn>,
{ {
self self
} }
#[inline] #[inline]
fn clone_owned(&self) -> Owned<T, R, Dynamic> fn clone_owned(&self) -> Owned<T, R, Dyn>
where where
DefaultAllocator: Allocator<T, R, Dynamic>, DefaultAllocator: Allocator<T, R, Dyn>,
{ {
self.clone() self.clone()
} }
@ -299,7 +299,7 @@ where
* RawStorageMut, ContiguousStorage. * RawStorageMut, ContiguousStorage.
* *
*/ */
unsafe impl<T, C: Dim> RawStorageMut<T, Dynamic, C> for VecStorage<T, Dynamic, C> { unsafe impl<T, C: Dim> RawStorageMut<T, Dyn, C> for VecStorage<T, Dyn, C> {
#[inline] #[inline]
fn ptr_mut(&mut self) -> *mut T { fn ptr_mut(&mut self) -> *mut T {
self.data.as_mut_ptr() self.data.as_mut_ptr()
@ -313,15 +313,15 @@ unsafe impl<T, C: Dim> RawStorageMut<T, Dynamic, C> for VecStorage<T, Dynamic, C
unsafe impl<T, R: Dim, C: Dim> IsContiguous for VecStorage<T, R, C> {} unsafe impl<T, R: Dim, C: Dim> IsContiguous for VecStorage<T, R, C> {}
impl<T, C1, C2> ReshapableStorage<T, Dynamic, C1, Dynamic, C2> for VecStorage<T, Dynamic, C1> impl<T, C1, C2> ReshapableStorage<T, Dyn, C1, Dyn, C2> for VecStorage<T, Dyn, C1>
where where
T: Scalar, T: Scalar,
C1: Dim, C1: Dim,
C2: Dim, C2: Dim,
{ {
type Output = VecStorage<T, Dynamic, C2>; type Output = VecStorage<T, Dyn, C2>;
fn reshape_generic(self, nrows: Dynamic, ncols: C2) -> Self::Output { fn reshape_generic(self, nrows: Dyn, ncols: C2) -> Self::Output {
assert_eq!(nrows.value() * ncols.value(), self.data.len()); assert_eq!(nrows.value() * ncols.value(), self.data.len());
VecStorage { VecStorage {
data: self.data, data: self.data,
@ -331,15 +331,15 @@ where
} }
} }
impl<T, C1, R2> ReshapableStorage<T, Dynamic, C1, R2, Dynamic> for VecStorage<T, Dynamic, C1> impl<T, C1, R2> ReshapableStorage<T, Dyn, C1, R2, Dyn> for VecStorage<T, Dyn, C1>
where where
T: Scalar, T: Scalar,
C1: Dim, C1: Dim,
R2: DimName, R2: DimName,
{ {
type Output = VecStorage<T, R2, Dynamic>; type Output = VecStorage<T, R2, Dyn>;
fn reshape_generic(self, nrows: R2, ncols: Dynamic) -> Self::Output { fn reshape_generic(self, nrows: R2, ncols: Dyn) -> Self::Output {
assert_eq!(nrows.value() * ncols.value(), self.data.len()); assert_eq!(nrows.value() * ncols.value(), self.data.len());
VecStorage { VecStorage {
data: self.data, data: self.data,
@ -349,7 +349,7 @@ where
} }
} }
unsafe impl<T, R: DimName> RawStorageMut<T, R, Dynamic> for VecStorage<T, R, Dynamic> { unsafe impl<T, R: DimName> RawStorageMut<T, R, Dyn> for VecStorage<T, R, Dyn> {
#[inline] #[inline]
fn ptr_mut(&mut self) -> *mut T { fn ptr_mut(&mut self) -> *mut T {
self.data.as_mut_ptr() self.data.as_mut_ptr()
@ -361,15 +361,15 @@ unsafe impl<T, R: DimName> RawStorageMut<T, R, Dynamic> for VecStorage<T, R, Dyn
} }
} }
impl<T, R1, C2> ReshapableStorage<T, R1, Dynamic, Dynamic, C2> for VecStorage<T, R1, Dynamic> impl<T, R1, C2> ReshapableStorage<T, R1, Dyn, Dyn, C2> for VecStorage<T, R1, Dyn>
where where
T: Scalar, T: Scalar,
R1: DimName, R1: DimName,
C2: Dim, C2: Dim,
{ {
type Output = VecStorage<T, Dynamic, C2>; type Output = VecStorage<T, Dyn, C2>;
fn reshape_generic(self, nrows: Dynamic, ncols: C2) -> Self::Output { fn reshape_generic(self, nrows: Dyn, ncols: C2) -> Self::Output {
assert_eq!(nrows.value() * ncols.value(), self.data.len()); assert_eq!(nrows.value() * ncols.value(), self.data.len());
VecStorage { VecStorage {
data: self.data, data: self.data,
@ -379,15 +379,15 @@ where
} }
} }
impl<T, R1, R2> ReshapableStorage<T, R1, Dynamic, R2, Dynamic> for VecStorage<T, R1, Dynamic> impl<T, R1, R2> ReshapableStorage<T, R1, Dyn, R2, Dyn> for VecStorage<T, R1, Dyn>
where where
T: Scalar, T: Scalar,
R1: DimName, R1: DimName,
R2: DimName, R2: DimName,
{ {
type Output = VecStorage<T, R2, Dynamic>; type Output = VecStorage<T, R2, Dyn>;
fn reshape_generic(self, nrows: R2, ncols: Dynamic) -> Self::Output { fn reshape_generic(self, nrows: R2, ncols: Dyn) -> Self::Output {
assert_eq!(nrows.value() * ncols.value(), self.data.len()); assert_eq!(nrows.value() * ncols.value(), self.data.len());
VecStorage { VecStorage {
data: self.data, data: self.data,
@ -397,7 +397,7 @@ where
} }
} }
impl<T, R: Dim> Extend<T> for VecStorage<T, R, Dynamic> { impl<T, R: Dim> Extend<T> for VecStorage<T, R, Dyn> {
/// Extends the number of columns of the `VecStorage` with elements /// Extends the number of columns of the `VecStorage` with elements
/// from the given iterator. /// from the given iterator.
/// ///
@ -407,13 +407,13 @@ impl<T, R: Dim> Extend<T> for VecStorage<T, R, Dynamic> {
/// `VecStorage`. /// `VecStorage`.
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) { fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) {
self.data.extend(iter); self.data.extend(iter);
self.ncols = Dynamic::new(self.data.len() / self.nrows.value()); self.ncols = Dyn(self.data.len() / self.nrows.value());
assert!(self.data.len() % self.nrows.value() == 0, assert!(self.data.len() % self.nrows.value() == 0,
"The number of elements produced by the given iterator was not a multiple of the number of rows."); "The number of elements produced by the given iterator was not a multiple of the number of rows.");
} }
} }
impl<'a, T: 'a + Copy, R: Dim> Extend<&'a T> for VecStorage<T, R, Dynamic> { impl<'a, T: 'a + Copy, R: Dim> Extend<&'a T> for VecStorage<T, R, Dyn> {
/// Extends the number of columns of the `VecStorage` with elements /// Extends the number of columns of the `VecStorage` with elements
/// from the given iterator. /// from the given iterator.
/// ///
@ -426,7 +426,7 @@ impl<'a, T: 'a + Copy, R: Dim> Extend<&'a T> for VecStorage<T, R, Dynamic> {
} }
} }
impl<T, R, RV, SV> Extend<Vector<T, RV, SV>> for VecStorage<T, R, Dynamic> impl<T, R, RV, SV> Extend<Vector<T, RV, SV>> for VecStorage<T, R, Dyn>
where where
T: Scalar, T: Scalar,
R: Dim, R: Dim,
@ -450,15 +450,15 @@ where
assert_eq!(nrows, vector.shape().0); assert_eq!(nrows, vector.shape().0);
self.data.extend(vector.iter().cloned()); self.data.extend(vector.iter().cloned());
} }
self.ncols = Dynamic::new(self.data.len() / nrows); self.ncols = Dyn(self.data.len() / nrows);
} }
} }
impl<T> Extend<T> for VecStorage<T, Dynamic, U1> { impl<T> Extend<T> for VecStorage<T, Dyn, U1> {
/// Extends the number of rows of the `VecStorage` with elements /// Extends the number of rows of the `VecStorage` with elements
/// from the given iterator. /// from the given iterator.
fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) { fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I) {
self.data.extend(iter); self.data.extend(iter);
self.nrows = Dynamic::new(self.data.len()); self.nrows = Dyn(self.data.len());
} }
} }

View File

@ -4,7 +4,7 @@ use crate::base::storage::Owned;
use quickcheck::{Arbitrary, Gen}; use quickcheck::{Arbitrary, Gen};
use crate::base::allocator::Allocator; use crate::base::allocator::Allocator;
use crate::base::dimension::{Dim, Dynamic}; use crate::base::dimension::{Dim, Dyn};
use crate::base::Scalar; use crate::base::Scalar;
use crate::base::{DefaultAllocator, OMatrix}; use crate::base::{DefaultAllocator, OMatrix};
use crate::linalg::givens::GivensRotation; use crate::linalg::givens::GivensRotation;
@ -12,7 +12,7 @@ use simba::scalar::ComplexField;
/// A random orthogonal matrix. /// A random orthogonal matrix.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct RandomOrthogonal<T: Scalar, D: Dim = Dynamic> pub struct RandomOrthogonal<T: Scalar, D: Dim = Dyn>
where where
DefaultAllocator: Allocator<T, D, D>, DefaultAllocator: Allocator<T, D, D>,
{ {

View File

@ -4,7 +4,7 @@ use crate::base::storage::Owned;
use quickcheck::{Arbitrary, Gen}; use quickcheck::{Arbitrary, Gen};
use crate::base::allocator::Allocator; use crate::base::allocator::Allocator;
use crate::base::dimension::{Dim, Dynamic}; use crate::base::dimension::{Dim, Dyn};
use crate::base::Scalar; use crate::base::Scalar;
use crate::base::{DefaultAllocator, OMatrix}; use crate::base::{DefaultAllocator, OMatrix};
use simba::scalar::ComplexField; use simba::scalar::ComplexField;
@ -13,7 +13,7 @@ use crate::debug::RandomOrthogonal;
/// A random, well-conditioned, symmetric definite-positive matrix. /// A random, well-conditioned, symmetric definite-positive matrix.
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct RandomSDP<T: Scalar, D: Dim = Dynamic> pub struct RandomSDP<T: Scalar, D: Dim = Dyn>
where where
DefaultAllocator: Allocator<T, D, D>, DefaultAllocator: Allocator<T, D, D>,
{ {

View File

@ -304,7 +304,7 @@ where
} }
} }
// impl<T: ComplexField, D: DimMin<D, Output = D> + DimSub<Dynamic>> Bidiagonal<T, D, D> // impl<T: ComplexField, D: DimMin<D, Output = D> + DimSub<Dyn>> Bidiagonal<T, D, D>
// where DefaultAllocator: Allocator<T, D, D> + // where DefaultAllocator: Allocator<T, D, D> +
// Allocator<T, D> { // Allocator<T, D> {
// /// Solves the linear system `self * x = b`, where `x` is the unknown to be determined. // /// Solves the linear system `self * x = b`, where `x` is the unknown to be determined.

View File

@ -8,7 +8,7 @@ use std::fmt::Display;
use std::ops::MulAssign; use std::ops::MulAssign;
use crate::allocator::Allocator; use crate::allocator::Allocator;
use crate::base::dimension::{Dim, DimDiff, DimSub, Dynamic, U1, U2, U3}; use crate::base::dimension::{Dim, DimDiff, DimSub, Dyn, U1, U2, U3};
use crate::base::storage::Storage; use crate::base::storage::Storage;
use crate::base::{ use crate::base::{
DefaultAllocator, Hessenberg, OMatrix, OVector, SquareMatrix, Unit, Vector2, Vector3, DefaultAllocator, Hessenberg, OMatrix, OVector, SquareMatrix, Unit, Vector2, Vector3,
@ -52,8 +52,8 @@ where
impl<T: ComplexField, D: Dim> Eigen<T, D> impl<T: ComplexField, D: Dim> Eigen<T, D>
where where
D: DimSub<U1>, // For Hessenberg. D: DimSub<U1>, // For Hessenberg.
ShapeConstraint: DimEq<Dynamic, DimDiff<D, U1>>, // For Hessenberg. ShapeConstraint: DimEq<Dyn, DimDiff<D, U1>>, // For Hessenberg.
DefaultAllocator: Allocator<T, D, DimDiff<D, U1>> DefaultAllocator: Allocator<T, D, DimDiff<D, U1>>
+ Allocator<T, DimDiff<D, U1>> + Allocator<T, DimDiff<D, U1>>
+ Allocator<T, D, D> + Allocator<T, D, D>

View File

@ -7,7 +7,7 @@ use simba::scalar::ClosedNeg;
use crate::allocator::Allocator; use crate::allocator::Allocator;
use crate::base::{DefaultAllocator, Matrix, OVector, Scalar}; use crate::base::{DefaultAllocator, Matrix, OVector, Scalar};
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
use crate::dimension::Dynamic; use crate::dimension::Dyn;
use crate::dimension::{Const, Dim, DimName}; use crate::dimension::{Const, Dim, DimName};
use crate::storage::StorageMut; use crate::storage::StorageMut;
@ -51,14 +51,14 @@ where
} }
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
impl PermutationSequence<Dynamic> impl PermutationSequence<Dyn>
where where
DefaultAllocator: Allocator<(usize, usize), Dynamic>, DefaultAllocator: Allocator<(usize, usize), Dyn>,
{ {
/// Creates a new dynamically-allocated sequence of `n` identity permutations. /// Creates a new dynamically-allocated sequence of `n` identity permutations.
#[inline] #[inline]
pub fn identity(n: usize) -> Self { pub fn identity(n: usize) -> Self {
Self::identity_generic(Dynamic::new(n)) Self::identity_generic(Dyn(n))
} }
} }

View File

@ -8,7 +8,7 @@ use simba::scalar::{ComplexField, RealField};
use std::cmp; use std::cmp;
use crate::allocator::Allocator; use crate::allocator::Allocator;
use crate::base::dimension::{Const, Dim, DimDiff, DimSub, Dynamic, U1, U2}; use crate::base::dimension::{Const, Dim, DimDiff, DimSub, Dyn, U1, U2};
use crate::base::storage::Storage; use crate::base::storage::Storage;
use crate::base::{DefaultAllocator, OMatrix, OVector, SquareMatrix, Unit, Vector2, Vector3}; use crate::base::{DefaultAllocator, OMatrix, OVector, SquareMatrix, Unit, Vector2, Vector3};
@ -174,12 +174,11 @@ where
{ {
let krows = cmp::min(k + 4, end + 1); let krows = cmp::min(k + 4, end + 1);
let mut work = work.rows_mut(0, krows); let mut work = work.rows_mut(0, krows);
refl.reflect(&mut t.generic_view_mut( refl.reflect(
(k, k), &mut t.generic_view_mut((k, k), (Const::<3>, Dyn(dim.value() - k))),
(Const::<3>, Dynamic::new(dim.value() - k)), );
));
refl.reflect_rows( refl.reflect_rows(
&mut t.generic_view_mut((0, k), (Dynamic::new(krows), Const::<3>)), &mut t.generic_view_mut((0, k), (Dyn(krows), Const::<3>)),
&mut work, &mut work,
); );
} }
@ -212,13 +211,10 @@ where
{ {
let mut work = work.rows_mut(0, end + 1); let mut work = work.rows_mut(0, end + 1);
refl.reflect( refl.reflect(
&mut t.generic_view_mut( &mut t.generic_view_mut((m, m), (Const::<2>, Dyn(dim.value() - m))),
(m, m),
(Const::<2>, Dynamic::new(dim.value() - m)),
),
); );
refl.reflect_rows( refl.reflect_rows(
&mut t.generic_view_mut((0, m), (Dynamic::new(end + 1), Const::<2>)), &mut t.generic_view_mut((0, m), (Dyn(end + 1), Const::<2>)),
&mut work, &mut work,
); );
} }
@ -231,12 +227,14 @@ where
// Decouple the 2x2 block if it has real eigenvalues. // Decouple the 2x2 block if it has real eigenvalues.
if let Some(rot) = compute_2x2_basis(&t.fixed_view::<2, 2>(start, start)) { if let Some(rot) = compute_2x2_basis(&t.fixed_view::<2, 2>(start, start)) {
let inv_rot = rot.inverse(); let inv_rot = rot.inverse();
inv_rot.rotate(&mut t.generic_view_mut( inv_rot.rotate(
(start, start), &mut t.generic_view_mut(
(Const::<2>, Dynamic::new(dim.value() - start)), (start, start),
)); (Const::<2>, Dyn(dim.value() - start)),
),
);
rot.rotate_rows( rot.rotate_rows(
&mut t.generic_view_mut((0, start), (Dynamic::new(end + 1), Const::<2>)), &mut t.generic_view_mut((0, start), (Dyn(end + 1), Const::<2>)),
); );
t[(end, start)] = T::zero(); t[(end, start)] = T::zero();

View File

@ -53,11 +53,11 @@
//! with [matrix](fn.matrix.html) as follows: //! with [matrix](fn.matrix.html) as follows:
//! //!
//! ``` //! ```
//! use nalgebra::{Dynamic, OMatrix, Const}; //! use nalgebra::{Dyn, OMatrix, Const};
//! use nalgebra::proptest::matrix; //! use nalgebra::proptest::matrix;
//! use proptest::prelude::*; //! use proptest::prelude::*;
//! //!
//! type MyMatrix = OMatrix<i32, Const::<3>, Dynamic>; //! type MyMatrix = OMatrix<i32, Const::<3>, Dyn>;
//! //!
//! /// Returns a strategy for pairs of matrices with `U3` rows and the same number of //! /// Returns a strategy for pairs of matrices with `U3` rows and the same number of
//! /// columns. //! /// columns.
@ -93,7 +93,7 @@
//! If you don't care about the dimensions of matrices, you can write tests like these: //! If you don't care about the dimensions of matrices, you can write tests like these:
//! //!
//! ``` //! ```
//! use nalgebra::{DMatrix, DVector, Dynamic, Matrix3, OMatrix, Vector3, U3}; //! use nalgebra::{DMatrix, DVector, Dyn, Matrix3, OMatrix, Vector3, U3};
//! use proptest::prelude::*; //! use proptest::prelude::*;
//! //!
//! proptest! { //! proptest! {
@ -108,7 +108,7 @@
//! # /* //! # /*
//! #[test] //! #[test]
//! # */ //! # */
//! fn test_static_and_mixed(matrix: Matrix3<i32>, matrix2: OMatrix<i32, U3, Dynamic>) { //! fn test_static_and_mixed(matrix: Matrix3<i32>, matrix2: OMatrix<i32, U3, Dyn>) {
//! // Test some property involving these matrices //! // Test some property involving these matrices
//! } //! }
//! //!
@ -141,7 +141,7 @@
//! PROPTEST_MAX_SHRINK_ITERS=100000 cargo test my_failing_test //! PROPTEST_MAX_SHRINK_ITERS=100000 cargo test my_failing_test
//! ``` //! ```
use crate::allocator::Allocator; use crate::allocator::Allocator;
use crate::{Const, DefaultAllocator, Dim, DimName, Dynamic, OMatrix, Scalar, U1}; use crate::{Const, DefaultAllocator, Dim, DimName, Dyn, OMatrix, Scalar, U1};
use proptest::arbitrary::Arbitrary; use proptest::arbitrary::Arbitrary;
use proptest::collection::vec; use proptest::collection::vec;
use proptest::strategy::{BoxedStrategy, Just, NewTree, Strategy, ValueTree}; use proptest::strategy::{BoxedStrategy, Just, NewTree, Strategy, ValueTree};
@ -167,9 +167,9 @@ pub struct MatrixParameters<NParameters, R, C> {
/// of matrices with `proptest`. In most cases, you do not need to concern yourself with /// of matrices with `proptest`. In most cases, you do not need to concern yourself with
/// `DimRange` directly, as it supports conversion from other types such as `U3` or inclusive /// `DimRange` directly, as it supports conversion from other types such as `U3` or inclusive
/// ranges such as `5 ..= 6`. The latter example corresponds to dimensions from (inclusive) /// ranges such as `5 ..= 6`. The latter example corresponds to dimensions from (inclusive)
/// `Dynamic::new(5)` to `Dynamic::new(6)` (inclusive). /// `Dyn(5)` to `Dyn(6)` (inclusive).
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq)]
pub struct DimRange<D = Dynamic>(RangeInclusive<D>); pub struct DimRange<D = Dyn>(RangeInclusive<D>);
impl<D: Dim> DimRange<D> { impl<D: Dim> DimRange<D> {
/// The lower bound for dimensions generated. /// The lower bound for dimensions generated.
@ -195,9 +195,9 @@ impl<D: Dim> From<RangeInclusive<D>> for DimRange<D> {
} }
} }
impl From<RangeInclusive<usize>> for DimRange<Dynamic> { impl From<RangeInclusive<usize>> for DimRange<Dyn> {
fn from(range: RangeInclusive<usize>) -> Self { fn from(range: RangeInclusive<usize>) -> Self {
DimRange::from(Dynamic::new(*range.start())..=Dynamic::new(*range.end())) DimRange::from(Dyn(*range.start())..=Dyn(*range.end()))
} }
} }
@ -208,14 +208,14 @@ impl<D: Dim> DimRange<D> {
} }
} }
impl From<usize> for DimRange<Dynamic> { impl From<usize> for DimRange<Dyn> {
fn from(dim: usize) -> Self { fn from(dim: usize) -> Self {
DimRange::from(Dynamic::new(dim)) DimRange::from(Dyn(dim))
} }
} }
/// The default range used for Dynamic dimensions when generating arbitrary matrices. /// The default range used for Dyn dimensions when generating arbitrary matrices.
fn dynamic_dim_range() -> DimRange<Dynamic> { fn dynamic_dim_range() -> DimRange<Dyn> {
DimRange::from(0..=6) DimRange::from(0..=6)
} }
@ -225,7 +225,7 @@ fn dynamic_dim_range() -> DimRange<Dynamic> {
/// ## Examples /// ## Examples
/// ``` /// ```
/// use nalgebra::proptest::matrix; /// use nalgebra::proptest::matrix;
/// use nalgebra::{OMatrix, Const, Dynamic}; /// use nalgebra::{OMatrix, Const, Dyn};
/// use proptest::prelude::*; /// use proptest::prelude::*;
/// ///
/// proptest! { /// proptest! {
@ -234,7 +234,7 @@ fn dynamic_dim_range() -> DimRange<Dynamic> {
/// # */ /// # */
/// fn my_test(a in matrix(0 .. 5i32, Const::<3>, 0 ..= 5)) { /// fn my_test(a in matrix(0 .. 5i32, Const::<3>, 0 ..= 5)) {
/// // Let's make sure we've got the correct type first /// // Let's make sure we've got the correct type first
/// let a: OMatrix<_, Const::<3>, Dynamic> = a; /// let a: OMatrix<_, Const::<3>, Dyn> = a;
/// prop_assert!(a.nrows() == 3); /// prop_assert!(a.nrows() == 3);
/// prop_assert!(a.ncols() <= 5); /// prop_assert!(a.ncols() <= 5);
/// prop_assert!(a.iter().all(|x_ij| *x_ij >= 0 && *x_ij < 5)); /// prop_assert!(a.iter().all(|x_ij| *x_ij >= 0 && *x_ij < 5));
@ -347,7 +347,7 @@ where
} }
} }
impl<NParameters, R> Default for MatrixParameters<NParameters, R, Dynamic> impl<NParameters, R> Default for MatrixParameters<NParameters, R, Dyn>
where where
NParameters: Default, NParameters: Default,
R: DimName, R: DimName,
@ -361,7 +361,7 @@ where
} }
} }
impl<NParameters, C> Default for MatrixParameters<NParameters, Dynamic, C> impl<NParameters, C> Default for MatrixParameters<NParameters, Dyn, C>
where where
NParameters: Default, NParameters: Default,
C: DimName, C: DimName,
@ -375,7 +375,7 @@ where
} }
} }
impl<NParameters> Default for MatrixParameters<NParameters, Dynamic, Dynamic> impl<NParameters> Default for MatrixParameters<NParameters, Dyn, Dyn>
where where
NParameters: Default, NParameters: Default,
{ {

View File

@ -7,7 +7,7 @@ use std::slice;
use crate::allocator::Allocator; use crate::allocator::Allocator;
use crate::sparse::cs_utils; use crate::sparse::cs_utils;
use crate::{Const, DefaultAllocator, Dim, Dynamic, Matrix, OVector, Scalar, Vector, U1}; use crate::{Const, DefaultAllocator, Dim, Dyn, Matrix, OVector, Scalar, Vector, U1};
pub struct ColumnEntries<'a, T> { pub struct ColumnEntries<'a, T> {
curr: usize, curr: usize,
@ -236,16 +236,16 @@ impl<T: Scalar, R: Dim, C: Dim> CsStorageMut<T, R, C> for CsVecStorage<T, R, C>
pub struct CsSliceStorage<'a, T: Scalar, R: Dim, C: DimAdd<U1>> { pub struct CsSliceStorage<'a, T: Scalar, R: Dim, C: DimAdd<U1>> {
shape: (R, C), shape: (R, C),
p: VectorSlice<usize, DimSum<C, U1>>, p: VectorSlice<usize, DimSum<C, U1>>,
i: VectorSlice<usize, Dynamic>, i: VectorSlice<usize, Dyn>,
vals: VectorSlice<T, Dynamic>, vals: VectorSlice<T, Dyn>,
}*/ }*/
/// A compressed sparse column matrix. /// A compressed sparse column matrix.
#[derive(Clone, Debug, PartialEq)] #[derive(Clone, Debug, PartialEq)]
pub struct CsMatrix< pub struct CsMatrix<
T: Scalar, T: Scalar,
R: Dim = Dynamic, R: Dim = Dyn,
C: Dim = Dynamic, C: Dim = Dyn,
S: CsStorage<T, R, C> = CsVecStorage<T, R, C>, S: CsStorage<T, R, C> = CsVecStorage<T, R, C>,
> { > {
pub(crate) data: S, pub(crate) data: S,
@ -253,7 +253,7 @@ pub struct CsMatrix<
} }
/// A column compressed sparse vector. /// A column compressed sparse vector.
pub type CsVector<T, R = Dynamic, S = CsVecStorage<T, R, U1>> = CsMatrix<T, R, U1, S>; pub type CsVector<T, R = Dyn, S = CsVecStorage<T, R, U1>> = CsMatrix<T, R, U1, S>;
impl<T: Scalar, R: Dim, C: Dim> CsMatrix<T, R, C> impl<T: Scalar, R: Dim, C: Dim> CsMatrix<T, R, C>
where where
@ -342,8 +342,8 @@ impl<T: Scalar + Zero + ClosedAdd> CsMatrix<T> {
vals: Vec<T>, vals: Vec<T>,
) -> Self ) -> Self
{ {
let nrows = Dynamic::new(nrows); let nrows = Dyn(nrows);
let ncols = Dynamic::new(ncols); let ncols = Dyn(ncols);
let p = DVector::from_data(VecStorage::new(ncols, U1, p)); let p = DVector::from_data(VecStorage::new(ncols, U1, p));
Self::from_parts_generic(nrows, ncols, p, i, vals) Self::from_parts_generic(nrows, ncols, p, i, vals)
} }

View File

@ -5,7 +5,7 @@ use crate::allocator::Allocator;
use crate::sparse::cs_utils; use crate::sparse::cs_utils;
use crate::sparse::{CsMatrix, CsStorage}; use crate::sparse::{CsMatrix, CsStorage};
use crate::storage::Storage; use crate::storage::Storage;
use crate::{DefaultAllocator, Dim, Dynamic, Matrix, OMatrix, Scalar}; use crate::{DefaultAllocator, Dim, Dyn, Matrix, OMatrix, Scalar};
impl<'a, T: Scalar + Zero + ClosedAdd> CsMatrix<T> { impl<'a, T: Scalar + Zero + ClosedAdd> CsMatrix<T> {
/// Creates a column-compressed sparse matrix from a sparse matrix in triplet form. /// Creates a column-compressed sparse matrix from a sparse matrix in triplet form.
@ -16,7 +16,7 @@ impl<'a, T: Scalar + Zero + ClosedAdd> CsMatrix<T> {
icols: &[usize], icols: &[usize],
vals: &[T], vals: &[T],
) -> Self { ) -> Self {
Self::from_triplet_generic(Dynamic::new(nrows), Dynamic::new(ncols), irows, icols, vals) Self::from_triplet_generic(Dyn(nrows), Dyn(ncols), irows, icols, vals)
} }
} }

View File

@ -2,7 +2,7 @@ use na::{
DMatrix, Matrix, Matrix3, Matrix3x4, Matrix3x5, Matrix4, Matrix4x3, Matrix4x5, Matrix5, DMatrix, Matrix, Matrix3, Matrix3x4, Matrix3x5, Matrix4, Matrix4x3, Matrix4x5, Matrix5,
Matrix5x3, Matrix5x4, Matrix5x3, Matrix5x4,
}; };
use na::{Dynamic, U3, U5}; use na::{Dyn, U3, U5};
#[test] #[test]
#[rustfmt::skip] #[rustfmt::skip]
@ -257,7 +257,7 @@ fn remove_columns() {
assert_eq!(m.remove_fixed_columns::<2>(2), expected_b3); assert_eq!(m.remove_fixed_columns::<2>(2), expected_b3);
// The following is just to verify that the return type dimensions is correctly inferred. // The following is just to verify that the return type dimensions is correctly inferred.
let computed: Matrix<_, U3, Dynamic, _> = m.remove_columns(3, 2); let computed: Matrix<_, U3, Dyn, _> = m.remove_columns(3, 2);
assert!(computed.eq(&expected_b2)); assert!(computed.eq(&expected_b2));
/* /*
@ -391,7 +391,7 @@ fn remove_rows() {
assert_eq!(m.remove_fixed_rows::<2>(2), expected3); assert_eq!(m.remove_fixed_rows::<2>(2), expected3);
// The following is just to verify that the return type dimensions is correctly inferred. // The following is just to verify that the return type dimensions is correctly inferred.
let computed: Matrix<_, Dynamic, U3, _> = m.remove_rows(3, 2); let computed: Matrix<_, Dyn, U3, _> = m.remove_rows(3, 2);
assert!(computed.eq(&expected2)); assert!(computed.eq(&expected2));
} }
@ -508,7 +508,7 @@ fn insert_columns() {
assert_eq!(m.insert_fixed_columns::<2>(2, 0), expected3); assert_eq!(m.insert_fixed_columns::<2>(2, 0), expected3);
// The following is just to verify that the return type dimensions is correctly inferred. // The following is just to verify that the return type dimensions is correctly inferred.
let computed: Matrix<_, U5, Dynamic, _> = m.insert_columns(3, 2, 0); let computed: Matrix<_, U5, Dyn, _> = m.insert_columns(3, 2, 0);
assert!(computed.eq(&expected2)); assert!(computed.eq(&expected2));
} }
@ -581,7 +581,7 @@ fn insert_rows() {
assert_eq!(m.insert_fixed_rows::<2>(2, 0), expected3); assert_eq!(m.insert_fixed_rows::<2>(2, 0), expected3);
// The following is just to verify that the return type dimensions is correctly inferred. // The following is just to verify that the return type dimensions is correctly inferred.
let computed: Matrix<_, Dynamic, U5, _> = m.insert_rows(3, 2, 0); let computed: Matrix<_, Dyn, U5, _> = m.insert_rows(3, 2, 0);
assert!(computed.eq(&expected2)); assert!(computed.eq(&expected2));
} }

View File

@ -1,5 +1,5 @@
use na::{ use na::{
Const, DMatrix, DMatrixView, DMatrixViewMut, Dyn, Dynamic, Matrix, MatrixView, MatrixViewMut, Const, DMatrix, DMatrixView, DMatrixViewMut, Dyn, Dyn, Matrix, MatrixView, MatrixViewMut,
SMatrix, SMatrixView, SMatrixViewMut, VecStorage, U3, U4, SMatrix, SMatrixView, SMatrixViewMut, VecStorage, U3, U4,
}; };
use nalgebra_macros::matrix; use nalgebra_macros::matrix;
@ -60,21 +60,21 @@ fn reshape_slice() {
// Static "source slice" // Static "source slice"
test_reshape!(SMatrixView<_, 4, 3> => SMatrixView<_, 3, 4>, U3, U4); test_reshape!(SMatrixView<_, 4, 3> => SMatrixView<_, 3, 4>, U3, U4);
test_reshape!(SMatrixView<_, 4, 3> => DMatrixView<_>, Dynamic::new(3), Dynamic::new(4)); test_reshape!(SMatrixView<_, 4, 3> => DMatrixView<_>, Dyn(3), Dyn(4));
test_reshape!(SMatrixView<_, 4, 3> => MatrixView<_, Const<3>, Dynamic>, U3, Dynamic::new(4)); test_reshape!(SMatrixView<_, 4, 3> => MatrixView<_, Const<3>, Dyn>, U3, Dyn(4));
test_reshape!(SMatrixView<_, 4, 3> => MatrixView<_, Dynamic, Const<4>>, Dynamic::new(3), U4); test_reshape!(SMatrixView<_, 4, 3> => MatrixView<_, Dyn, Const<4>>, Dyn(3), U4);
test_reshape!(SMatrixViewMut<_, 4, 3> => SMatrixViewMut<_, 3, 4>, U3, U4); test_reshape!(SMatrixViewMut<_, 4, 3> => SMatrixViewMut<_, 3, 4>, U3, U4);
test_reshape!(SMatrixViewMut<_, 4, 3> => DMatrixViewMut<_>, Dynamic::new(3), Dynamic::new(4)); test_reshape!(SMatrixViewMut<_, 4, 3> => DMatrixViewMut<_>, Dyn(3), Dyn(4));
test_reshape!(SMatrixViewMut<_, 4, 3> => MatrixViewMut<_, Const<3>, Dynamic>, U3, Dynamic::new(4)); test_reshape!(SMatrixViewMut<_, 4, 3> => MatrixViewMut<_, Const<3>, Dyn>, U3, Dyn(4));
test_reshape!(SMatrixViewMut<_, 4, 3> => MatrixViewMut<_, Dynamic, Const<4>>, Dynamic::new(3), U4); test_reshape!(SMatrixViewMut<_, 4, 3> => MatrixViewMut<_, Dyn, Const<4>>, Dyn(3), U4);
// Dynamic "source slice" // Dyn "source slice"
test_reshape!(DMatrixView<_> => SMatrixView<_, 3, 4>, U3, U4); test_reshape!(DMatrixView<_> => SMatrixView<_, 3, 4>, U3, U4);
test_reshape!(DMatrixView<_> => DMatrixView<_>, Dynamic::new(3), Dynamic::new(4)); test_reshape!(DMatrixView<_> => DMatrixView<_>, Dyn(3), Dyn(4));
test_reshape!(DMatrixView<_> => MatrixView<_, Const<3>, Dynamic>, U3, Dynamic::new(4)); test_reshape!(DMatrixView<_> => MatrixView<_, Const<3>, Dyn>, U3, Dyn(4));
test_reshape!(DMatrixView<_> => MatrixView<_, Dynamic, Const<4>>, Dynamic::new(3), U4); test_reshape!(DMatrixView<_> => MatrixView<_, Dyn, Const<4>>, Dyn(3), U4);
test_reshape!(DMatrixViewMut<_> => SMatrixViewMut<_, 3, 4>, U3, U4); test_reshape!(DMatrixViewMut<_> => SMatrixViewMut<_, 3, 4>, U3, U4);
test_reshape!(DMatrixViewMut<_> => DMatrixViewMut<_>, Dynamic::new(3), Dynamic::new(4)); test_reshape!(DMatrixViewMut<_> => DMatrixViewMut<_>, Dyn(3), Dyn(4));
test_reshape!(DMatrixViewMut<_> => MatrixViewMut<_, Const<3>, Dynamic>, U3, Dynamic::new(4)); test_reshape!(DMatrixViewMut<_> => MatrixViewMut<_, Const<3>, Dyn>, U3, Dyn(4));
test_reshape!(DMatrixViewMut<_> => MatrixViewMut<_, Dynamic, Const<4>>, Dynamic::new(3), U4); test_reshape!(DMatrixViewMut<_> => MatrixViewMut<_, Dyn, Const<4>>, Dyn(3), U4);
} }

View File

@ -15,7 +15,7 @@ macro_rules! gen_tests(
($module: ident, $scalar: ty) => { ($module: ident, $scalar: ty) => {
mod $module { mod $module {
use na::debug::RandomSDP; use na::debug::RandomSDP;
use na::dimension::{Const, Dynamic}; use na::dimension::{Const, Dyn};
use na::{DMatrix, DVector, Matrix4x3, Vector4}; use na::{DMatrix, DVector, Matrix4x3, Vector4};
use rand::random; use rand::random;
use simba::scalar::ComplexField; use simba::scalar::ComplexField;
@ -28,7 +28,7 @@ macro_rules! gen_tests(
proptest! { proptest! {
#[test] #[test]
fn cholesky(n in PROPTEST_MATRIX_DIM) { fn cholesky(n in PROPTEST_MATRIX_DIM) {
let m = RandomSDP::new(Dynamic::new(n), || random::<$scalar>().0).unwrap(); let m = RandomSDP::new(Dyn(n), || random::<$scalar>().0).unwrap();
let l = m.clone().cholesky().unwrap().unpack(); let l = m.clone().cholesky().unwrap().unpack();
prop_assert!(relative_eq!(m, &l * l.adjoint(), epsilon = 1.0e-7)); prop_assert!(relative_eq!(m, &l * l.adjoint(), epsilon = 1.0e-7));
} }
@ -44,7 +44,7 @@ macro_rules! gen_tests(
#[test] #[test]
fn cholesky_solve(n in PROPTEST_MATRIX_DIM, nb in PROPTEST_MATRIX_DIM) { fn cholesky_solve(n in PROPTEST_MATRIX_DIM, nb in PROPTEST_MATRIX_DIM) {
let m = RandomSDP::new(Dynamic::new(n), || random::<$scalar>().0).unwrap(); let m = RandomSDP::new(Dyn(n), || random::<$scalar>().0).unwrap();
let chol = m.clone().cholesky().unwrap(); let chol = m.clone().cholesky().unwrap();
let b1 = DVector::<$scalar>::new_random(n).map(|e| e.0); let b1 = DVector::<$scalar>::new_random(n).map(|e| e.0);
@ -73,7 +73,7 @@ macro_rules! gen_tests(
#[test] #[test]
fn cholesky_inverse(n in PROPTEST_MATRIX_DIM) { fn cholesky_inverse(n in PROPTEST_MATRIX_DIM) {
let m = RandomSDP::new(Dynamic::new(n), || random::<$scalar>().0).unwrap(); let m = RandomSDP::new(Dyn(n), || random::<$scalar>().0).unwrap();
let m1 = m.clone().cholesky().unwrap().inverse(); let m1 = m.clone().cholesky().unwrap().inverse();
let id1 = &m * &m1; let id1 = &m * &m1;
let id2 = &m1 * &m; let id2 = &m1 * &m;
@ -93,7 +93,7 @@ macro_rules! gen_tests(
#[test] #[test]
fn cholesky_determinant(n in PROPTEST_MATRIX_DIM) { fn cholesky_determinant(n in PROPTEST_MATRIX_DIM) {
let m = RandomSDP::new(Dynamic::new(n), || random::<$scalar>().0).unwrap(); let m = RandomSDP::new(Dyn(n), || random::<$scalar>().0).unwrap();
let lu_det = m.clone().lu().determinant(); let lu_det = m.clone().lu().determinant();
assert_relative_eq!(lu_det.imaginary(), 0., epsilon = 1.0e-7); assert_relative_eq!(lu_det.imaginary(), 0., epsilon = 1.0e-7);
let chol_det = m.cholesky().unwrap().determinant(); let chol_det = m.cholesky().unwrap().determinant();
@ -137,7 +137,7 @@ macro_rules! gen_tests(
fn cholesky_insert_column(n in PROPTEST_MATRIX_DIM) { fn cholesky_insert_column(n in PROPTEST_MATRIX_DIM) {
let n = n.max(1).min(10); let n = n.max(1).min(10);
let j = random::<usize>() % n; let j = random::<usize>() % n;
let m_updated = RandomSDP::new(Dynamic::new(n), || random::<$scalar>().0).unwrap(); let m_updated = RandomSDP::new(Dyn(n), || random::<$scalar>().0).unwrap();
// build m and col from m_updated // build m and col from m_updated
let col = m_updated.column(j); let col = m_updated.column(j);
@ -154,7 +154,7 @@ macro_rules! gen_tests(
fn cholesky_remove_column(n in PROPTEST_MATRIX_DIM) { fn cholesky_remove_column(n in PROPTEST_MATRIX_DIM) {
let n = n.max(1).min(10); let n = n.max(1).min(10);
let j = random::<usize>() % n; let j = random::<usize>() % n;
let m = RandomSDP::new(Dynamic::new(n), || random::<$scalar>().0).unwrap(); let m = RandomSDP::new(Dyn(n), || random::<$scalar>().0).unwrap();
// remove column from cholesky decomposition and rebuild m // remove column from cholesky decomposition and rebuild m
let chol = m.clone().cholesky().unwrap().remove_column(j); let chol = m.clone().cholesky().unwrap().remove_column(j);

View File

@ -16,7 +16,7 @@ fn convolve_same_check() {
assert!(relative_eq!(actual_s, expected_s, epsilon = 1.0e-7)); assert!(relative_eq!(actual_s, expected_s, epsilon = 1.0e-7));
// Dynamic Tests // Dyn Tests
let actual_d = DVector::from_vec(vec![1.0, 4.0, 7.0, 10.0]); let actual_d = DVector::from_vec(vec![1.0, 4.0, 7.0, 10.0]);
let expected_d = DVector::from_vec(vec![1.0, 2.0, 3.0, 4.0]) let expected_d = DVector::from_vec(vec![1.0, 2.0, 3.0, 4.0])
.convolve_same(DVector::from_vec(vec![1.0, 2.0])); .convolve_same(DVector::from_vec(vec![1.0, 2.0]));
@ -54,7 +54,7 @@ fn convolve_full_check() {
assert!(relative_eq!(actual_s, expected_s, epsilon = 1.0e-7)); assert!(relative_eq!(actual_s, expected_s, epsilon = 1.0e-7));
// Dynamic Tests // Dyn Tests
let actual_d = DVector::from_vec(vec![1.0, 4.0, 7.0, 10.0, 8.0]); let actual_d = DVector::from_vec(vec![1.0, 4.0, 7.0, 10.0, 8.0]);
let expected_d = DVector::from_vec(vec![1.0, 2.0, 3.0, 4.0]) let expected_d = DVector::from_vec(vec![1.0, 2.0, 3.0, 4.0])
.convolve_full(DVector::from_vec(vec![1.0, 2.0])); .convolve_full(DVector::from_vec(vec![1.0, 2.0]));
@ -90,7 +90,7 @@ fn convolve_valid_check() {
assert!(relative_eq!(actual_s, expected_s, epsilon = 1.0e-7)); assert!(relative_eq!(actual_s, expected_s, epsilon = 1.0e-7));
// Dynamic Tests // Dyn Tests
let actual_d = DVector::from_vec(vec![4.0, 7.0, 10.0]); let actual_d = DVector::from_vec(vec![4.0, 7.0, 10.0]);
let expected_d = DVector::from_vec(vec![1.0, 2.0, 3.0, 4.0]) let expected_d = DVector::from_vec(vec![1.0, 2.0, 3.0, 4.0])
.convolve_valid(DVector::from_vec(vec![1.0, 2.0])); .convolve_valid(DVector::from_vec(vec![1.0, 2.0]));

View File

@ -253,7 +253,7 @@ fn remove_columns() {
assert_eq!(m.remove_fixed_columns::<U2>(2), expected3); assert_eq!(m.remove_fixed_columns::<U2>(2), expected3);
// The following is just to verify that the return type dimensions is correctly inferred. // The following is just to verify that the return type dimensions is correctly inferred.
let computed: Matrix<_, U3, Dynamic, _> = m.remove_columns(3, 2); let computed: Matrix<_, U3, Dyn, _> = m.remove_columns(3, 2);
assert!(computed.eq(&expected2)); assert!(computed.eq(&expected2));
} }
@ -309,7 +309,7 @@ fn remove_rows() {
assert_eq!(m.remove_fixed_rows::<U2>(2), expected3); assert_eq!(m.remove_fixed_rows::<U2>(2), expected3);
// The following is just to verify that the return type dimensions is correctly inferred. // The following is just to verify that the return type dimensions is correctly inferred.
let computed: Matrix<_, Dynamic, U3, _> = m.remove_rows(3, 2); let computed: Matrix<_, Dyn, U3, _> = m.remove_rows(3, 2);
assert!(computed.eq(&expected2)); assert!(computed.eq(&expected2));
} }
@ -374,7 +374,7 @@ fn insert_columns() {
assert_eq!(m.insert_fixed_columns::<U2>(2, 0), expected3); assert_eq!(m.insert_fixed_columns::<U2>(2, 0), expected3);
// The following is just to verify that the return type dimensions is correctly inferred. // The following is just to verify that the return type dimensions is correctly inferred.
let computed: Matrix<_, U5, Dynamic, _> = m.insert_columns(3, 2, 0); let computed: Matrix<_, U5, Dyn, _> = m.insert_columns(3, 2, 0);
assert!(computed.eq(&expected2)); assert!(computed.eq(&expected2));
} }
@ -434,7 +434,7 @@ fn insert_rows() {
assert_eq!(m.insert_fixed_rows::<2>(2, 0), expected3); assert_eq!(m.insert_fixed_rows::<2>(2, 0), expected3);
// The following is just to verify that the return type dimensions is correctly inferred. // The following is just to verify that the return type dimensions is correctly inferred.
let computed: Matrix<_, Dynamic, U5, _> = m.insert_rows(3, 2, 0); let computed: Matrix<_, Dyn, U5, _> = m.insert_rows(3, 2, 0);
assert!(computed.eq(&expected2)); assert!(computed.eq(&expected2));
} }

View File

@ -101,11 +101,11 @@ pub fn dvector() -> impl Strategy<Value = DVector<f64>> {
pub fn dmatrix_<ScalarStrategy>( pub fn dmatrix_<ScalarStrategy>(
scalar_strategy: ScalarStrategy, scalar_strategy: ScalarStrategy,
) -> impl Strategy<Value = OMatrix<ScalarStrategy::Value, Dynamic, Dynamic>> ) -> impl Strategy<Value = OMatrix<ScalarStrategy::Value, Dyn, Dyn>>
where where
ScalarStrategy: Strategy + Clone + 'static, ScalarStrategy: Strategy + Clone + 'static,
ScalarStrategy::Value: Scalar, ScalarStrategy::Value: Scalar,
DefaultAllocator: Allocator<ScalarStrategy::Value, Dynamic, Dynamic>, DefaultAllocator: Allocator<ScalarStrategy::Value, Dyn, Dyn>,
{ {
matrix(scalar_strategy, PROPTEST_MATRIX_DIM, PROPTEST_MATRIX_DIM) matrix(scalar_strategy, PROPTEST_MATRIX_DIM, PROPTEST_MATRIX_DIM)
} }
@ -114,7 +114,7 @@ where
// where // where
// RangeInclusive<T>: Strategy<Value = T>, // RangeInclusive<T>: Strategy<Value = T>,
// T: Scalar + PartialEq + Copy, // T: Scalar + PartialEq + Copy,
// DefaultAllocator: Allocator<T, Dynamic>, // DefaultAllocator: Allocator<T, Dyn>,
// { // {
// vector(range, PROPTEST_MATRIX_DIM) // vector(range, PROPTEST_MATRIX_DIM)
// } // }
@ -213,9 +213,9 @@ fn test_matrix_output_types() {
// Test that the dimension types are correct for the given inputs // Test that the dimension types are correct for the given inputs
let _: MatrixStrategy<_, U3, U4> = matrix(-5..5, Const::<3>, Const::<4>); let _: MatrixStrategy<_, U3, U4> = matrix(-5..5, Const::<3>, Const::<4>);
let _: MatrixStrategy<_, U3, U3> = matrix(-5..5, Const::<3>, Const::<3>); let _: MatrixStrategy<_, U3, U3> = matrix(-5..5, Const::<3>, Const::<3>);
let _: MatrixStrategy<_, U3, Dynamic> = matrix(-5..5, Const::<3>, 1..=5); let _: MatrixStrategy<_, U3, Dyn> = matrix(-5..5, Const::<3>, 1..=5);
let _: MatrixStrategy<_, Dynamic, U3> = matrix(-5..5, 1..=5, Const::<3>); let _: MatrixStrategy<_, Dyn, U3> = matrix(-5..5, 1..=5, Const::<3>);
let _: MatrixStrategy<_, Dynamic, Dynamic> = matrix(-5..5, 1..=5, 1..=5); let _: MatrixStrategy<_, Dyn, Dyn> = matrix(-5..5, 1..=5, 1..=5);
} }
// Below we have some tests to ensure that specific instances of OMatrix are usable // Below we have some tests to ensure that specific instances of OMatrix are usable
@ -225,10 +225,10 @@ proptest! {
fn ensure_arbitrary_test_compiles_matrix3(_: Matrix3<i32>) {} fn ensure_arbitrary_test_compiles_matrix3(_: Matrix3<i32>) {}
#[test] #[test]
fn ensure_arbitrary_test_compiles_matrixmn_u3_dynamic(_: OMatrix<i32, U3, Dynamic>) {} fn ensure_arbitrary_test_compiles_matrixmn_u3_dynamic(_: OMatrix<i32, U3, Dyn>) {}
#[test] #[test]
fn ensure_arbitrary_test_compiles_matrixmn_dynamic_u3(_: OMatrix<i32, Dynamic, U3>) {} fn ensure_arbitrary_test_compiles_matrixmn_dynamic_u3(_: OMatrix<i32, Dyn, U3>) {}
#[test] #[test]
fn ensure_arbitrary_test_compiles_dmatrix(_: DMatrix<i32>) {} fn ensure_arbitrary_test_compiles_dmatrix(_: DMatrix<i32>) {}