Run cargo fmt.

This commit is contained in:
Avi Weinstock 2020-11-27 16:00:48 -05:00 committed by Crozet Sébastien
parent cd12422d6f
commit ee32f7d4cf
15 changed files with 109 additions and 51 deletions

View File

@ -1328,7 +1328,8 @@ where
ShapeConstraint: DimEq<D1, D1> + DimEq<D1, R3> + DimEq<C3, D4>, ShapeConstraint: DimEq<D1, D1> + DimEq<D1, R3> + DimEq<C3, D4>,
DefaultAllocator: Allocator<N, D1>, DefaultAllocator: Allocator<N, D1>,
{ {
let mut work = unsafe { crate::unimplemented_or_uninitialized_generic!(self.data.shape().0, U1) }; let mut work =
unsafe { crate::unimplemented_or_uninitialized_generic!(self.data.shape().0, U1) };
self.quadform_tr_with_workspace(&mut work, alpha, lhs, mid, beta) self.quadform_tr_with_workspace(&mut work, alpha, lhs, mid, beta)
} }
@ -1421,7 +1422,8 @@ where
ShapeConstraint: DimEq<D2, R3> + DimEq<D1, C3> + AreMultipliable<C3, R3, D2, U1>, ShapeConstraint: DimEq<D2, R3> + DimEq<D1, C3> + AreMultipliable<C3, R3, D2, U1>,
DefaultAllocator: Allocator<N, D2>, DefaultAllocator: Allocator<N, D2>,
{ {
let mut work = unsafe { crate::unimplemented_or_uninitialized_generic!(mid.data.shape().0, U1) }; let mut work =
unsafe { crate::unimplemented_or_uninitialized_generic!(mid.data.shape().0, U1) };
self.quadform_with_workspace(&mut work, alpha, mid, rhs, beta) self.quadform_with_workspace(&mut work, alpha, mid, rhs, beta)
} }
} }

View File

@ -50,7 +50,8 @@ where
let nrows2 = R2::from_usize(nrows); let nrows2 = R2::from_usize(nrows);
let ncols2 = C2::from_usize(ncols); let ncols2 = C2::from_usize(ncols);
let mut res: MatrixMN<N2, R2, C2> = unsafe { crate::unimplemented_or_uninitialized_generic!(nrows2, ncols2) }; let mut res: MatrixMN<N2, R2, C2> =
unsafe { crate::unimplemented_or_uninitialized_generic!(nrows2, ncols2) };
for i in 0..nrows { for i in 0..nrows {
for j in 0..ncols { for j in 0..ncols {
unsafe { unsafe {

View File

@ -161,7 +161,8 @@ where
#[cfg(feature = "no_unsound_assume_init")] #[cfg(feature = "no_unsound_assume_init")]
let mut res: ArrayStorage<N, RTo, CTo> = unimplemented!(); let mut res: ArrayStorage<N, RTo, CTo> = unimplemented!();
#[cfg(not(feature = "no_unsound_assume_init"))] #[cfg(not(feature = "no_unsound_assume_init"))]
let mut res = <Self as Allocator<N, RTo, CTo>>::allocate_uninitialized(rto, cto).assume_init(); let mut res =
<Self as Allocator<N, RTo, CTo>>::allocate_uninitialized(rto, cto).assume_init();
let (rfrom, cfrom) = buf.shape(); let (rfrom, cfrom) = buf.shape();
@ -192,7 +193,8 @@ where
#[cfg(feature = "no_unsound_assume_init")] #[cfg(feature = "no_unsound_assume_init")]
let mut res: VecStorage<N, Dynamic, CTo> = unimplemented!(); let mut res: VecStorage<N, Dynamic, CTo> = unimplemented!();
#[cfg(not(feature = "no_unsound_assume_init"))] #[cfg(not(feature = "no_unsound_assume_init"))]
let mut res = <Self as Allocator<N, Dynamic, CTo>>::allocate_uninitialized(rto, cto).assume_init(); let mut res =
<Self as Allocator<N, Dynamic, CTo>>::allocate_uninitialized(rto, cto).assume_init();
let (rfrom, cfrom) = buf.shape(); let (rfrom, cfrom) = buf.shape();
@ -223,7 +225,8 @@ where
#[cfg(feature = "no_unsound_assume_init")] #[cfg(feature = "no_unsound_assume_init")]
let mut res: VecStorage<N, RTo, Dynamic> = unimplemented!(); let mut res: VecStorage<N, RTo, Dynamic> = unimplemented!();
#[cfg(not(feature = "no_unsound_assume_init"))] #[cfg(not(feature = "no_unsound_assume_init"))]
let mut res = <Self as Allocator<N, RTo, Dynamic>>::allocate_uninitialized(rto, cto).assume_init(); let mut res =
<Self as Allocator<N, RTo, Dynamic>>::allocate_uninitialized(rto, cto).assume_init();
let (rfrom, cfrom) = buf.shape(); let (rfrom, cfrom) = buf.shape();

View File

@ -54,7 +54,9 @@ impl<N: Scalar + Zero, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
{ {
let irows = irows.into_iter(); let irows = irows.into_iter();
let ncols = self.data.shape().1; let ncols = self.data.shape().1;
let mut res = unsafe { crate::unimplemented_or_uninitialized_generic!(Dynamic::new(irows.len()), ncols) }; let mut res = unsafe {
crate::unimplemented_or_uninitialized_generic!(Dynamic::new(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.
@ -88,8 +90,9 @@ impl<N: Scalar + Zero, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
{ {
let icols = icols.into_iter(); let icols = icols.into_iter();
let nrows = self.data.shape().0; let nrows = self.data.shape().0;
let mut res = let mut res = unsafe {
unsafe { crate::unimplemented_or_uninitialized_generic!(nrows, Dynamic::new(icols.len())) }; crate::unimplemented_or_uninitialized_generic!(nrows, Dynamic::new(icols.len()))
};
for (destination, source) in icols.enumerate() { for (destination, source) in icols.enumerate() {
res.column_mut(destination).copy_from(&self.column(*source)) res.column_mut(destination).copy_from(&self.column(*source))
@ -895,7 +898,9 @@ impl<N: Scalar> DMatrix<N> {
where where
DefaultAllocator: Reallocator<N, Dynamic, Dynamic, Dynamic, Dynamic>, DefaultAllocator: Reallocator<N, Dynamic, Dynamic, Dynamic, Dynamic>,
{ {
let placeholder = unsafe { crate::unimplemented_or_uninitialized_generic!(Dynamic::new(0), Dynamic::new(0)) }; let placeholder = unsafe {
crate::unimplemented_or_uninitialized_generic!(Dynamic::new(0), Dynamic::new(0))
};
let old = mem::replace(self, placeholder); let old = mem::replace(self, placeholder);
let new = old.resize(new_nrows, new_ncols, val); let new = old.resize(new_nrows, new_ncols, val);
let _ = mem::replace(self, new); let _ = mem::replace(self, new);
@ -918,7 +923,9 @@ where
where where
DefaultAllocator: Reallocator<N, Dynamic, C, Dynamic, C>, DefaultAllocator: Reallocator<N, Dynamic, C, Dynamic, C>,
{ {
let placeholder = unsafe { crate::unimplemented_or_uninitialized_generic!(Dynamic::new(0), self.data.shape().1) }; let placeholder = unsafe {
crate::unimplemented_or_uninitialized_generic!(Dynamic::new(0), self.data.shape().1)
};
let old = mem::replace(self, placeholder); let old = mem::replace(self, placeholder);
let new = old.resize_vertically(new_nrows, val); let new = old.resize_vertically(new_nrows, val);
let _ = mem::replace(self, new); let _ = mem::replace(self, new);
@ -941,7 +948,9 @@ where
where where
DefaultAllocator: Reallocator<N, R, Dynamic, R, Dynamic>, DefaultAllocator: Reallocator<N, R, Dynamic, R, Dynamic>,
{ {
let placeholder = unsafe { crate::unimplemented_or_uninitialized_generic!(self.data.shape().0, Dynamic::new(0)) }; let placeholder = unsafe {
crate::unimplemented_or_uninitialized_generic!(self.data.shape().0, Dynamic::new(0))
};
let old = mem::replace(self, placeholder); let old = mem::replace(self, placeholder);
let new = old.resize_horizontally(new_ncols, val); let new = old.resize_horizontally(new_ncols, val);
let _ = mem::replace(self, new); let _ = mem::replace(self, new);

View File

@ -300,8 +300,12 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
/// Creates a new uninitialized matrix with the given uninitialized data /// Creates a new uninitialized matrix with the given uninitialized data
pub unsafe fn from_uninitialized_data(data: mem::MaybeUninit<S>) -> mem::MaybeUninit<Self> { pub unsafe fn from_uninitialized_data(data: mem::MaybeUninit<S>) -> mem::MaybeUninit<Self> {
let res: Matrix<N, R, C, mem::MaybeUninit<S>> = Matrix { data, _phantoms: PhantomData }; let res: Matrix<N, R, C, mem::MaybeUninit<S>> = Matrix {
let res: mem::MaybeUninit<Matrix<N, R, C, mem::MaybeUninit<S>>> = mem::MaybeUninit::new(res); data,
_phantoms: PhantomData,
};
let res: mem::MaybeUninit<Matrix<N, R, C, mem::MaybeUninit<S>>> =
mem::MaybeUninit::new(res);
// safety: since we wrap the inner MaybeUninit in an outer MaybeUninit above, the fact that the `data` field is partially-uninitialized is still opaque. // safety: since we wrap the inner MaybeUninit in an outer MaybeUninit above, the fact that the `data` field is partially-uninitialized is still opaque.
// with s/transmute_copy/transmute/, rustc claims that `MaybeUninit<Matrix<N, R, C, MaybeUninit<S>>>` may be of a different size from `MaybeUninit<Matrix<N, R, C, S>>` // with s/transmute_copy/transmute/, rustc claims that `MaybeUninit<Matrix<N, R, C, MaybeUninit<S>>>` may be of a different size from `MaybeUninit<Matrix<N, R, C, S>>`
// but MaybeUninit's documentation says "MaybeUninit<T> is guaranteed to have the same size, alignment, and ABI as T", which implies those types should be the same size // but MaybeUninit's documentation says "MaybeUninit<T> is guaranteed to have the same size, alignment, and ABI as T", which implies those types should be the same size
@ -507,7 +511,8 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
let nrows: SameShapeR<R, R2> = Dim::from_usize(nrows); let nrows: SameShapeR<R, R2> = Dim::from_usize(nrows);
let ncols: SameShapeC<C, C2> = Dim::from_usize(ncols); let ncols: SameShapeC<C, C2> = Dim::from_usize(ncols);
let mut res: MatrixSum<N, R, C, R2, C2> = unsafe { crate::unimplemented_or_uninitialized_generic!(nrows, ncols) }; let mut res: MatrixSum<N, R, C, R2, C2> =
unsafe { crate::unimplemented_or_uninitialized_generic!(nrows, ncols) };
// TODO: use copy_from // TODO: use copy_from
for j in 0..res.ncols() { for j in 0..res.ncols() {
@ -574,7 +579,8 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
{ {
let (nrows, ncols) = self.data.shape(); let (nrows, ncols) = self.data.shape();
let mut res: MatrixMN<N2, R, C> = unsafe { crate::unimplemented_or_uninitialized_generic!(nrows, ncols) }; let mut res: MatrixMN<N2, R, C> =
unsafe { crate::unimplemented_or_uninitialized_generic!(nrows, ncols) };
for j in 0..ncols.value() { for j in 0..ncols.value() {
for i in 0..nrows.value() { for i in 0..nrows.value() {
@ -618,7 +624,8 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
{ {
let (nrows, ncols) = self.data.shape(); let (nrows, ncols) = self.data.shape();
let mut res: MatrixMN<N2, R, C> = unsafe { crate::unimplemented_or_uninitialized_generic!(nrows, ncols) }; let mut res: MatrixMN<N2, R, C> =
unsafe { crate::unimplemented_or_uninitialized_generic!(nrows, ncols) };
for j in 0..ncols.value() { for j in 0..ncols.value() {
for i in 0..nrows.value() { for i in 0..nrows.value() {
@ -645,7 +652,8 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
{ {
let (nrows, ncols) = self.data.shape(); let (nrows, ncols) = self.data.shape();
let mut res: MatrixMN<N3, R, C> = unsafe { crate::unimplemented_or_uninitialized_generic!(nrows, ncols) }; let mut res: MatrixMN<N3, R, C> =
unsafe { crate::unimplemented_or_uninitialized_generic!(nrows, ncols) };
assert_eq!( assert_eq!(
(nrows.value(), ncols.value()), (nrows.value(), ncols.value()),
@ -686,7 +694,8 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
{ {
let (nrows, ncols) = self.data.shape(); let (nrows, ncols) = self.data.shape();
let mut res: MatrixMN<N4, R, C> = unsafe { crate::unimplemented_or_uninitialized_generic!(nrows, ncols) }; let mut res: MatrixMN<N4, R, C> =
unsafe { crate::unimplemented_or_uninitialized_generic!(nrows, ncols) };
assert_eq!( assert_eq!(
(nrows.value(), ncols.value()), (nrows.value(), ncols.value()),
@ -1180,7 +1189,8 @@ impl<N: SimdComplexField, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S
let (nrows, ncols) = self.data.shape(); let (nrows, ncols) = self.data.shape();
unsafe { unsafe {
let mut res: MatrixMN<_, C, R> = crate::unimplemented_or_uninitialized_generic!(ncols, nrows); let mut res: MatrixMN<_, C, R> =
crate::unimplemented_or_uninitialized_generic!(ncols, nrows);
self.adjoint_to(&mut res); self.adjoint_to(&mut res);
res res
@ -1321,7 +1331,8 @@ impl<N: Scalar, D: Dim, S: Storage<N, D, D>> SquareMatrix<N, D, S> {
); );
let dim = self.data.shape().0; let dim = self.data.shape().0;
let mut res: VectorN<N2, D> = unsafe { crate::unimplemented_or_uninitialized_generic!(dim, U1) }; let mut res: VectorN<N2, D> =
unsafe { crate::unimplemented_or_uninitialized_generic!(dim, U1) };
for i in 0..dim.value() { for i in 0..dim.value() {
unsafe { unsafe {
@ -1448,7 +1459,8 @@ impl<N: Scalar + Zero, D: DimAdd<U1>, S: Storage<N, D>> Vector<N, D, S> {
{ {
let len = self.len(); let len = self.len();
let hnrows = DimSum::<D, U1>::from_usize(len + 1); let hnrows = DimSum::<D, U1>::from_usize(len + 1);
let mut res: VectorN::<N, _> = unsafe { crate::unimplemented_or_uninitialized_generic!(hnrows, U1) }; let mut res: VectorN<N, _> =
unsafe { crate::unimplemented_or_uninitialized_generic!(hnrows, U1) };
res.generic_slice_mut((0, 0), self.data.shape()) res.generic_slice_mut((0, 0), self.data.shape())
.copy_from(self); .copy_from(self);
res[(len, 0)] = element; res[(len, 0)] = element;
@ -1793,7 +1805,8 @@ impl<N: Scalar + ClosedAdd + ClosedSub + ClosedMul, R: Dim, C: Dim, S: Storage<N
// TODO: soooo ugly! // TODO: soooo ugly!
let nrows = SameShapeR::<R, R2>::from_usize(3); let nrows = SameShapeR::<R, R2>::from_usize(3);
let ncols = SameShapeC::<C, C2>::from_usize(1); let ncols = SameShapeC::<C, C2>::from_usize(1);
let mut res: MatrixCross<N, R, C, R2, C2> = crate::unimplemented_or_uninitialized_generic!(nrows, ncols); let mut res: MatrixCross<N, R, C, R2, C2> =
crate::unimplemented_or_uninitialized_generic!(nrows, ncols);
let ax = self.get_unchecked((0, 0)); let ax = self.get_unchecked((0, 0));
let ay = self.get_unchecked((1, 0)); let ay = self.get_unchecked((1, 0));
@ -1817,7 +1830,8 @@ impl<N: Scalar + ClosedAdd + ClosedSub + ClosedMul, R: Dim, C: Dim, S: Storage<N
// TODO: ugly! // TODO: ugly!
let nrows = SameShapeR::<R, R2>::from_usize(1); let nrows = SameShapeR::<R, R2>::from_usize(1);
let ncols = SameShapeC::<C, C2>::from_usize(3); let ncols = SameShapeC::<C, C2>::from_usize(3);
let mut res: MatrixCross<N, R, C, R2, C2> = crate::unimplemented_or_uninitialized_generic!(nrows, ncols); let mut res: MatrixCross<N, R, C, R2, C2> =
crate::unimplemented_or_uninitialized_generic!(nrows, ncols);
let ax = self.get_unchecked((0, 0)); let ax = self.get_unchecked((0, 0));
let ay = self.get_unchecked((0, 1)); let ay = self.get_unchecked((0, 1));

View File

@ -15,7 +15,8 @@ mod alias_slice;
mod array_storage; mod array_storage;
mod cg; mod cg;
mod componentwise; mod componentwise;
#[macro_use] mod construction; #[macro_use]
mod construction;
mod construction_slice; mod construction_slice;
mod conversion; mod conversion;
mod edition; mod edition;

View File

@ -573,7 +573,9 @@ where
#[inline] #[inline]
fn mul(self, rhs: &'b Matrix<N, R2, C2, SB>) -> Self::Output { fn mul(self, rhs: &'b Matrix<N, R2, C2, SB>) -> Self::Output {
let mut res = unsafe { crate::unimplemented_or_uninitialized_generic!(self.data.shape().0, rhs.data.shape().1) }; let mut res = unsafe {
crate::unimplemented_or_uninitialized_generic!(self.data.shape().0, rhs.data.shape().1)
};
self.mul_to(rhs, &mut res); self.mul_to(rhs, &mut res);
res res
} }
@ -682,7 +684,9 @@ where
DefaultAllocator: Allocator<N, C1, C2>, DefaultAllocator: Allocator<N, C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>, ShapeConstraint: SameNumberOfRows<R1, R2>,
{ {
let mut res = unsafe { crate::unimplemented_or_uninitialized_generic!(self.data.shape().1, rhs.data.shape().1) }; let mut res = unsafe {
crate::unimplemented_or_uninitialized_generic!(self.data.shape().1, rhs.data.shape().1)
};
self.tr_mul_to(rhs, &mut res); self.tr_mul_to(rhs, &mut res);
res res
@ -697,7 +701,9 @@ where
DefaultAllocator: Allocator<N, C1, C2>, DefaultAllocator: Allocator<N, C1, C2>,
ShapeConstraint: SameNumberOfRows<R1, R2>, ShapeConstraint: SameNumberOfRows<R1, R2>,
{ {
let mut res = unsafe { crate::unimplemented_or_uninitialized_generic!(self.data.shape().1, rhs.data.shape().1) }; let mut res = unsafe {
crate::unimplemented_or_uninitialized_generic!(self.data.shape().1, rhs.data.shape().1)
};
self.ad_mul_to(rhs, &mut res); self.ad_mul_to(rhs, &mut res);
res res
@ -811,7 +817,9 @@ where
let (nrows1, ncols1) = self.data.shape(); let (nrows1, ncols1) = self.data.shape();
let (nrows2, ncols2) = rhs.data.shape(); let (nrows2, ncols2) = rhs.data.shape();
let mut res = unsafe { crate::unimplemented_or_uninitialized_generic!(nrows1.mul(nrows2), ncols1.mul(ncols2)) }; let mut res = unsafe {
crate::unimplemented_or_uninitialized_generic!(nrows1.mul(nrows2), ncols1.mul(ncols2))
};
{ {
let mut data_res = res.data.ptr_mut(); let mut data_res = res.data.ptr_mut();

View File

@ -17,7 +17,8 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
DefaultAllocator: Allocator<N, U1, C>, DefaultAllocator: Allocator<N, U1, C>,
{ {
let ncols = self.data.shape().1; let ncols = self.data.shape().1;
let mut res: RowVectorN<N, C> = unsafe { crate::unimplemented_or_uninitialized_generic!(U1, ncols) }; let mut res: RowVectorN<N, C> =
unsafe { crate::unimplemented_or_uninitialized_generic!(U1, ncols) };
for i in 0..ncols.value() { for i in 0..ncols.value() {
// TODO: avoid bound checking of column. // TODO: avoid bound checking of column.
@ -42,7 +43,8 @@ impl<N: Scalar, R: Dim, C: Dim, S: Storage<N, R, C>> Matrix<N, R, C, S> {
DefaultAllocator: Allocator<N, C>, DefaultAllocator: Allocator<N, C>,
{ {
let ncols = self.data.shape().1; let ncols = self.data.shape().1;
let mut res: VectorN<N, C> = unsafe { crate::unimplemented_or_uninitialized_generic!(ncols, U1) }; let mut res: VectorN<N, C> =
unsafe { crate::unimplemented_or_uninitialized_generic!(ncols, U1) };
for i in 0..ncols.value() { for i in 0..ncols.value() {
// TODO: avoid bound checking of column. // TODO: avoid bound checking of column.

View File

@ -181,7 +181,12 @@ where
D: DimNameAdd<U1>, D: DimNameAdd<U1>,
DefaultAllocator: Allocator<N, DimNameSum<D, U1>>, DefaultAllocator: Allocator<N, DimNameSum<D, U1>>,
{ {
let mut res = unsafe { crate::unimplemented_or_uninitialized_generic!(<DimNameSum<D, U1> as DimName>::name(), U1) }; let mut res = unsafe {
crate::unimplemented_or_uninitialized_generic!(
<DimNameSum<D, U1> as DimName>::name(),
U1
)
};
res.fixed_slice_mut::<D, U1>(0, 0).copy_from(&self.coords); res.fixed_slice_mut::<D, U1>(0, 0).copy_from(&self.coords);
res[(D::dim(), 0)] = N::one(); res[(D::dim(), 0)] = N::one();

View File

@ -24,7 +24,10 @@ where
/// Creates a new point with uninitialized coordinates. /// Creates a new point with uninitialized coordinates.
#[inline] #[inline]
pub unsafe fn new_uninitialized() -> Self { pub unsafe fn new_uninitialized() -> Self {
Self::from(crate::unimplemented_or_uninitialized_generic!(D::name(), U1)) Self::from(crate::unimplemented_or_uninitialized_generic!(
D::name(),
U1
))
} }
/// Creates a new point with all coordinates equal to zero. /// Creates a new point with all coordinates equal to zero.

View File

@ -81,7 +81,8 @@ where
"Cannot compute the bidiagonalization of an empty matrix." "Cannot compute the bidiagonalization of an empty matrix."
); );
let mut diagonal = unsafe { crate::unimplemented_or_uninitialized_generic!(min_nrows_ncols, U1) }; let mut diagonal =
unsafe { crate::unimplemented_or_uninitialized_generic!(min_nrows_ncols, U1) };
let mut off_diagonal = let mut off_diagonal =
unsafe { crate::unimplemented_or_uninitialized_generic!(min_nrows_ncols.sub(U1), U1) }; unsafe { crate::unimplemented_or_uninitialized_generic!(min_nrows_ncols.sub(U1), U1) };
let mut axis_packed = unsafe { crate::unimplemented_or_uninitialized_generic!(ncols, U1) }; let mut axis_packed = unsafe { crate::unimplemented_or_uninitialized_generic!(ncols, U1) };
@ -239,7 +240,8 @@ where
let min_nrows_ncols = nrows.min(ncols); let min_nrows_ncols = nrows.min(ncols);
let mut res = Matrix::identity_generic(min_nrows_ncols, ncols); let mut res = Matrix::identity_generic(min_nrows_ncols, ncols);
let mut work = unsafe { crate::unimplemented_or_uninitialized_generic!(min_nrows_ncols, U1) }; let mut work =
unsafe { crate::unimplemented_or_uninitialized_generic!(min_nrows_ncols, U1) };
let mut axis_packed = unsafe { crate::unimplemented_or_uninitialized_generic!(ncols, U1) }; let mut axis_packed = unsafe { crate::unimplemented_or_uninitialized_generic!(ncols, U1) };
let shift = self.axis_shift().1; let shift = self.axis_shift().1;

View File

@ -48,7 +48,8 @@ where
{ {
/// Computes the Hessenberg decomposition using householder reflections. /// Computes the Hessenberg decomposition using householder reflections.
pub fn new(hess: MatrixN<N, D>) -> Self { pub fn new(hess: MatrixN<N, D>) -> Self {
let mut work = unsafe { crate::unimplemented_or_uninitialized_generic!(hess.data.shape().0, U1) }; let mut work =
unsafe { crate::unimplemented_or_uninitialized_generic!(hess.data.shape().0, U1) };
Self::new_with_workspace(hess, &mut work) Self::new_with_workspace(hess, &mut work)
} }
@ -74,7 +75,8 @@ where
"Hessenberg: invalid workspace size." "Hessenberg: invalid workspace size."
); );
let mut subdiag = unsafe { crate::unimplemented_or_uninitialized_generic!(dim.sub(U1), U1) }; let mut subdiag =
unsafe { crate::unimplemented_or_uninitialized_generic!(dim.sub(U1), U1) };
if dim.value() == 0 { if dim.value() == 0 {
return Hessenberg { hess, subdiag }; return Hessenberg { hess, subdiag };

View File

@ -54,7 +54,8 @@ where
let (nrows, ncols) = matrix.data.shape(); let (nrows, ncols) = matrix.data.shape();
let min_nrows_ncols = nrows.min(ncols); let min_nrows_ncols = nrows.min(ncols);
let mut diag = unsafe { crate::unimplemented_or_uninitialized_generic!(min_nrows_ncols, U1) }; let mut diag =
unsafe { crate::unimplemented_or_uninitialized_generic!(min_nrows_ncols, U1) };
if min_nrows_ncols.value() == 0 { if min_nrows_ncols.value() == 0 {
return QR { qr: matrix, diag }; return QR { qr: matrix, diag };

View File

@ -71,7 +71,8 @@ where
/// number of iteration is exceeded, `None` is returned. If `niter == 0`, then the algorithm /// number of iteration is exceeded, `None` is returned. If `niter == 0`, then the algorithm
/// continues indefinitely until convergence. /// continues indefinitely until convergence.
pub fn try_new(m: MatrixN<N, D>, eps: N::RealField, max_niter: usize) -> Option<Self> { pub fn try_new(m: MatrixN<N, D>, eps: N::RealField, max_niter: usize) -> Option<Self> {
let mut work = unsafe { crate::unimplemented_or_uninitialized_generic!(m.data.shape().0, U1) }; let mut work =
unsafe { crate::unimplemented_or_uninitialized_generic!(m.data.shape().0, U1) };
Self::do_decompose(m, &mut work, eps, max_niter, true) Self::do_decompose(m, &mut work, eps, max_niter, true)
.map(|(q, t)| Schur { q: q.unwrap(), t }) .map(|(q, t)| Schur { q: q.unwrap(), t })
@ -378,7 +379,8 @@ where
/// ///
/// Return `None` if some eigenvalues are complex. /// Return `None` if some eigenvalues are complex.
pub fn eigenvalues(&self) -> Option<VectorN<N, D>> { pub fn eigenvalues(&self) -> Option<VectorN<N, D>> {
let mut out = unsafe { crate::unimplemented_or_uninitialized_generic!(self.t.data.shape().0, U1) }; let mut out =
unsafe { crate::unimplemented_or_uninitialized_generic!(self.t.data.shape().0, U1) };
if Self::do_eigenvalues(&self.t, &mut out) { if Self::do_eigenvalues(&self.t, &mut out) {
Some(out) Some(out)
} else { } else {
@ -392,7 +394,8 @@ where
N: RealField, N: RealField,
DefaultAllocator: Allocator<NumComplex<N>, D>, DefaultAllocator: Allocator<NumComplex<N>, D>,
{ {
let mut out = unsafe { crate::unimplemented_or_uninitialized_generic!(self.t.data.shape().0, U1) }; let mut out =
unsafe { crate::unimplemented_or_uninitialized_generic!(self.t.data.shape().0, U1) };
Self::do_complex_eigenvalues(&self.t, &mut out); Self::do_complex_eigenvalues(&self.t, &mut out);
out out
} }
@ -503,7 +506,8 @@ where
"Unable to compute eigenvalues of a non-square matrix." "Unable to compute eigenvalues of a non-square matrix."
); );
let mut work = unsafe { crate::unimplemented_or_uninitialized_generic!(self.data.shape().0, U1) }; let mut work =
unsafe { crate::unimplemented_or_uninitialized_generic!(self.data.shape().0, U1) };
// Special case for 2x2 matrices. // Special case for 2x2 matrices.
if self.nrows() == 2 { if self.nrows() == 2 {

View File

@ -61,7 +61,8 @@ where
"Unable to compute the symmetric tridiagonal decomposition of an empty matrix." "Unable to compute the symmetric tridiagonal decomposition of an empty matrix."
); );
let mut off_diagonal = unsafe { crate::unimplemented_or_uninitialized_generic!(dim.sub(U1), U1) }; let mut off_diagonal =
unsafe { crate::unimplemented_or_uninitialized_generic!(dim.sub(U1), U1) };
let mut p = unsafe { crate::unimplemented_or_uninitialized_generic!(dim.sub(U1), U1) }; let mut p = unsafe { crate::unimplemented_or_uninitialized_generic!(dim.sub(U1), U1) };
for i in 0..dim.value() - 1 { for i in 0..dim.value() - 1 {