Remove use of deprecated *Slice aliases in nalgebra

This commit is contained in:
Andreas Longva 2022-11-14 09:33:08 +01:00
parent e245e1148a
commit 7d5097b0b2
5 changed files with 32 additions and 32 deletions

View File

@ -11,7 +11,7 @@ use crate::base::dimension::{Const, Dim, Dynamic, U1, U2, U3, U4};
use crate::base::storage::{Storage, StorageMut};
use crate::base::uninit::Init;
use crate::base::{
DVectorSlice, DefaultAllocator, Matrix, Scalar, SquareMatrix, Vector, VectorSlice,
DVectorView, DefaultAllocator, Matrix, Scalar, SquareMatrix, Vector, VectorView,
};
/// # Dot/scalar product
@ -363,8 +363,8 @@ where
x: &Vector<T, D3, SC>,
beta: T,
dot: impl Fn(
&DVectorSlice<'_, T, SB::RStride, SB::CStride>,
&DVectorSlice<'_, T, SC::RStride, SC::CStride>,
&DVectorView<'_, T, SB::RStride, SB::CStride>,
&DVectorView<'_, T, SC::RStride, SC::CStride>,
) -> T,
) where
T: One,
@ -506,7 +506,7 @@ where
a: &Matrix<T, R2, C2, SB>,
x: &Vector<T, D3, SC>,
beta: T,
dot: impl Fn(&VectorSlice<'_, T, R2, SB::RStride, SB::CStride>, &Vector<T, D3, SC>) -> T,
dot: impl Fn(&VectorView<'_, T, R2, SB::RStride, SB::CStride>, &Vector<T, D3, SC>) -> T,
) where
T: One,
SB: Storage<T, R2, C2>,

View File

@ -16,14 +16,14 @@ use crate::base::dimension::{
use crate::base::iter::{MatrixIter, MatrixIterMut};
use crate::base::storage::{IsContiguous, RawStorage, RawStorageMut};
use crate::base::{
ArrayStorage, DVectorSlice, DVectorSliceMut, DefaultAllocator, Matrix, MatrixView,
ArrayStorage, DVectorView, DVectorViewMut, DefaultAllocator, Matrix, MatrixView,
MatrixViewMut, OMatrix, Scalar,
};
#[cfg(any(feature = "std", feature = "alloc"))]
use crate::base::{DVector, RowDVector, VecStorage};
use crate::base::{ViewStorage, ViewStorageMut};
use crate::constraint::DimEq;
use crate::{IsNotStaticOne, RowSVector, SMatrix, SVector, VectorSlice, VectorSliceMut};
use crate::{IsNotStaticOne, RowSVector, SMatrix, SVector, VectorView, VectorViewMut};
use std::mem::MaybeUninit;
// TODO: too bad this won't work for slice conversions.
@ -126,19 +126,19 @@ impl<T: Scalar, const D: usize> From<SVector<T, D>> for [T; D] {
}
impl<'a, T: Scalar, RStride: Dim, CStride: Dim, const D: usize>
From<VectorSlice<'a, T, Const<D>, RStride, CStride>> for [T; D]
From<VectorView<'a, T, Const<D>, RStride, CStride>> for [T; D]
{
#[inline]
fn from(vec: VectorSlice<'a, T, Const<D>, RStride, CStride>) -> Self {
fn from(vec: VectorView<'a, T, Const<D>, RStride, CStride>) -> Self {
vec.into_owned().into()
}
}
impl<'a, T: Scalar, RStride: Dim, CStride: Dim, const D: usize>
From<VectorSliceMut<'a, T, Const<D>, RStride, CStride>> for [T; D]
From<VectorViewMut<'a, T, Const<D>, RStride, CStride>> for [T; D]
{
#[inline]
fn from(vec: VectorSliceMut<'a, T, Const<D>, RStride, CStride>) -> Self {
fn from(vec: VectorViewMut<'a, T, Const<D>, RStride, CStride>) -> Self {
vec.into_owned().into()
}
}
@ -515,28 +515,28 @@ impl<'a, T: Scalar + Copy, R: Dim, C: Dim, S: RawStorageMut<T, R, C> + IsContigu
}
}
impl<'a, T: Scalar + Copy> From<&'a [T]> for DVectorSlice<'a, T> {
impl<'a, T: Scalar + Copy> From<&'a [T]> for DVectorView<'a, T> {
#[inline]
fn from(slice: &'a [T]) -> Self {
Self::from_slice(slice, slice.len())
}
}
impl<'a, T: Scalar> From<DVectorSlice<'a, T>> for &'a [T] {
fn from(vec: DVectorSlice<'a, T>) -> &'a [T] {
impl<'a, T: Scalar> From<DVectorView<'a, T>> for &'a [T] {
fn from(vec: DVectorView<'a, T>) -> &'a [T] {
vec.data.into_slice()
}
}
impl<'a, T: Scalar + Copy> From<&'a mut [T]> for DVectorSliceMut<'a, T> {
impl<'a, T: Scalar + Copy> From<&'a mut [T]> for DVectorViewMut<'a, T> {
#[inline]
fn from(slice: &'a mut [T]) -> Self {
Self::from_slice(slice, slice.len())
}
}
impl<'a, T: Scalar> From<DVectorSliceMut<'a, T>> for &'a mut [T] {
fn from(vec: DVectorSliceMut<'a, T>) -> &'a mut [T] {
impl<'a, T: Scalar> From<DVectorViewMut<'a, T>> for &'a mut [T] {
fn from(vec: DVectorViewMut<'a, T>) -> &'a mut [T] {
vec.data.into_slice_mut()
}
}

View File

@ -14,7 +14,7 @@ use crate::base::constraint::{
use crate::base::dimension::{Dim, DimMul, DimName, DimProd, Dynamic};
use crate::base::storage::{Storage, StorageMut};
use crate::base::uninit::Uninit;
use crate::base::{DefaultAllocator, Matrix, MatrixSum, OMatrix, Scalar, VectorSlice};
use crate::base::{DefaultAllocator, Matrix, MatrixSum, OMatrix, Scalar, VectorView};
use crate::storage::IsContiguous;
use crate::uninit::{Init, InitStatus};
use crate::{RawStorage, RawStorageMut, SimdComplexField};
@ -703,8 +703,8 @@ where
rhs: &Matrix<T, R2, C2, SB>,
out: &mut Matrix<Status::Value, R3, C3, SC>,
dot: impl Fn(
&VectorSlice<'_, T, R1, SA::RStride, SA::CStride>,
&VectorSlice<'_, T, R2, SB::RStride, SB::CStride>,
&VectorView<'_, T, R1, SA::RStride, SA::CStride>,
&VectorView<'_, T, R2, SB::RStride, SB::CStride>,
) -> T,
) where
Status: InitStatus<T>,

View File

@ -1,6 +1,6 @@
use crate::allocator::Allocator;
use crate::storage::RawStorage;
use crate::{Const, DefaultAllocator, Dim, Matrix, OVector, RowOVector, Scalar, VectorSlice, U1};
use crate::{Const, DefaultAllocator, Dim, Matrix, OVector, RowOVector, Scalar, VectorView, U1};
use num::{One, Zero};
use simba::scalar::{ClosedAdd, ClosedMul, Field, SupersetOf};
use std::mem::MaybeUninit;
@ -13,7 +13,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: RawStorage<T, R, C>> Matrix<T, R, C, S> {
#[must_use]
pub fn compress_rows(
&self,
f: impl Fn(VectorSlice<'_, T, R, S::RStride, S::CStride>) -> T,
f: impl Fn(VectorView<'_, T, R, S::RStride, S::CStride>) -> T,
) -> RowOVector<T, C>
where
DefaultAllocator: Allocator<T, U1, C>,
@ -41,7 +41,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: RawStorage<T, R, C>> Matrix<T, R, C, S> {
#[must_use]
pub fn compress_rows_tr(
&self,
f: impl Fn(VectorSlice<'_, T, R, S::RStride, S::CStride>) -> T,
f: impl Fn(VectorView<'_, T, R, S::RStride, S::CStride>) -> T,
) -> OVector<T, C>
where
DefaultAllocator: Allocator<T, C>,
@ -67,7 +67,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: RawStorage<T, R, C>> Matrix<T, R, C, S> {
pub fn compress_columns(
&self,
init: OVector<T, R>,
f: impl Fn(&mut OVector<T, R>, VectorSlice<'_, T, R, S::RStride, S::CStride>),
f: impl Fn(&mut OVector<T, R>, VectorView<'_, T, R, S::RStride, S::CStride>),
) -> OVector<T, R>
where
DefaultAllocator: Allocator<T, R>,

View File

@ -5,7 +5,7 @@ use crate::base::allocator::Allocator;
use crate::base::constraint::{SameNumberOfRows, ShapeConstraint};
use crate::base::dimension::{Dim, U1};
use crate::base::storage::{Storage, StorageMut};
use crate::base::{DVectorSlice, DefaultAllocator, Matrix, OMatrix, SquareMatrix, Vector};
use crate::base::{DVectorView, DefaultAllocator, Matrix, OMatrix, SquareMatrix, Vector};
impl<T: ComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
/// Computes the solution of the linear system `self . x = b` where `x` is the unknown and only
@ -376,8 +376,8 @@ impl<T: ComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
b: &mut Vector<T, R2, S2>,
conjugate: impl Fn(T) -> T,
dot: impl Fn(
&DVectorSlice<'_, T, S::RStride, S::CStride>,
&DVectorSlice<'_, T, S2::RStride, S2::CStride>,
&DVectorView<'_, T, S::RStride, S::CStride>,
&DVectorView<'_, T, S2::RStride, S2::CStride>,
) -> T,
) -> bool
where
@ -411,8 +411,8 @@ impl<T: ComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
b: &mut Vector<T, R2, S2>,
conjugate: impl Fn(T) -> T,
dot: impl Fn(
&DVectorSlice<'_, T, S::RStride, S::CStride>,
&DVectorSlice<'_, T, S2::RStride, S2::CStride>,
&DVectorView<'_, T, S::RStride, S::CStride>,
&DVectorView<'_, T, S2::RStride, S2::CStride>,
) -> T,
) -> bool
where
@ -734,8 +734,8 @@ impl<T: SimdComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
b: &mut Vector<T, R2, S2>,
conjugate: impl Fn(T) -> T,
dot: impl Fn(
&DVectorSlice<'_, T, S::RStride, S::CStride>,
&DVectorSlice<'_, T, S2::RStride, S2::CStride>,
&DVectorView<'_, T, S::RStride, S::CStride>,
&DVectorView<'_, T, S2::RStride, S2::CStride>,
) -> T,
) where
S2: StorageMut<T, R2, U1>,
@ -760,8 +760,8 @@ impl<T: SimdComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
b: &mut Vector<T, R2, S2>,
conjugate: impl Fn(T) -> T,
dot: impl Fn(
&DVectorSlice<'_, T, S::RStride, S::CStride>,
&DVectorSlice<'_, T, S2::RStride, S2::CStride>,
&DVectorView<'_, T, S::RStride, S::CStride>,
&DVectorView<'_, T, S2::RStride, S2::CStride>,
) -> T,
) where
S2: StorageMut<T, R2, U1>,