Formatting

This commit is contained in:
Andreas Longva 2022-11-14 16:43:47 +01:00
parent 31e687bd76
commit 55c3a9c764
4 changed files with 42 additions and 39 deletions

View File

@ -16,8 +16,8 @@ use crate::base::dimension::{
use crate::base::iter::{MatrixIter, MatrixIterMut}; use crate::base::iter::{MatrixIter, MatrixIterMut};
use crate::base::storage::{IsContiguous, RawStorage, RawStorageMut}; use crate::base::storage::{IsContiguous, RawStorage, RawStorageMut};
use crate::base::{ use crate::base::{
ArrayStorage, DVectorView, DVectorViewMut, DefaultAllocator, Matrix, MatrixView, ArrayStorage, DVectorView, DVectorViewMut, DefaultAllocator, Matrix, MatrixView, MatrixViewMut,
MatrixViewMut, OMatrix, Scalar, OMatrix, Scalar,
}; };
#[cfg(any(feature = "std", feature = "alloc"))] #[cfg(any(feature = "std", feature = "alloc"))]
use crate::base::{DVector, RowDVector, VecStorage}; use crate::base::{DVector, RowDVector, VecStorage};
@ -380,10 +380,8 @@ where
RStride: Dim, RStride: Dim,
CStride: Dim, CStride: Dim,
S: RawStorage<T, R, C>, S: RawStorage<T, R, C>,
ShapeConstraint: DimEq<R, RView> ShapeConstraint:
+ DimEq<C, CView> DimEq<R, RView> + DimEq<C, CView> + DimEq<RStride, S::RStride> + DimEq<CStride, S::CStride>,
+ DimEq<RStride, S::RStride>
+ DimEq<CStride, S::CStride>,
{ {
fn from(m: &'a Matrix<T, R, C, S>) -> Self { fn from(m: &'a Matrix<T, R, C, S>) -> Self {
let (row, col) = m.shape_generic(); let (row, col) = m.shape_generic();
@ -416,10 +414,8 @@ where
RStride: Dim, RStride: Dim,
CStride: Dim, CStride: Dim,
S: RawStorage<T, R, C>, S: RawStorage<T, R, C>,
ShapeConstraint: DimEq<R, RView> ShapeConstraint:
+ DimEq<C, CView> DimEq<R, RView> + DimEq<C, CView> + DimEq<RStride, S::RStride> + DimEq<CStride, S::CStride>,
+ DimEq<RStride, S::RStride>
+ DimEq<CStride, S::CStride>,
{ {
fn from(m: &'a mut Matrix<T, R, C, S>) -> Self { fn from(m: &'a mut Matrix<T, R, C, S>) -> Self {
let (row, col) = m.shape_generic(); let (row, col) = m.shape_generic();
@ -452,10 +448,8 @@ where
RStride: Dim, RStride: Dim,
CStride: Dim, CStride: Dim,
S: RawStorageMut<T, R, C>, S: RawStorageMut<T, R, C>,
ShapeConstraint: DimEq<R, RView> ShapeConstraint:
+ DimEq<C, CView> DimEq<R, RView> + DimEq<C, CView> + DimEq<RStride, S::RStride> + DimEq<CStride, S::CStride>,
+ DimEq<RStride, S::RStride>
+ DimEq<CStride, S::CStride>,
{ {
fn from(m: &'a mut Matrix<T, R, C, S>) -> Self { fn from(m: &'a mut Matrix<T, R, C, S>) -> Self {
let (row, col) = m.shape_generic(); let (row, col) = m.shape_generic();

View File

@ -1122,13 +1122,18 @@ where
/// let dynamic_view: DMatrixSlice<f64> = matrix.as_view(); /// let dynamic_view: DMatrixSlice<f64> = matrix.as_view();
/// let static_view_from_dyn: SMatrixView<f64, 3, 3> = dynamic_view.as_view(); /// let static_view_from_dyn: SMatrixView<f64, 3, 3> = dynamic_view.as_view();
/// ``` /// ```
pub fn as_view<RView, CView, RViewStride, CViewStride>(&self) -> MatrixView<'_, T, RView, CView, RViewStride, CViewStride> pub fn as_view<RView, CView, RViewStride, CViewStride>(
&self,
) -> MatrixView<'_, T, RView, CView, RViewStride, CViewStride>
where where
RView: Dim, RView: Dim,
CView: Dim, CView: Dim,
RViewStride: Dim, RViewStride: Dim,
CViewStride: Dim, CViewStride: Dim,
ShapeConstraint: DimEq<R, RView> + DimEq<C, CView> + DimEq<RViewStride, S::RStride> + DimEq<CViewStride, S::CStride> ShapeConstraint: DimEq<R, RView>
+ DimEq<C, CView>
+ DimEq<RViewStride, S::RStride>
+ DimEq<CViewStride, S::CStride>,
{ {
// Defer to (&matrix).into() // Defer to (&matrix).into()
self.into() self.into()
@ -1164,13 +1169,18 @@ where
/// let mut dynamic_view: DMatrixViewMut<f64> = matrix.as_view_mut(); /// let mut dynamic_view: DMatrixViewMut<f64> = matrix.as_view_mut();
/// let static_view_from_dyn: SMatrixViewMut<f64, 3, 3> = dynamic_view.as_view_mut(); /// let static_view_from_dyn: SMatrixViewMut<f64, 3, 3> = dynamic_view.as_view_mut();
/// ``` /// ```
pub fn as_view_mut<RView, CView, RViewStride, CViewStride>(&mut self) -> MatrixViewMut<'_, T, RView, CView, RViewStride, CViewStride> pub fn as_view_mut<RView, CView, RViewStride, CViewStride>(
&mut self,
) -> MatrixViewMut<'_, T, RView, CView, RViewStride, CViewStride>
where where
RView: Dim, RView: Dim,
CView: Dim, CView: Dim,
RViewStride: Dim, RViewStride: Dim,
CViewStride: Dim, CViewStride: Dim,
ShapeConstraint: DimEq<R, RView> + DimEq<C, CView> + DimEq<RViewStride, S::RStride> + DimEq<CViewStride, S::CStride> ShapeConstraint: DimEq<R, RView>
+ DimEq<C, CView>
+ DimEq<RViewStride, S::RStride>
+ DimEq<CViewStride, S::CStride>,
{ {
// Defer to (&mut matrix).into() // Defer to (&mut matrix).into()
self.into() self.into()

View File

@ -211,10 +211,12 @@ where
{ {
let mut work = work.rows_mut(0, end + 1); let mut work = work.rows_mut(0, end + 1);
refl.reflect(&mut t.generic_view_mut( refl.reflect(
&mut t.generic_view_mut(
(m, m), (m, m),
(Const::<2>, Dynamic::new(dim.value() - 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), (Dynamic::new(end + 1), Const::<2>)),
&mut work, &mut work,
@ -222,10 +224,7 @@ where
} }
if let Some(ref mut q) = q { if let Some(ref mut q) = q {
refl.reflect_rows( refl.reflect_rows(&mut q.generic_view_mut((0, m), (dim, Const::<2>)), work);
&mut q.generic_view_mut((0, m), (dim, Const::<2>)),
work,
);
} }
} }
} else { } else {

View File

@ -3,8 +3,8 @@
use na::{ use na::{
DMatrix, DMatrixView, DMatrixViewMut, Matrix2, Matrix2x3, Matrix2x4, Matrix2x6, Matrix3, DMatrix, DMatrixView, DMatrixViewMut, Matrix2, Matrix2x3, Matrix2x4, Matrix2x6, Matrix3,
Matrix3x2, Matrix3x4, Matrix4x2, Matrix6x2, MatrixView2, MatrixView2x3, MatrixView2xX, Matrix3x2, Matrix3x4, Matrix4x2, Matrix6x2, MatrixView2, MatrixView2x3, MatrixView2xX,
MatrixView3, MatrixView3x2, MatrixViewMut2, MatrixViewMut2x3, MatrixViewMut2xX, MatrixView3, MatrixView3x2, MatrixViewMut2, MatrixViewMut2x3, MatrixViewMut2xX, MatrixViewMut3,
MatrixViewMut3, MatrixViewMut3x2, MatrixViewMutXx3, MatrixViewXx3, RowVector4, Vector3, MatrixViewMut3x2, MatrixViewMutXx3, MatrixViewXx3, RowVector4, Vector3,
}; };
#[test] #[test]