diff --git a/Cargo.toml b/Cargo.toml index 5abe5e0..997d595 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nalgebra-spacetime" -version = "0.5.0" +version = "0.6.0" authors = ["Rouven Spreckels "] edition = "2021" description = "Spacetime Extension for nalgebra" @@ -33,4 +33,4 @@ rustdoc-args = [ "--html-in-header", "katex.html" ] [dependencies] approx = { version = "0.5.1", default-features = false } -nalgebra = { version = "0.32.4", features = ["rand"] } +nalgebra = { version = "0.33.0", features = ["rand"] } diff --git a/RELEASES.md b/RELEASES.md index 1c25b0a..954eaac 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,7 @@ +# Version 0.6.0 (2024-10-11) + + * Update `nalgebra`. + # Version 0.5.0 (2024-03-11) * Replace `N: SimdRealField + Signed + Real` with `T: RealField`. diff --git a/rustfmt.toml b/rustfmt.toml index 36af38c..3efb68f 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,3 +1,3 @@ hard_tabs = true -format_code_in_doc_comments = true max_width = 100 +#format_code_in_doc_comments = true diff --git a/src/lib.rs b/src/lib.rs index c80ff5b..0e48c7c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -157,7 +157,7 @@ where C2: Dim, SB: Storage, ShapeConstraint: AreMultipliable, - DefaultAllocator: Allocator; + DefaultAllocator: Allocator; /// Same as [`Self::contr`] but with transposed tensor indices. /// @@ -170,7 +170,7 @@ where C2: Dim, SB: Storage, ShapeConstraint: SameNumberOfRows, - DefaultAllocator: Allocator; + DefaultAllocator: Allocator; /// Lorentzian inner product of degree-1/degree-2 tensors. /// @@ -303,7 +303,7 @@ where where D: DimNameSub, ShapeConstraint: AreMultipliable + DimEq, - DefaultAllocator: Allocator>; + DefaultAllocator: Allocator>; /// Boosts this degree-1 tensor $x^\mu$ to inertial `frame` of reference along $\hat u$ with /// $\zeta$. @@ -330,7 +330,7 @@ where + SameNumberOfColumns + DimEq<>::Output, >::Output> + SameNumberOfRows<>::Output, >::Output>, - DefaultAllocator: Allocator>; + DefaultAllocator: Allocator>; /// $ /// \gdef \xu {(\vec x \cdot \hat u)} @@ -377,7 +377,7 @@ where + SameNumberOfColumns + DimEq<>::Output, >::Output> + SameNumberOfRows<>::Output, >::Output>, - DefaultAllocator: Allocator>; + DefaultAllocator: Allocator>; /// Velocity $u^\mu$ of inertial `frame` of reference. #[must_use] @@ -385,7 +385,7 @@ where where D: DimNameSub, ShapeConstraint: SameNumberOfRows + SameNumberOfColumns, - DefaultAllocator: Allocator> + Allocator; + DefaultAllocator: Allocator> + Allocator; /// Inertial frame of reference of this velocity $u^\mu$. #[must_use] @@ -393,7 +393,7 @@ where where R: DimNameSub, ShapeConstraint: SameNumberOfColumns, - DefaultAllocator: Allocator>; + DefaultAllocator: Allocator>; /// From `temporal` and `spatial` spacetime split. #[must_use] @@ -401,8 +401,8 @@ where where D: DimNameSub, ShapeConstraint: SameNumberOfRows + SameNumberOfColumns, - DefaultAllocator: Allocator> + Allocator, - >::Buffer: + DefaultAllocator: Allocator> + Allocator, + >::Buffer: StorageMut; /// Spacetime split into [`Self::temporal`] and [`Self::spatial`]. @@ -411,8 +411,8 @@ where where R: DimNameSub, ShapeConstraint: DimEq, - DefaultAllocator: Allocator, - >::Buffer: + DefaultAllocator: Allocator, + >::Buffer: Storage; /// Mutable spacetime split into [`Self::temporal_mut`] and @@ -435,8 +435,8 @@ where where R: DimNameSub, ShapeConstraint: DimEq, - DefaultAllocator: Allocator, - >::Buffer: + DefaultAllocator: Allocator, + >::Buffer: Storage; /// Temporal component. @@ -458,8 +458,8 @@ where where R: DimNameSub, ShapeConstraint: DimEq, - DefaultAllocator: Allocator, - >::Buffer: + DefaultAllocator: Allocator, + >::Buffer: Storage; /// Mutable spatial components. @@ -467,8 +467,8 @@ where where R: DimNameSub, ShapeConstraint: DimEq, - DefaultAllocator: Allocator, - >::Buffer: + DefaultAllocator: Allocator, + >::Buffer: StorageMut; } @@ -477,7 +477,7 @@ where T: RealField, R: DimName + DimNameSub, C: DimName + DimNameSub, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { #[inline] fn metric() -> Self @@ -550,7 +550,7 @@ where C2: Dim, SB: Storage, ShapeConstraint: AreMultipliable, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { self.c_dual() * rhs } @@ -562,7 +562,7 @@ where C2: Dim, SB: Storage, ShapeConstraint: SameNumberOfRows, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { self.r_dual().tr_mul(rhs) } @@ -643,7 +643,7 @@ where where D: DimNameSub, ShapeConstraint: AreMultipliable + DimEq, - DefaultAllocator: Allocator>, + DefaultAllocator: Allocator>, { let OFrame { zeta_cosh, @@ -672,7 +672,7 @@ where + SameNumberOfColumns + DimEq<>::Output, >::Output> + SameNumberOfRows<>::Output, >::Output>, - DefaultAllocator: Allocator>, + DefaultAllocator: Allocator>, { let mut v = self.clone_owned(); v.boost_mut(frame); @@ -687,7 +687,7 @@ where + SameNumberOfColumns + DimEq<>::Output, >::Output> + SameNumberOfRows<>::Output, >::Output>, - DefaultAllocator: Allocator>, + DefaultAllocator: Allocator>, { let OFrame { zeta_cosh, @@ -708,7 +708,7 @@ where where D: DimNameSub, ShapeConstraint: SameNumberOfRows + SameNumberOfColumns, - DefaultAllocator: Allocator> + Allocator, + DefaultAllocator: Allocator> + Allocator, { frame.velocity() } @@ -718,7 +718,7 @@ where where R: DimNameSub, ShapeConstraint: SameNumberOfColumns, - DefaultAllocator: Allocator>, + DefaultAllocator: Allocator>, { OFrame::::from_velocity(self) } @@ -728,8 +728,8 @@ where where D: DimNameSub, ShapeConstraint: SameNumberOfRows + SameNumberOfColumns, - DefaultAllocator: Allocator> + Allocator, - >::Buffer: + DefaultAllocator: Allocator> + Allocator, + >::Buffer: StorageMut, { let mut v = OVector::::zeros(); @@ -743,8 +743,8 @@ where where R: DimNameSub, ShapeConstraint: DimEq, - DefaultAllocator: Allocator, - >::Buffer: + DefaultAllocator: Allocator, + >::Buffer: Storage, { (self.temporal(), self.spatial()) @@ -755,8 +755,8 @@ where where R: DimNameSub, ShapeConstraint: DimEq, - DefaultAllocator: Allocator, - >::Buffer: + DefaultAllocator: Allocator, + >::Buffer: Storage, { let (temporal, spatial) = self.as_mut_slice().split_at_mut(1); @@ -789,7 +789,7 @@ where where R: DimNameSub, ShapeConstraint: DimEq, - >::Buffer: + >::Buffer: RawStorage, { let (rows, _cols) = self.shape_generic(); @@ -801,7 +801,7 @@ where where R: DimNameSub, ShapeConstraint: DimEq, - >::Buffer: + >::Buffer: RawStorageMut, { let (rows, _cols) = self.shape_generic(); @@ -862,7 +862,7 @@ pub struct OFrame where T: Scalar, D: DimNameSub, - DefaultAllocator: Allocator>, + DefaultAllocator: Allocator>, { zeta_cosh: T, zeta_sinh: T, @@ -873,7 +873,7 @@ impl OFrame where T: RealField, D: DimNameSub, - DefaultAllocator: Allocator>, + DefaultAllocator: Allocator>, { /// Inertial frame of reference with velocity $u^\mu$. #[must_use] @@ -882,7 +882,7 @@ where R: DimNameSub, C: Dim, ShapeConstraint: SameNumberOfRows + SameNumberOfColumns, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { let mut scaled_axis = OVector::zeros(); let zeta_cosh = u[0].clone(); @@ -946,7 +946,7 @@ where #[must_use] pub fn velocity(&self) -> OVector where - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { let mut u = OVector::::zeros(); u[0] = self.gamma(); @@ -1000,7 +1000,7 @@ where #[inline] pub fn compose(&self, frame: &Self) -> Self where - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { frame.velocity().boost(&-self.clone()).frame() } @@ -1017,7 +1017,7 @@ where #[must_use] pub fn angle(&self, frame: &Self) -> T where - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { let (u, v) = (self, frame); let ucv = u.compose(v).axis(); @@ -1096,10 +1096,10 @@ where #[allow(clippy::similar_names, clippy::many_single_char_names)] pub fn rotation(&self, frame: &Self) -> (OMatrix, T) where - DefaultAllocator: Allocator - + Allocator> - + Allocator - + Allocator, DimNameDiff>, + DefaultAllocator: Allocator + + Allocator> + + Allocator + + Allocator, DimNameDiff>, { let (u, v) = (self, frame); let a = &u.compose(v).axis().into_inner(); @@ -1157,7 +1157,7 @@ where T: RealField, D: DimNameSub, ShapeConstraint: DimEq, - DefaultAllocator: Allocator>, + DefaultAllocator: Allocator>, { let (u, v) = (self, frame); let (axis, sin) = Unit::new_and_get(u.axis().cross(&v.axis())); @@ -1178,7 +1178,7 @@ where R: DimNameSub, C: DimNameSub, ShapeConstraint: SameNumberOfColumns, - DefaultAllocator: Allocator + Allocator>, + DefaultAllocator: Allocator + Allocator>, { #[inline] fn from(u: OMatrix) -> Self { @@ -1190,7 +1190,7 @@ impl From> for OVector where T: RealField, D: DimNameSub, - DefaultAllocator: Allocator> + Allocator, + DefaultAllocator: Allocator> + Allocator, { #[inline] fn from(frame: OFrame) -> Self { @@ -1202,7 +1202,7 @@ impl Neg for OFrame where T: RealField, D: DimNameSub, - DefaultAllocator: Allocator>, + DefaultAllocator: Allocator>, { type Output = Self; @@ -1217,7 +1217,7 @@ impl Add for OFrame where T: RealField, D: DimNameSub, - DefaultAllocator: Allocator> + Allocator, + DefaultAllocator: Allocator> + Allocator, { type Output = Self; @@ -1231,7 +1231,7 @@ impl Sub for OFrame where T: RealField, D: DimNameSub, - DefaultAllocator: Allocator> + Allocator, + DefaultAllocator: Allocator> + Allocator, { type Output = Self; @@ -1245,7 +1245,7 @@ impl Copy for OFrame where T: RealField + Copy, D: DimNameSub, - DefaultAllocator: Allocator>, + DefaultAllocator: Allocator>, Owned>: Copy, { } @@ -1277,7 +1277,7 @@ pub struct OMomentum where T: Scalar, D: DimNameSub, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { momentum: OVector, } @@ -1286,7 +1286,7 @@ impl OMomentum where T: RealField, D: DimNameSub, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { /// Momentum with spacetime [`Lorentzian::split`], `energy` $E$ and /// `momentum` $\vec p$. @@ -1294,8 +1294,8 @@ where #[inline] pub fn from_split(energy: &T, momentum: &OVector>) -> Self where - DefaultAllocator: Allocator>, - >::Buffer: + DefaultAllocator: Allocator>, + >::Buffer: StorageMut, { Self { @@ -1308,7 +1308,7 @@ where #[inline] pub fn from_mass_at_velocity(mass: T, velocity: OVector) -> Self where - DefaultAllocator: Allocator>, + DefaultAllocator: Allocator>, { Self { momentum: velocity * mass, @@ -1322,7 +1322,7 @@ where #[inline] pub fn from_mass_in_frame(mass: T, frame: &OFrame) -> Self where - DefaultAllocator: Allocator>, + DefaultAllocator: Allocator>, { Self::from_mass_at_velocity(mass, frame.velocity()) } @@ -1362,8 +1362,8 @@ where #[inline] pub fn momentum(&self) -> VectorView, U1, D> where - DefaultAllocator: Allocator, - >::Buffer: + DefaultAllocator: Allocator, + >::Buffer: Storage, { self.momentum.spatial() @@ -1374,7 +1374,7 @@ impl From> for OMomentum where T: RealField, D: DimNameSub, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { #[inline] fn from(momentum: OVector) -> Self { @@ -1386,7 +1386,7 @@ impl From> for OVector where T: RealField, D: DimNameSub, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { #[inline] fn from(momentum: OMomentum) -> Self { @@ -1398,7 +1398,7 @@ impl Neg for OMomentum where T: RealField, D: DimNameSub, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { type Output = Self; @@ -1413,7 +1413,7 @@ impl Add for OMomentum where T: RealField, D: DimNameSub, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { type Output = Self; @@ -1429,7 +1429,7 @@ impl Sub for OMomentum where T: RealField, D: DimNameSub, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, { type Output = Self; @@ -1445,7 +1445,7 @@ impl Copy for OMomentum where T: RealField + Copy, D: DimNameSub, - DefaultAllocator: Allocator, + DefaultAllocator: Allocator, Owned: Copy, { }