From 35ec135d2cf777bc1d2b8e4a519d5bb1150892b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Crozet=20S=C3=A9bastien?= Date: Tue, 6 Apr 2021 10:53:11 +0200 Subject: [PATCH] Fix compilation after rebase. --- README.md | 4 +- src/base/construction.rs | 88 +++++++++++++++-------------- src/base/default_allocator.rs | 9 +-- src/geometry/point.rs | 4 +- src/geometry/point_construction.rs | 6 +- src/linalg/col_piv_qr.rs | 6 +- src/linalg/symmetric_tridiagonal.rs | 11 ++-- src/linalg/udu.rs | 4 +- 8 files changed, 69 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 08350907..bed6183d 100644 --- a/README.md +++ b/README.md @@ -30,10 +30,10 @@ ----- -## Gold sponsors +## Platinum sponsors Rapier is supported by:

- +

diff --git a/src/base/construction.rs b/src/base/construction.rs index b31574f7..a48e57a2 100644 --- a/src/base/construction.rs +++ b/src/base/construction.rs @@ -20,9 +20,11 @@ use typenum::{self, Cmp, Greater}; use simba::scalar::{ClosedAdd, ClosedMul}; use crate::base::allocator::Allocator; -use crate::base::dimension::{Const, Dim, DimName, Dynamic, ToTypenum, U1, U2, U3, U4, U5, U6}; +use crate::base::dimension::{Dim, DimName, Dynamic, ToTypenum}; use crate::base::storage::Storage; -use crate::base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Scalar, Unit, Vector, VectorN}; +use crate::base::{ + Const, DefaultAllocator, Matrix, MatrixMN, MatrixN, Scalar, Unit, Vector, VectorN, +}; /// When "no_unsound_assume_init" is enabled, expands to `unimplemented!()` instead of `new_uninitialized_generic().assume_init()`. /// Intended as a placeholder, each callsite should be refactored to use uninitialized memory soundly @@ -210,9 +212,9 @@ where /// m.m31 == 7.0 && m.m32 == 8.0 && m.m33 == 9.0); /// ``` #[inline] - pub fn from_rows(rows: &[Matrix]) -> Self + pub fn from_rows(rows: &[Matrix, C, SB>]) -> Self where - SB: Storage, + SB: Storage, C>, { assert!(!rows.is_empty(), "At least one row must be given."); let nrows = R::try_to_usize().unwrap_or_else(|| rows.len()); @@ -878,10 +880,10 @@ where * */ macro_rules! componentwise_constructors_impl( - ($($R: ty, $C: ty, $($args: ident:($irow: expr,$icol: expr)),*);* $(;)*) => {$( - impl MatrixMN + ($($R: expr, $C: expr, $($args: ident:($irow: expr,$icol: expr)),*);* $(;)*) => {$( + impl MatrixMN, Const<$C>> where N: Scalar, - DefaultAllocator: Allocator { + DefaultAllocator: Allocator, Const<$C>> { /// Initializes this matrix from its components. #[inline] pub fn new($($args: N),*) -> Self { @@ -903,21 +905,21 @@ componentwise_constructors_impl!( /* * Square matrices 1 .. 6. */ - U2, U2, m11:(0,0), m12:(0,1), + 2, 2, m11:(0,0), m12:(0,1), m21:(1,0), m22:(1,1); - U3, U3, m11:(0,0), m12:(0,1), m13:(0,2), + 3, 3, m11:(0,0), m12:(0,1), m13:(0,2), m21:(1,0), m22:(1,1), m23:(1,2), m31:(2,0), m32:(2,1), m33:(2,2); - U4, U4, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), + 4, 4, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m21:(1,0), m22:(1,1), m23:(1,2), m24:(1,3), m31:(2,0), m32:(2,1), m33:(2,2), m34:(2,3), m41:(3,0), m42:(3,1), m43:(3,2), m44:(3,3); - U5, U5, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), + 5, 5, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), m21:(1,0), m22:(1,1), m23:(1,2), m24:(1,3), m25:(1,4), m31:(2,0), m32:(2,1), m33:(2,2), m34:(2,3), m35:(2,4), m41:(3,0), m42:(3,1), m43:(3,2), m44:(3,3), m45:(3,4), m51:(4,0), m52:(4,1), m53:(4,2), m54:(4,3), m55:(4,4); - U6, U6, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), m16:(0,5), + 6, 6, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), m16:(0,5), m21:(1,0), m22:(1,1), m23:(1,2), m24:(1,3), m25:(1,4), m26:(1,5), m31:(2,0), m32:(2,1), m33:(2,2), m34:(2,3), m35:(2,4), m36:(2,5), m41:(3,0), m42:(3,1), m43:(3,2), m44:(3,3), m45:(3,4), m46:(3,5), @@ -927,47 +929,47 @@ componentwise_constructors_impl!( /* * Rectangular matrices with 2 rows. */ - U2, U3, m11:(0,0), m12:(0,1), m13:(0,2), + 2, 3, m11:(0,0), m12:(0,1), m13:(0,2), m21:(1,0), m22:(1,1), m23:(1,2); - U2, U4, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), + 2, 4, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m21:(1,0), m22:(1,1), m23:(1,2), m24:(1,3); - U2, U5, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), + 2, 5, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), m21:(1,0), m22:(1,1), m23:(1,2), m24:(1,3), m25:(1,4); - U2, U6, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), m16:(0,5), + 2, 6, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), m16:(0,5), m21:(1,0), m22:(1,1), m23:(1,2), m24:(1,3), m25:(1,4), m26:(1,5); /* * Rectangular matrices with 3 rows. */ - U3, U2, m11:(0,0), m12:(0,1), + 3, 2, m11:(0,0), m12:(0,1), m21:(1,0), m22:(1,1), m31:(2,0), m32:(2,1); - U3, U4, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), + 3, 4, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m21:(1,0), m22:(1,1), m23:(1,2), m24:(1,3), m31:(2,0), m32:(2,1), m33:(2,2), m34:(2,3); - U3, U5, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), + 3, 5, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), m21:(1,0), m22:(1,1), m23:(1,2), m24:(1,3), m25:(1,4), m31:(2,0), m32:(2,1), m33:(2,2), m34:(2,3), m35:(2,4); - U3, U6, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), m16:(0,5), + 3, 6, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), m16:(0,5), m21:(1,0), m22:(1,1), m23:(1,2), m24:(1,3), m25:(1,4), m26:(1,5), m31:(2,0), m32:(2,1), m33:(2,2), m34:(2,3), m35:(2,4), m36:(2,5); /* * Rectangular matrices with 4 rows. */ - U4, U2, m11:(0,0), m12:(0,1), + 4, 2, m11:(0,0), m12:(0,1), m21:(1,0), m22:(1,1), m31:(2,0), m32:(2,1), m41:(3,0), m42:(3,1); - U4, U3, m11:(0,0), m12:(0,1), m13:(0,2), + 4, 3, m11:(0,0), m12:(0,1), m13:(0,2), m21:(1,0), m22:(1,1), m23:(1,2), m31:(2,0), m32:(2,1), m33:(2,2), m41:(3,0), m42:(3,1), m43:(3,2); - U4, U5, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), + 4, 5, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), m21:(1,0), m22:(1,1), m23:(1,2), m24:(1,3), m25:(1,4), m31:(2,0), m32:(2,1), m33:(2,2), m34:(2,3), m35:(2,4), m41:(3,0), m42:(3,1), m43:(3,2), m44:(3,3), m45:(3,4); - U4, U6, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), m16:(0,5), + 4, 6, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), m16:(0,5), m21:(1,0), m22:(1,1), m23:(1,2), m24:(1,3), m25:(1,4), m26:(1,5), m31:(2,0), m32:(2,1), m33:(2,2), m34:(2,3), m35:(2,4), m36:(2,5), m41:(3,0), m42:(3,1), m43:(3,2), m44:(3,3), m45:(3,4), m46:(3,5); @@ -975,22 +977,22 @@ componentwise_constructors_impl!( /* * Rectangular matrices with 5 rows. */ - U5, U2, m11:(0,0), m12:(0,1), + 5, 2, m11:(0,0), m12:(0,1), m21:(1,0), m22:(1,1), m31:(2,0), m32:(2,1), m41:(3,0), m42:(3,1), m51:(4,0), m52:(4,1); - U5, U3, m11:(0,0), m12:(0,1), m13:(0,2), + 5, 3, m11:(0,0), m12:(0,1), m13:(0,2), m21:(1,0), m22:(1,1), m23:(1,2), m31:(2,0), m32:(2,1), m33:(2,2), m41:(3,0), m42:(3,1), m43:(3,2), m51:(4,0), m52:(4,1), m53:(4,2); - U5, U4, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), + 5, 4, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m21:(1,0), m22:(1,1), m23:(1,2), m24:(1,3), m31:(2,0), m32:(2,1), m33:(2,2), m34:(2,3), m41:(3,0), m42:(3,1), m43:(3,2), m44:(3,3), m51:(4,0), m52:(4,1), m53:(4,2), m54:(4,3); - U5, U6, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), m16:(0,5), + 5, 6, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), m16:(0,5), m21:(1,0), m22:(1,1), m23:(1,2), m24:(1,3), m25:(1,4), m26:(1,5), m31:(2,0), m32:(2,1), m33:(2,2), m34:(2,3), m35:(2,4), m36:(2,5), m41:(3,0), m42:(3,1), m43:(3,2), m44:(3,3), m45:(3,4), m46:(3,5), @@ -999,25 +1001,25 @@ componentwise_constructors_impl!( /* * Rectangular matrices with 6 rows. */ - U6, U2, m11:(0,0), m12:(0,1), + 6, 2, m11:(0,0), m12:(0,1), m21:(1,0), m22:(1,1), m31:(2,0), m32:(2,1), m41:(3,0), m42:(3,1), m51:(4,0), m52:(4,1), m61:(5,0), m62:(5,1); - U6, U3, m11:(0,0), m12:(0,1), m13:(0,2), + 6, 3, m11:(0,0), m12:(0,1), m13:(0,2), m21:(1,0), m22:(1,1), m23:(1,2), m31:(2,0), m32:(2,1), m33:(2,2), m41:(3,0), m42:(3,1), m43:(3,2), m51:(4,0), m52:(4,1), m53:(4,2), m61:(5,0), m62:(5,1), m63:(5,2); - U6, U4, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), + 6, 4, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m21:(1,0), m22:(1,1), m23:(1,2), m24:(1,3), m31:(2,0), m32:(2,1), m33:(2,2), m34:(2,3), m41:(3,0), m42:(3,1), m43:(3,2), m44:(3,3), m51:(4,0), m52:(4,1), m53:(4,2), m54:(4,3), m61:(5,0), m62:(5,1), m63:(5,2), m64:(5,3); - U6, U5, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), + 6, 5, m11:(0,0), m12:(0,1), m13:(0,2), m14:(0,3), m15:(0,4), m21:(1,0), m22:(1,1), m23:(1,2), m24:(1,3), m25:(1,4), m31:(2,0), m32:(2,1), m33:(2,2), m34:(2,3), m35:(2,4), m41:(3,0), m42:(3,1), m43:(3,2), m44:(3,3), m45:(3,4), @@ -1027,21 +1029,21 @@ componentwise_constructors_impl!( /* * Row vectors 1 .. 6. */ - U1, U1, x:(0,0); - U1, U2, x:(0,0), y:(0,1); - U1, U3, x:(0,0), y:(0,1), z:(0,2); - U1, U4, x:(0,0), y:(0,1), z:(0,2), w:(0,3); - U1, U5, x:(0,0), y:(0,1), z:(0,2), w:(0,3), a:(0,4); - U1, U6, x:(0,0), y:(0,1), z:(0,2), w:(0,3), a:(0,4), b:(0,5); + 1, 1, x:(0,0); + 1, 2, x:(0,0), y:(0,1); + 1, 3, x:(0,0), y:(0,1), z:(0,2); + 1, 4, x:(0,0), y:(0,1), z:(0,2), w:(0,3); + 1, 5, x:(0,0), y:(0,1), z:(0,2), w:(0,3), a:(0,4); + 1, 6, x:(0,0), y:(0,1), z:(0,2), w:(0,3), a:(0,4), b:(0,5); /* * Column vectors 1 .. 6. */ - U2, U1, x:(0,0), y:(1,0); - U3, U1, x:(0,0), y:(1,0), z:(2,0); - U4, U1, x:(0,0), y:(1,0), z:(2,0), w:(3,0); - U5, U1, x:(0,0), y:(1,0), z:(2,0), w:(3,0), a:(4,0); - U6, U1, x:(0,0), y:(1,0), z:(2,0), w:(3,0), a:(4,0), b:(5,0); + 2, 1, x:(0,0), y:(1,0); + 3, 1, x:(0,0), y:(1,0), z:(2,0); + 4, 1, x:(0,0), y:(1,0), z:(2,0), w:(3,0); + 5, 1, x:(0,0), y:(1,0), z:(2,0), w:(3,0), a:(4,0); + 6, 1, x:(0,0), y:(1,0), z:(2,0), w:(3,0), a:(4,0), b:(5,0); ); /* diff --git a/src/base/default_allocator.rs b/src/base/default_allocator.rs index b5735fa2..03f86fb9 100644 --- a/src/base/default_allocator.rs +++ b/src/base/default_allocator.rs @@ -37,7 +37,7 @@ impl Allocator, Const> type Buffer = ArrayStorage; #[inline] - unsafe fn allocate_uninitialized(_: R, _: C) -> mem::MaybeUninit { + unsafe fn allocate_uninitialized(_: Const, _: Const) -> mem::MaybeUninit { mem::MaybeUninit::::uninit() } @@ -146,12 +146,13 @@ where rto: Const, cto: Const, buf: >::Buffer, - ) -> ArrayStorage { + ) -> ArrayStorage { #[cfg(feature = "no_unsound_assume_init")] - let mut res: ArrayStorage = unimplemented!(); + let mut res: ArrayStorage = unimplemented!(); #[cfg(not(feature = "no_unsound_assume_init"))] let mut res = - >::allocate_uninitialized(rto, cto).assume_init(); + , Const>>::allocate_uninitialized(rto, cto) + .assume_init(); let (rfrom, cfrom) = buf.shape(); diff --git a/src/geometry/point.rs b/src/geometry/point.rs index eeda07e3..5d8b6fbd 100644 --- a/src/geometry/point.rs +++ b/src/geometry/point.rs @@ -17,7 +17,7 @@ use simba::simd::SimdPartialOrd; use crate::base::allocator::Allocator; use crate::base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; use crate::base::iter::{MatrixIter, MatrixIterMut}; -use crate::base::{DefaultAllocator, Scalar, VectorN}; +use crate::base::{Const, DefaultAllocator, Scalar, VectorN}; /// A point in an euclidean space. /// @@ -202,7 +202,7 @@ where let mut res = unsafe { crate::unimplemented_or_uninitialized_generic!( as DimName>::name(), - U1 + Const::<1> ) }; res.fixed_slice_mut::(0, 0).copy_from(&self.coords); diff --git a/src/geometry/point_construction.rs b/src/geometry/point_construction.rs index 47b336f4..ad3cb66d 100644 --- a/src/geometry/point_construction.rs +++ b/src/geometry/point_construction.rs @@ -12,8 +12,8 @@ use crate::base::allocator::Allocator; use crate::base::dimension::{DimName, DimNameAdd, DimNameSum, U1}; use crate::base::{DefaultAllocator, Scalar, VectorN}; use crate::{ - Point1, Point2, Point3, Point4, Point5, Point6, Vector1, Vector2, Vector3, Vector4, Vector5, - Vector6, + Const, Point1, Point2, Point3, Point4, Point5, Point6, Vector1, Vector2, Vector3, Vector4, + Vector5, Vector6, }; use simba::scalar::{ClosedDiv, SupersetOf}; @@ -29,7 +29,7 @@ where pub unsafe fn new_uninitialized() -> Self { Self::from(crate::unimplemented_or_uninitialized_generic!( D::name(), - U1 + Const::<1> )) } diff --git a/src/linalg/col_piv_qr.rs b/src/linalg/col_piv_qr.rs index 302dcd66..91083634 100644 --- a/src/linalg/col_piv_qr.rs +++ b/src/linalg/col_piv_qr.rs @@ -3,9 +3,9 @@ use num::Zero; use serde::{Deserialize, Serialize}; use crate::allocator::{Allocator, Reallocator}; -use crate::base::{DefaultAllocator, Matrix, MatrixMN, MatrixN, Unit, VectorN}; +use crate::base::{Const, DefaultAllocator, Matrix, MatrixMN, MatrixN, Unit, VectorN}; use crate::constraint::{SameNumberOfRows, ShapeConstraint}; -use crate::dimension::{Dim, DimMin, DimMinimum, U1}; +use crate::dimension::{Dim, DimMin, DimMinimum}; use crate::storage::{Storage, StorageMut}; use crate::ComplexField; @@ -67,7 +67,7 @@ where let mut p = PermutationSequence::identity_generic(min_nrows_ncols); let mut diag = - unsafe { crate::unimplemented_or_uninitialized_generic!(min_nrows_ncols, U1) }; + unsafe { crate::unimplemented_or_uninitialized_generic!(min_nrows_ncols, Const::<1>) }; if min_nrows_ncols.value() == 0 { return ColPivQR { diff --git a/src/linalg/symmetric_tridiagonal.rs b/src/linalg/symmetric_tridiagonal.rs index 82fc4e27..e0416d66 100644 --- a/src/linalg/symmetric_tridiagonal.rs +++ b/src/linalg/symmetric_tridiagonal.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; use crate::allocator::Allocator; -use crate::base::{DefaultAllocator, MatrixMN, MatrixN, VectorN}; +use crate::base::{DefaultAllocator, MatrixN, VectorN}; use crate::dimension::{Const, DimDiff, DimSub, U1}; use crate::storage::Storage; use simba::scalar::ComplexField; @@ -61,9 +61,12 @@ where "Unable to compute the symmetric tridiagonal decomposition of an empty matrix." ); - let mut off_diagonal = - unsafe { crate::unimplemented_or_uninitialized_generic!(dim.sub(Const::<1>), Const::<1>) }; - let mut p = unsafe { crate::unimplemented_or_uninitialized_generic!(dim.sub(Const::<1>), Const::<1>) }; + let mut off_diagonal = unsafe { + crate::unimplemented_or_uninitialized_generic!(dim.sub(Const::<1>), Const::<1>) + }; + let mut p = unsafe { + crate::unimplemented_or_uninitialized_generic!(dim.sub(Const::<1>), Const::<1>) + }; for i in 0..dim.value() - 1 { let mut m = m.rows_range_mut(i + 1..); diff --git a/src/linalg/udu.rs b/src/linalg/udu.rs index 70ff84a7..b3ea5ff9 100644 --- a/src/linalg/udu.rs +++ b/src/linalg/udu.rs @@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize}; use crate::allocator::Allocator; -use crate::base::{DefaultAllocator, MatrixN, VectorN, U1}; +use crate::base::{Const, DefaultAllocator, MatrixN, VectorN}; use crate::dimension::Dim; use crate::storage::Storage; use simba::scalar::RealField; @@ -52,7 +52,7 @@ where let n = p.ncols(); let n_dim = p.data.shape().1; - let mut d = VectorN::zeros_generic(n_dim, U1); + let mut d = VectorN::zeros_generic(n_dim, Const::<1>); let mut u = MatrixN::zeros_generic(n_dim, n_dim); d[n - 1] = p[(n - 1, n - 1)];