cargo fmt
This commit is contained in:
parent
267eb01fe5
commit
89a9dedcd5
|
@ -18,7 +18,7 @@ use crate::base::{DefaultAllocator, Scalar};
|
|||
/// same `Buffer` type.
|
||||
pub trait Allocator<N: Scalar, R: Dim, C: Dim = U1>: Any + Sized {
|
||||
/// The type of buffer this allocator can instanciate.
|
||||
type Buffer: ContiguousStorageMut<N, R, C> + Clone + IntoIterator<Item=N>;
|
||||
type Buffer: ContiguousStorageMut<N, R, C> + Clone + IntoIterator<Item = N>;
|
||||
|
||||
/// Allocates a buffer with the given number of rows and columns without initializing its content.
|
||||
unsafe fn allocate_uninitialized(nrows: R, ncols: C) -> Self::Buffer;
|
||||
|
|
|
@ -21,7 +21,7 @@ use crate::base::dimension::{
|
|||
Dim, DimName, U1, U10, U11, U12, U13, U14, U15, U16, U2, U3, U4, U5, U6, U7, U8, U9,
|
||||
};
|
||||
use crate::base::iter::{MatrixIter, MatrixIterMut};
|
||||
use crate::base::storage::{ContiguousStorage, ContiguousStorageMut, Storage, StorageMut, Owned};
|
||||
use crate::base::storage::{ContiguousStorage, ContiguousStorageMut, Owned, Storage, StorageMut};
|
||||
use crate::base::{
|
||||
ArrayStorage, DVectorSlice, DVectorSliceMut, DefaultAllocator, Matrix, MatrixMN, MatrixSlice,
|
||||
MatrixSliceMut, Scalar,
|
||||
|
@ -87,7 +87,8 @@ where
|
|||
}
|
||||
|
||||
impl<N: Scalar, R: Dim, C: Dim> IntoIterator for Matrix<N, R, C, Owned<N, R, C>>
|
||||
where DefaultAllocator: Allocator<N, R, C>
|
||||
where
|
||||
DefaultAllocator: Allocator<N, R, C>,
|
||||
{
|
||||
type Item = N;
|
||||
type IntoIter = <Owned<N, R, C> as IntoIterator>::IntoIter;
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
use std::marker::PhantomData;
|
||||
use std::mem;
|
||||
|
||||
use crate::base::dimension::{Dim, U1, Dynamic};
|
||||
use crate::base::storage::{Storage, StorageMut, Owned};
|
||||
use crate::base::{Matrix, MatrixSlice, MatrixSliceMut, Scalar, Vector, RowVector};
|
||||
use crate::base::dimension::{Dim, Dynamic, U1};
|
||||
use crate::base::storage::{Owned, Storage, StorageMut};
|
||||
use crate::base::{Matrix, MatrixSlice, MatrixSliceMut, RowVector, Scalar, Vector};
|
||||
|
||||
macro_rules! iterator {
|
||||
(struct $Name:ident for $Storage:ident.$ptr: ident -> $Ptr:ty, $Ref:ty, $SRef: ty) => {
|
||||
|
@ -252,12 +252,19 @@ impl<N: Scalar> OwnedRowIter<N> {
|
|||
rows[i % nrows].push(item);
|
||||
i += 1;
|
||||
}
|
||||
let rows: Vec<RowVector<N, Dynamic, Owned<N, U1, Dynamic>>> =
|
||||
rows.into_iter()
|
||||
.map(|row| RowVector::<N, Dynamic, Owned<N, U1, Dynamic>>::from_iterator_generic(
|
||||
U1::from_usize(1), Dynamic::from_usize(ncols), row.into_iter()))
|
||||
.collect();
|
||||
OwnedRowIter { rows: rows.into_iter() }
|
||||
let rows: Vec<RowVector<N, Dynamic, Owned<N, U1, Dynamic>>> = rows
|
||||
.into_iter()
|
||||
.map(|row| {
|
||||
RowVector::<N, Dynamic, Owned<N, U1, Dynamic>>::from_iterator_generic(
|
||||
U1::from_usize(1),
|
||||
Dynamic::from_usize(ncols),
|
||||
row.into_iter(),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
OwnedRowIter {
|
||||
rows: rows.into_iter(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -280,9 +287,7 @@ impl<N: Scalar> Iterator for OwnedRowIter<N> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<N: Scalar> ExactSizeIterator
|
||||
for OwnedRowIter<N>
|
||||
{
|
||||
impl<N: Scalar> ExactSizeIterator for OwnedRowIter<N> {
|
||||
#[inline]
|
||||
fn len(&self) -> usize {
|
||||
self.rows.len()
|
||||
|
@ -418,17 +423,19 @@ impl<N: Scalar> OwnedColumnIter<N> {
|
|||
cols[i / nrows].push(item);
|
||||
i += 1;
|
||||
}
|
||||
let cols: Vec<Vector<N, Dynamic, Owned<N, Dynamic, U1>>> =
|
||||
cols.into_iter()
|
||||
.map(|col|
|
||||
Vector::<N, Dynamic, Owned<N, Dynamic, U1>>::from_iterator_generic(
|
||||
Dynamic::from_usize(nrows),
|
||||
U1::from_usize(1),
|
||||
col.into_iter()
|
||||
)
|
||||
let cols: Vec<Vector<N, Dynamic, Owned<N, Dynamic, U1>>> = cols
|
||||
.into_iter()
|
||||
.map(|col| {
|
||||
Vector::<N, Dynamic, Owned<N, Dynamic, U1>>::from_iterator_generic(
|
||||
Dynamic::from_usize(nrows),
|
||||
U1::from_usize(1),
|
||||
col.into_iter(),
|
||||
)
|
||||
.collect();
|
||||
OwnedColumnIter { cols: cols.into_iter() }
|
||||
})
|
||||
.collect();
|
||||
OwnedColumnIter {
|
||||
cols: cols.into_iter(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -451,8 +458,7 @@ impl<N: Scalar> Iterator for OwnedColumnIter<N> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<N: Scalar> ExactSizeIterator
|
||||
for OwnedColumnIter<N> {
|
||||
impl<N: Scalar> ExactSizeIterator for OwnedColumnIter<N> {
|
||||
#[inline]
|
||||
fn len(&self) -> usize {
|
||||
self.cols.len()
|
||||
|
|
|
@ -21,12 +21,13 @@ use simba::simd::SimdPartialOrd;
|
|||
|
||||
use crate::base::allocator::{Allocator, SameShapeAllocator, SameShapeC, SameShapeR};
|
||||
use crate::base::constraint::{DimEq, SameNumberOfColumns, SameNumberOfRows, ShapeConstraint};
|
||||
use crate::base::dimension::{Dim, DimAdd, DimSum, IsNotStaticOne, U1, U2, U3, Dynamic};
|
||||
use crate::base::dimension::{Dim, DimAdd, DimSum, Dynamic, IsNotStaticOne, U1, U2, U3};
|
||||
use crate::base::iter::{
|
||||
ColumnIter, ColumnIterMut, OwnedColumnIter, MatrixIter, MatrixIterMut, RowIter, RowIterMut, OwnedRowIter,
|
||||
ColumnIter, ColumnIterMut, MatrixIter, MatrixIterMut, OwnedColumnIter, OwnedRowIter, RowIter,
|
||||
RowIterMut,
|
||||
};
|
||||
use crate::base::storage::{
|
||||
ContiguousStorage, ContiguousStorageMut, SameShapeStorage, Storage, StorageMut, Owned
|
||||
ContiguousStorage, ContiguousStorageMut, Owned, SameShapeStorage, Storage, StorageMut,
|
||||
};
|
||||
use crate::base::{DefaultAllocator, MatrixMN, MatrixN, Scalar, Unit, VectorN};
|
||||
use crate::SimdComplexField;
|
||||
|
|
Loading…
Reference in New Issue