Merge pull request #1178 from Andlon/rename_slice_to_view

Rename slice to view
This commit is contained in:
Sébastien Crozet 2022-12-18 15:27:15 +01:00 committed by GitHub
commit 14f316c9d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 1679 additions and 731 deletions

View File

@ -53,7 +53,7 @@ fn mat_div_scalar(b: &mut criterion::Criterion) {
b.bench_function("mat_div_scalar", move |bh| {
bh.iter(|| {
let mut aa = a.clone();
let mut b = aa.slice_mut((0, 0), (1000, 1000));
let mut b = aa.view_mut((0, 0), (1000, 1000));
b /= n
})
});

View File

@ -93,6 +93,6 @@ pub fn mat3_to_quat<T: RealNumber>(x: &TMat3<T>) -> Qua<T> {
/// Converts a rotation matrix in homogeneous coordinates to a quaternion.
pub fn to_quat<T: RealNumber>(x: &TMat4<T>) -> Qua<T> {
let rot = x.fixed_slice::<3, 3>(0, 0).into_owned();
let rot = x.fixed_view::<3, 3>(0, 0).into_owned();
mat3_to_quat(&rot)
}

View File

@ -7,7 +7,7 @@ pub fn proj2d<T: Number>(m: &TMat3<T>, normal: &TVec2<T>) -> TMat3<T> {
let mut res = TMat3::identity();
{
let mut part = res.fixed_slice_mut::<2, 2>(0, 0);
let mut part = res.fixed_view_mut::<2, 2>(0, 0);
part -= normal * normal.transpose();
}
@ -19,7 +19,7 @@ pub fn proj<T: Number>(m: &TMat4<T>, normal: &TVec3<T>) -> TMat4<T> {
let mut res = TMat4::identity();
{
let mut part = res.fixed_slice_mut::<3, 3>(0, 0);
let mut part = res.fixed_view_mut::<3, 3>(0, 0);
part -= normal * normal.transpose();
}
@ -31,7 +31,7 @@ pub fn reflect2d<T: RealNumber>(m: &TMat3<T>, normal: &TVec2<T>) -> TMat3<T> {
let mut res = TMat3::identity();
{
let mut part = res.fixed_slice_mut::<2, 2>(0, 0);
let mut part = res.fixed_view_mut::<2, 2>(0, 0);
part -= (normal * T::from_subset(&2.0)) * normal.transpose();
}
@ -43,7 +43,7 @@ pub fn reflect<T: RealNumber>(m: &TMat4<T>, normal: &TVec3<T>) -> TMat4<T> {
let mut res = TMat4::identity();
{
let mut part = res.fixed_slice_mut::<3, 3>(0, 0);
let mut part = res.fixed_view_mut::<3, 3>(0, 0);
part -= (normal * T::from_subset(&2.0)) * normal.transpose();
}

View File

@ -126,7 +126,7 @@ where
let mut q = self
.qr
.generic_slice((0, 0), (nrows, min_nrows_ncols))
.generic_view((0, 0), (nrows, min_nrows_ncols))
.into_owned();
let mut info = 0;

View File

@ -157,7 +157,7 @@ macro_rules! svd_impl(
let mut res: OMatrix<_, R, C> = Matrix::zeros_generic(nrows, ncols);
{
let mut sres = res.generic_slice_mut((0, 0), (min_nrows_ncols, ncols));
let mut sres = res.generic_view_mut((0, 0), (min_nrows_ncols, ncols));
sres.copy_from(&self.vt.rows_generic(0, min_nrows_ncols));
for i in 0 .. min_nrows_ncols.value() {
@ -183,7 +183,7 @@ macro_rules! svd_impl(
let mut res: OMatrix<_, C, R> = Matrix::zeros_generic(ncols, nrows);
{
let mut sres = res.generic_slice_mut((0, 0), (min_nrows_ncols, nrows));
let mut sres = res.generic_view_mut((0, 0), (min_nrows_ncols, nrows));
self.u.columns_generic(0, min_nrows_ncols).transpose_to(&mut sres);
for i in 0 .. min_nrows_ncols.value() {

View File

@ -3,7 +3,7 @@ use crate::ops::serial::spsolve_csc_lower_triangular;
use crate::ops::Op;
use crate::pattern::SparsityPattern;
use core::{iter, mem};
use nalgebra::{DMatrix, DMatrixSlice, DMatrixSliceMut, RealField};
use nalgebra::{DMatrix, DMatrixView, DMatrixViewMut, RealField};
use std::fmt::{Display, Formatter};
/// A symbolic sparse Cholesky factorization of a CSC matrix.
@ -264,7 +264,7 @@ impl<T: RealField> CscCholesky<T> {
///
/// Panics if `B` is not square.
#[must_use = "Did you mean to use solve_mut()?"]
pub fn solve<'a>(&'a self, b: impl Into<DMatrixSlice<'a, T>>) -> DMatrix<T> {
pub fn solve<'a>(&'a self, b: impl Into<DMatrixView<'a, T>>) -> DMatrix<T> {
let b = b.into();
let mut output = b.clone_owned();
self.solve_mut(&mut output);
@ -278,7 +278,7 @@ impl<T: RealField> CscCholesky<T> {
/// # Panics
///
/// Panics if `b` is not square.
pub fn solve_mut<'a>(&'a self, b: impl Into<DMatrixSliceMut<'a, T>>) {
pub fn solve_mut<'a>(&'a self, b: impl Into<DMatrixViewMut<'a, T>>) {
let expect_msg = "If the Cholesky factorization succeeded,\
then the triangular solve should never fail";
// Solve LY = B

View File

@ -2,7 +2,7 @@ use crate::cs::CsMatrix;
use crate::ops::serial::{OperationError, OperationErrorKind};
use crate::ops::Op;
use crate::SparseEntryMut;
use nalgebra::{ClosedAdd, ClosedMul, DMatrixSlice, DMatrixSliceMut, Scalar};
use nalgebra::{ClosedAdd, ClosedMul, DMatrixView, DMatrixViewMut, Scalar};
use num_traits::{One, Zero};
fn spmm_cs_unexpected_entry() -> OperationError {
@ -176,10 +176,10 @@ where
/// the transposed operation must be specified for the CSC matrix.
pub fn spmm_cs_dense<T>(
beta: T,
mut c: DMatrixSliceMut<'_, T>,
mut c: DMatrixViewMut<'_, T>,
alpha: T,
a: Op<&CsMatrix<T>>,
b: Op<DMatrixSlice<'_, T>>,
b: Op<DMatrixView<'_, T>>,
) where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
{

View File

@ -4,7 +4,7 @@ use crate::ops::serial::cs::{
};
use crate::ops::serial::{OperationError, OperationErrorKind};
use crate::ops::Op;
use nalgebra::{ClosedAdd, ClosedMul, DMatrixSlice, DMatrixSliceMut, RealField, Scalar};
use nalgebra::{ClosedAdd, ClosedMul, DMatrixView, DMatrixViewMut, RealField, Scalar};
use num_traits::{One, Zero};
use std::borrow::Cow;
@ -16,10 +16,10 @@ use std::borrow::Cow;
/// Panics if the dimensions of the matrices involved are not compatible with the expression.
pub fn spmm_csc_dense<'a, T>(
beta: T,
c: impl Into<DMatrixSliceMut<'a, T>>,
c: impl Into<DMatrixViewMut<'a, T>>,
alpha: T,
a: Op<&CscMatrix<T>>,
b: Op<impl Into<DMatrixSlice<'a, T>>>,
b: Op<impl Into<DMatrixView<'a, T>>>,
) where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
{
@ -29,10 +29,10 @@ pub fn spmm_csc_dense<'a, T>(
fn spmm_csc_dense_<T>(
beta: T,
c: DMatrixSliceMut<'_, T>,
c: DMatrixViewMut<'_, T>,
alpha: T,
a: Op<&CscMatrix<T>>,
b: Op<DMatrixSlice<'_, T>>,
b: Op<DMatrixView<'_, T>>,
) where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
{
@ -173,7 +173,7 @@ where
/// Panics if `L` is not square, or if `L` and `B` are not dimensionally compatible.
pub fn spsolve_csc_lower_triangular<'a, T: RealField>(
l: Op<&CscMatrix<T>>,
b: impl Into<DMatrixSliceMut<'a, T>>,
b: impl Into<DMatrixViewMut<'a, T>>,
) -> Result<(), OperationError> {
let b = b.into();
let l_matrix = l.into_inner();
@ -195,7 +195,7 @@ pub fn spsolve_csc_lower_triangular<'a, T: RealField>(
fn spsolve_csc_lower_triangular_no_transpose<T: RealField>(
l: &CscMatrix<T>,
b: DMatrixSliceMut<'_, T>,
b: DMatrixViewMut<'_, T>,
) -> Result<(), OperationError> {
let mut x = b;
@ -253,7 +253,7 @@ fn spsolve_encountered_zero_diagonal() -> Result<(), OperationError> {
fn spsolve_csc_lower_triangular_transpose<T: RealField>(
l: &CscMatrix<T>,
b: DMatrixSliceMut<'_, T>,
b: DMatrixViewMut<'_, T>,
) -> Result<(), OperationError> {
let mut x = b;

View File

@ -4,17 +4,17 @@ use crate::ops::serial::cs::{
};
use crate::ops::serial::OperationError;
use crate::ops::Op;
use nalgebra::{ClosedAdd, ClosedMul, DMatrixSlice, DMatrixSliceMut, Scalar};
use nalgebra::{ClosedAdd, ClosedMul, DMatrixView, DMatrixViewMut, Scalar};
use num_traits::{One, Zero};
use std::borrow::Cow;
/// Sparse-dense matrix-matrix multiplication `C <- beta * C + alpha * op(A) * op(B)`.
pub fn spmm_csr_dense<'a, T>(
beta: T,
c: impl Into<DMatrixSliceMut<'a, T>>,
c: impl Into<DMatrixViewMut<'a, T>>,
alpha: T,
a: Op<&CsrMatrix<T>>,
b: Op<impl Into<DMatrixSlice<'a, T>>>,
b: Op<impl Into<DMatrixView<'a, T>>>,
) where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
{
@ -24,10 +24,10 @@ pub fn spmm_csr_dense<'a, T>(
fn spmm_csr_dense_<T>(
beta: T,
c: DMatrixSliceMut<'_, T>,
c: DMatrixViewMut<'_, T>,
alpha: T,
a: Op<&CsrMatrix<T>>,
b: Op<DMatrixSlice<'_, T>>,
b: Op<DMatrixView<'_, T>>,
) where
T: Scalar + ClosedAdd + ClosedMul + Zero + One,
{

View File

@ -348,8 +348,8 @@ fn coo_push_matrix_valid_entries() {
// Works with sliced
{
let source = nalgebra::SMatrix::<i32, 2, 2>::new(6, 7, 8, 9);
let sliced = source.fixed_slice::<2, 1>(0, 0);
coo.push_matrix(1, 0, &sliced);
let view = source.fixed_view::<2, 1>(0, 0);
coo.push_matrix(1, 0, &view);
assert_eq!(
coo.triplet_iter().collect::<Vec<_>>(),

View File

@ -14,7 +14,7 @@ use nalgebra_sparse::pattern::SparsityPattern;
use nalgebra_sparse::proptest::{csc, csr, sparsity_pattern};
use nalgebra::proptest::{matrix, vector};
use nalgebra::{DMatrix, DMatrixSlice, DMatrixSliceMut, Scalar};
use nalgebra::{DMatrix, DMatrixView, DMatrixViewMut, Scalar};
use proptest::prelude::*;
@ -333,10 +333,10 @@ fn csc_square_with_non_zero_diagonals() -> impl Strategy<Value = CscMatrix<f64>>
/// Helper function to help us call dense GEMM with our `Op` type
fn dense_gemm<'a>(
beta: i32,
c: impl Into<DMatrixSliceMut<'a, i32>>,
c: impl Into<DMatrixViewMut<'a, i32>>,
alpha: i32,
a: Op<impl Into<DMatrixSlice<'a, i32>>>,
b: Op<impl Into<DMatrixSlice<'a, i32>>>,
a: Op<impl Into<DMatrixView<'a, i32>>>,
b: Op<impl Into<DMatrixView<'a, i32>>>,
) {
let mut c = c.into();
let a = a.convert();

View File

@ -1,6 +1,7 @@
use crate::base::dimension::{Dynamic, U1, U2, U3, U4, U5, U6};
use crate::base::matrix_slice::{SliceStorage, SliceStorageMut};
use crate::base::matrix_view::{ViewStorage, ViewStorageMut};
use crate::base::{Const, Matrix};
use crate::slice_deprecation_note;
/*
*
@ -13,286 +14,345 @@ use crate::base::{Const, Matrix};
/// A column-major matrix slice with dimensions known at compile-time.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(SMatrixView)]
pub type SMatrixSlice<'a, T, const R: usize, const C: usize> =
Matrix<T, Const<R>, Const<C>, SliceStorage<'a, T, Const<R>, Const<C>, Const<1>, Const<R>>>;
Matrix<T, Const<R>, Const<C>, ViewStorage<'a, T, Const<R>, Const<C>, Const<1>, Const<R>>>;
/// A column-major matrix slice dynamic numbers of rows and columns.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(DMatrixView)]
pub type DMatrixSlice<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, Dynamic, SliceStorage<'a, T, Dynamic, Dynamic, RStride, CStride>>;
Matrix<T, Dynamic, Dynamic, ViewStorage<'a, T, Dynamic, Dynamic, RStride, CStride>>;
/// A column-major 1x1 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView1)]
pub type MatrixSlice1<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U1, SliceStorage<'a, T, U1, U1, RStride, CStride>>;
Matrix<T, U1, U1, ViewStorage<'a, T, U1, U1, RStride, CStride>>;
/// A column-major 2x2 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView2)]
pub type MatrixSlice2<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U2, SliceStorage<'a, T, U2, U2, RStride, CStride>>;
Matrix<T, U2, U2, ViewStorage<'a, T, U2, U2, RStride, CStride>>;
/// A column-major 3x3 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView3)]
pub type MatrixSlice3<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U3, SliceStorage<'a, T, U3, U3, RStride, CStride>>;
Matrix<T, U3, U3, ViewStorage<'a, T, U3, U3, RStride, CStride>>;
/// A column-major 4x4 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView4)]
pub type MatrixSlice4<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U4, SliceStorage<'a, T, U4, U4, RStride, CStride>>;
Matrix<T, U4, U4, ViewStorage<'a, T, U4, U4, RStride, CStride>>;
/// A column-major 5x5 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView5)]
pub type MatrixSlice5<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U5, SliceStorage<'a, T, U5, U5, RStride, CStride>>;
Matrix<T, U5, U5, ViewStorage<'a, T, U5, U5, RStride, CStride>>;
/// A column-major 6x6 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView6)]
pub type MatrixSlice6<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U6, SliceStorage<'a, T, U6, U6, RStride, CStride>>;
Matrix<T, U6, U6, ViewStorage<'a, T, U6, U6, RStride, CStride>>;
/// A column-major 1x2 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView1x2)]
pub type MatrixSlice1x2<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U2, SliceStorage<'a, T, U1, U2, RStride, CStride>>;
Matrix<T, U1, U2, ViewStorage<'a, T, U1, U2, RStride, CStride>>;
/// A column-major 1x3 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView1x3)]
pub type MatrixSlice1x3<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U3, SliceStorage<'a, T, U1, U3, RStride, CStride>>;
Matrix<T, U1, U3, ViewStorage<'a, T, U1, U3, RStride, CStride>>;
/// A column-major 1x4 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView1x4)]
pub type MatrixSlice1x4<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U4, SliceStorage<'a, T, U1, U4, RStride, CStride>>;
Matrix<T, U1, U4, ViewStorage<'a, T, U1, U4, RStride, CStride>>;
/// A column-major 1x5 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView1x5)]
pub type MatrixSlice1x5<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U5, SliceStorage<'a, T, U1, U5, RStride, CStride>>;
Matrix<T, U1, U5, ViewStorage<'a, T, U1, U5, RStride, CStride>>;
/// A column-major 1x6 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView1x6)]
pub type MatrixSlice1x6<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U6, SliceStorage<'a, T, U1, U6, RStride, CStride>>;
Matrix<T, U1, U6, ViewStorage<'a, T, U1, U6, RStride, CStride>>;
/// A column-major 2x1 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView2x1)]
pub type MatrixSlice2x1<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U1, SliceStorage<'a, T, U2, U1, RStride, CStride>>;
Matrix<T, U2, U1, ViewStorage<'a, T, U2, U1, RStride, CStride>>;
/// A column-major 2x3 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView2x3)]
pub type MatrixSlice2x3<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U3, SliceStorage<'a, T, U2, U3, RStride, CStride>>;
Matrix<T, U2, U3, ViewStorage<'a, T, U2, U3, RStride, CStride>>;
/// A column-major 2x4 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView2x4)]
pub type MatrixSlice2x4<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U4, SliceStorage<'a, T, U2, U4, RStride, CStride>>;
Matrix<T, U2, U4, ViewStorage<'a, T, U2, U4, RStride, CStride>>;
/// A column-major 2x5 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView2x5)]
pub type MatrixSlice2x5<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U5, SliceStorage<'a, T, U2, U5, RStride, CStride>>;
Matrix<T, U2, U5, ViewStorage<'a, T, U2, U5, RStride, CStride>>;
/// A column-major 2x6 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView2x6)]
pub type MatrixSlice2x6<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U6, SliceStorage<'a, T, U2, U6, RStride, CStride>>;
Matrix<T, U2, U6, ViewStorage<'a, T, U2, U6, RStride, CStride>>;
/// A column-major 3x1 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView3x1)]
pub type MatrixSlice3x1<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U1, SliceStorage<'a, T, U3, U1, RStride, CStride>>;
Matrix<T, U3, U1, ViewStorage<'a, T, U3, U1, RStride, CStride>>;
/// A column-major 3x2 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView3x2)]
pub type MatrixSlice3x2<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U2, SliceStorage<'a, T, U3, U2, RStride, CStride>>;
Matrix<T, U3, U2, ViewStorage<'a, T, U3, U2, RStride, CStride>>;
/// A column-major 3x4 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView3x4)]
pub type MatrixSlice3x4<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U4, SliceStorage<'a, T, U3, U4, RStride, CStride>>;
Matrix<T, U3, U4, ViewStorage<'a, T, U3, U4, RStride, CStride>>;
/// A column-major 3x5 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView3x5)]
pub type MatrixSlice3x5<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U5, SliceStorage<'a, T, U3, U5, RStride, CStride>>;
Matrix<T, U3, U5, ViewStorage<'a, T, U3, U5, RStride, CStride>>;
/// A column-major 3x6 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView3x6)]
pub type MatrixSlice3x6<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U6, SliceStorage<'a, T, U3, U6, RStride, CStride>>;
Matrix<T, U3, U6, ViewStorage<'a, T, U3, U6, RStride, CStride>>;
/// A column-major 4x1 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView4x1)]
pub type MatrixSlice4x1<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U1, SliceStorage<'a, T, U4, U1, RStride, CStride>>;
Matrix<T, U4, U1, ViewStorage<'a, T, U4, U1, RStride, CStride>>;
/// A column-major 4x2 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView4x2)]
pub type MatrixSlice4x2<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U2, SliceStorage<'a, T, U4, U2, RStride, CStride>>;
Matrix<T, U4, U2, ViewStorage<'a, T, U4, U2, RStride, CStride>>;
/// A column-major 4x3 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView4x3)]
pub type MatrixSlice4x3<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U3, SliceStorage<'a, T, U4, U3, RStride, CStride>>;
Matrix<T, U4, U3, ViewStorage<'a, T, U4, U3, RStride, CStride>>;
/// A column-major 4x5 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView4x5)]
pub type MatrixSlice4x5<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U5, SliceStorage<'a, T, U4, U5, RStride, CStride>>;
Matrix<T, U4, U5, ViewStorage<'a, T, U4, U5, RStride, CStride>>;
/// A column-major 4x6 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView4x6)]
pub type MatrixSlice4x6<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U6, SliceStorage<'a, T, U4, U6, RStride, CStride>>;
Matrix<T, U4, U6, ViewStorage<'a, T, U4, U6, RStride, CStride>>;
/// A column-major 5x1 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView5x1)]
pub type MatrixSlice5x1<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U1, SliceStorage<'a, T, U5, U1, RStride, CStride>>;
Matrix<T, U5, U1, ViewStorage<'a, T, U5, U1, RStride, CStride>>;
/// A column-major 5x2 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView5x2)]
pub type MatrixSlice5x2<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U2, SliceStorage<'a, T, U5, U2, RStride, CStride>>;
Matrix<T, U5, U2, ViewStorage<'a, T, U5, U2, RStride, CStride>>;
/// A column-major 5x3 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView5x3)]
pub type MatrixSlice5x3<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U3, SliceStorage<'a, T, U5, U3, RStride, CStride>>;
Matrix<T, U5, U3, ViewStorage<'a, T, U5, U3, RStride, CStride>>;
/// A column-major 5x4 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView5x4)]
pub type MatrixSlice5x4<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U4, SliceStorage<'a, T, U5, U4, RStride, CStride>>;
Matrix<T, U5, U4, ViewStorage<'a, T, U5, U4, RStride, CStride>>;
/// A column-major 5x6 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView5x6)]
pub type MatrixSlice5x6<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U6, SliceStorage<'a, T, U5, U6, RStride, CStride>>;
Matrix<T, U5, U6, ViewStorage<'a, T, U5, U6, RStride, CStride>>;
/// A column-major 6x1 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView6x1)]
pub type MatrixSlice6x1<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U1, SliceStorage<'a, T, U6, U1, RStride, CStride>>;
Matrix<T, U6, U1, ViewStorage<'a, T, U6, U1, RStride, CStride>>;
/// A column-major 6x2 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView6x2)]
pub type MatrixSlice6x2<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U2, SliceStorage<'a, T, U6, U2, RStride, CStride>>;
Matrix<T, U6, U2, ViewStorage<'a, T, U6, U2, RStride, CStride>>;
/// A column-major 6x3 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView6x3)]
pub type MatrixSlice6x3<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U3, SliceStorage<'a, T, U6, U3, RStride, CStride>>;
Matrix<T, U6, U3, ViewStorage<'a, T, U6, U3, RStride, CStride>>;
/// A column-major 6x4 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView6x4)]
pub type MatrixSlice6x4<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U4, SliceStorage<'a, T, U6, U4, RStride, CStride>>;
Matrix<T, U6, U4, ViewStorage<'a, T, U6, U4, RStride, CStride>>;
/// A column-major 6x5 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixView6x5)]
pub type MatrixSlice6x5<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U5, SliceStorage<'a, T, U6, U5, RStride, CStride>>;
Matrix<T, U6, U5, ViewStorage<'a, T, U6, U5, RStride, CStride>>;
/// A column-major matrix slice with 1 row and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixView1xX)]
pub type MatrixSlice1xX<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, Dynamic, SliceStorage<'a, T, U1, Dynamic, RStride, CStride>>;
Matrix<T, U1, Dynamic, ViewStorage<'a, T, U1, Dynamic, RStride, CStride>>;
/// A column-major matrix slice with 2 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixView2xX)]
pub type MatrixSlice2xX<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, Dynamic, SliceStorage<'a, T, U2, Dynamic, RStride, CStride>>;
Matrix<T, U2, Dynamic, ViewStorage<'a, T, U2, Dynamic, RStride, CStride>>;
/// A column-major matrix slice with 3 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixView3xX)]
pub type MatrixSlice3xX<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, Dynamic, SliceStorage<'a, T, U3, Dynamic, RStride, CStride>>;
Matrix<T, U3, Dynamic, ViewStorage<'a, T, U3, Dynamic, RStride, CStride>>;
/// A column-major matrix slice with 4 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixView4xX)]
pub type MatrixSlice4xX<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, Dynamic, SliceStorage<'a, T, U4, Dynamic, RStride, CStride>>;
Matrix<T, U4, Dynamic, ViewStorage<'a, T, U4, Dynamic, RStride, CStride>>;
/// A column-major matrix slice with 5 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixView5xX)]
pub type MatrixSlice5xX<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, Dynamic, SliceStorage<'a, T, U5, Dynamic, RStride, CStride>>;
Matrix<T, U5, Dynamic, ViewStorage<'a, T, U5, Dynamic, RStride, CStride>>;
/// A column-major matrix slice with 6 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixView6xX)]
pub type MatrixSlice6xX<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, Dynamic, SliceStorage<'a, T, U6, Dynamic, RStride, CStride>>;
Matrix<T, U6, Dynamic, ViewStorage<'a, T, U6, Dynamic, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 1 column.
#[deprecated = slice_deprecation_note!(MatrixViewXx1)]
pub type MatrixSliceXx1<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U1, SliceStorage<'a, T, Dynamic, U1, RStride, CStride>>;
Matrix<T, Dynamic, U1, ViewStorage<'a, T, Dynamic, U1, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 2 columns.
#[deprecated = slice_deprecation_note!(MatrixViewXx2)]
pub type MatrixSliceXx2<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U2, SliceStorage<'a, T, Dynamic, U2, RStride, CStride>>;
Matrix<T, Dynamic, U2, ViewStorage<'a, T, Dynamic, U2, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 3 columns.
#[deprecated = slice_deprecation_note!(MatrixViewXx3)]
pub type MatrixSliceXx3<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U3, SliceStorage<'a, T, Dynamic, U3, RStride, CStride>>;
Matrix<T, Dynamic, U3, ViewStorage<'a, T, Dynamic, U3, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 4 columns.
#[deprecated = slice_deprecation_note!(MatrixViewXx4)]
pub type MatrixSliceXx4<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U4, SliceStorage<'a, T, Dynamic, U4, RStride, CStride>>;
Matrix<T, Dynamic, U4, ViewStorage<'a, T, Dynamic, U4, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 5 columns.
#[deprecated = slice_deprecation_note!(MatrixViewXx5)]
pub type MatrixSliceXx5<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U5, SliceStorage<'a, T, Dynamic, U5, RStride, CStride>>;
Matrix<T, Dynamic, U5, ViewStorage<'a, T, Dynamic, U5, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 6 columns.
#[deprecated = slice_deprecation_note!(MatrixViewXx6)]
pub type MatrixSliceXx6<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U6, SliceStorage<'a, T, Dynamic, U6, RStride, CStride>>;
Matrix<T, Dynamic, U6, ViewStorage<'a, T, Dynamic, U6, RStride, CStride>>;
/// A column vector slice with dimensions known at compile-time.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(VectorView)]
pub type VectorSlice<'a, T, D, RStride = U1, CStride = D> =
Matrix<T, D, U1, SliceStorage<'a, T, D, U1, RStride, CStride>>;
Matrix<T, D, U1, ViewStorage<'a, T, D, U1, RStride, CStride>>;
/// A column vector slice with dimensions known at compile-time.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(SVectorView)]
pub type SVectorSlice<'a, T, const D: usize> =
Matrix<T, Const<D>, Const<1>, SliceStorage<'a, T, Const<D>, Const<1>, Const<1>, Const<D>>>;
Matrix<T, Const<D>, Const<1>, ViewStorage<'a, T, Const<D>, Const<1>, Const<1>, Const<D>>>;
/// A column vector slice dynamic numbers of rows and columns.
#[deprecated = slice_deprecation_note!(DVectorView)]
pub type DVectorSlice<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U1, SliceStorage<'a, T, Dynamic, U1, RStride, CStride>>;
Matrix<T, Dynamic, U1, ViewStorage<'a, T, Dynamic, U1, RStride, CStride>>;
/// A 1D column vector slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(VectorView1)]
pub type VectorSlice1<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U1, SliceStorage<'a, T, U1, U1, RStride, CStride>>;
Matrix<T, U1, U1, ViewStorage<'a, T, U1, U1, RStride, CStride>>;
/// A 2D column vector slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(VectorView2)]
pub type VectorSlice2<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U1, SliceStorage<'a, T, U2, U1, RStride, CStride>>;
Matrix<T, U2, U1, ViewStorage<'a, T, U2, U1, RStride, CStride>>;
/// A 3D column vector slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(VectorView3)]
pub type VectorSlice3<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U1, SliceStorage<'a, T, U3, U1, RStride, CStride>>;
Matrix<T, U3, U1, ViewStorage<'a, T, U3, U1, RStride, CStride>>;
/// A 4D column vector slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(VectorView4)]
pub type VectorSlice4<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U1, SliceStorage<'a, T, U4, U1, RStride, CStride>>;
Matrix<T, U4, U1, ViewStorage<'a, T, U4, U1, RStride, CStride>>;
/// A 5D column vector slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(VectorView5)]
pub type VectorSlice5<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U1, SliceStorage<'a, T, U5, U1, RStride, CStride>>;
Matrix<T, U5, U1, ViewStorage<'a, T, U5, U1, RStride, CStride>>;
/// A 6D column vector slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(VectorView6)]
pub type VectorSlice6<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U1, SliceStorage<'a, T, U6, U1, RStride, CStride>>;
Matrix<T, U6, U1, ViewStorage<'a, T, U6, U1, RStride, CStride>>;
/*
*
@ -304,297 +364,358 @@ pub type VectorSlice6<'a, T, RStride = U1, CStride = U6> =
/// A column-major matrix slice with `R` rows and `C` columns.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = "Use MatrixViewMut instead, which has an identical definition."]
pub type MatrixSliceMutMN<'a, T, R, C, RStride = U1, CStride = R> =
Matrix<T, R, C, SliceStorageMut<'a, T, R, C, RStride, CStride>>;
Matrix<T, R, C, ViewStorageMut<'a, T, R, C, RStride, CStride>>;
/// A column-major matrix slice with `D` rows and columns.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = "Use MatrixViewMut instead."]
pub type MatrixSliceMutN<'a, T, D, RStride = U1, CStride = D> =
Matrix<T, D, D, SliceStorageMut<'a, T, D, D, RStride, CStride>>;
Matrix<T, D, D, ViewStorageMut<'a, T, D, D, RStride, CStride>>;
/// A column-major matrix slice with dimensions known at compile-time.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(SMatrixViewMut)]
pub type SMatrixSliceMut<'a, T, const R: usize, const C: usize> =
Matrix<T, Const<R>, Const<C>, SliceStorageMut<'a, T, Const<R>, Const<C>, Const<1>, Const<R>>>;
Matrix<T, Const<R>, Const<C>, ViewStorageMut<'a, T, Const<R>, Const<C>, Const<1>, Const<R>>>;
/// A column-major matrix slice dynamic numbers of rows and columns.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(DMatrixViewMut)]
pub type DMatrixSliceMut<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, Dynamic, SliceStorageMut<'a, T, Dynamic, Dynamic, RStride, CStride>>;
Matrix<T, Dynamic, Dynamic, ViewStorageMut<'a, T, Dynamic, Dynamic, RStride, CStride>>;
/// A column-major 1x1 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut1)]
pub type MatrixSliceMut1<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U1, SliceStorageMut<'a, T, U1, U1, RStride, CStride>>;
Matrix<T, U1, U1, ViewStorageMut<'a, T, U1, U1, RStride, CStride>>;
/// A column-major 2x2 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut2)]
pub type MatrixSliceMut2<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U2, SliceStorageMut<'a, T, U2, U2, RStride, CStride>>;
Matrix<T, U2, U2, ViewStorageMut<'a, T, U2, U2, RStride, CStride>>;
/// A column-major 3x3 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut3)]
pub type MatrixSliceMut3<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U3, SliceStorageMut<'a, T, U3, U3, RStride, CStride>>;
Matrix<T, U3, U3, ViewStorageMut<'a, T, U3, U3, RStride, CStride>>;
/// A column-major 4x4 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut4)]
pub type MatrixSliceMut4<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U4, SliceStorageMut<'a, T, U4, U4, RStride, CStride>>;
Matrix<T, U4, U4, ViewStorageMut<'a, T, U4, U4, RStride, CStride>>;
/// A column-major 5x5 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut5)]
pub type MatrixSliceMut5<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U5, SliceStorageMut<'a, T, U5, U5, RStride, CStride>>;
Matrix<T, U5, U5, ViewStorageMut<'a, T, U5, U5, RStride, CStride>>;
/// A column-major 6x6 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut6)]
pub type MatrixSliceMut6<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U6, SliceStorageMut<'a, T, U6, U6, RStride, CStride>>;
Matrix<T, U6, U6, ViewStorageMut<'a, T, U6, U6, RStride, CStride>>;
/// A column-major 1x2 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut1x2)]
pub type MatrixSliceMut1x2<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U2, SliceStorageMut<'a, T, U1, U2, RStride, CStride>>;
Matrix<T, U1, U2, ViewStorageMut<'a, T, U1, U2, RStride, CStride>>;
/// A column-major 1x3 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut1x3)]
pub type MatrixSliceMut1x3<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U3, SliceStorageMut<'a, T, U1, U3, RStride, CStride>>;
Matrix<T, U1, U3, ViewStorageMut<'a, T, U1, U3, RStride, CStride>>;
/// A column-major 1x4 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut1x4)]
pub type MatrixSliceMut1x4<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U4, SliceStorageMut<'a, T, U1, U4, RStride, CStride>>;
Matrix<T, U1, U4, ViewStorageMut<'a, T, U1, U4, RStride, CStride>>;
/// A column-major 1x5 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut1x5)]
pub type MatrixSliceMut1x5<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U5, SliceStorageMut<'a, T, U1, U5, RStride, CStride>>;
Matrix<T, U1, U5, ViewStorageMut<'a, T, U1, U5, RStride, CStride>>;
/// A column-major 1x6 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut1x6)]
pub type MatrixSliceMut1x6<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U6, SliceStorageMut<'a, T, U1, U6, RStride, CStride>>;
Matrix<T, U1, U6, ViewStorageMut<'a, T, U1, U6, RStride, CStride>>;
/// A column-major 2x1 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut2x1)]
pub type MatrixSliceMut2x1<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U1, SliceStorageMut<'a, T, U2, U1, RStride, CStride>>;
Matrix<T, U2, U1, ViewStorageMut<'a, T, U2, U1, RStride, CStride>>;
/// A column-major 2x3 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut2x3)]
pub type MatrixSliceMut2x3<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U3, SliceStorageMut<'a, T, U2, U3, RStride, CStride>>;
Matrix<T, U2, U3, ViewStorageMut<'a, T, U2, U3, RStride, CStride>>;
/// A column-major 2x4 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut2x4)]
pub type MatrixSliceMut2x4<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U4, SliceStorageMut<'a, T, U2, U4, RStride, CStride>>;
Matrix<T, U2, U4, ViewStorageMut<'a, T, U2, U4, RStride, CStride>>;
/// A column-major 2x5 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut2x5)]
pub type MatrixSliceMut2x5<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U5, SliceStorageMut<'a, T, U2, U5, RStride, CStride>>;
Matrix<T, U2, U5, ViewStorageMut<'a, T, U2, U5, RStride, CStride>>;
/// A column-major 2x6 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut2x6)]
pub type MatrixSliceMut2x6<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U6, SliceStorageMut<'a, T, U2, U6, RStride, CStride>>;
Matrix<T, U2, U6, ViewStorageMut<'a, T, U2, U6, RStride, CStride>>;
/// A column-major 3x1 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut3x1)]
pub type MatrixSliceMut3x1<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U1, SliceStorageMut<'a, T, U3, U1, RStride, CStride>>;
Matrix<T, U3, U1, ViewStorageMut<'a, T, U3, U1, RStride, CStride>>;
/// A column-major 3x2 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut3x2)]
pub type MatrixSliceMut3x2<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U2, SliceStorageMut<'a, T, U3, U2, RStride, CStride>>;
Matrix<T, U3, U2, ViewStorageMut<'a, T, U3, U2, RStride, CStride>>;
/// A column-major 3x4 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut3x4)]
pub type MatrixSliceMut3x4<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U4, SliceStorageMut<'a, T, U3, U4, RStride, CStride>>;
Matrix<T, U3, U4, ViewStorageMut<'a, T, U3, U4, RStride, CStride>>;
/// A column-major 3x5 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut3x5)]
pub type MatrixSliceMut3x5<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U5, SliceStorageMut<'a, T, U3, U5, RStride, CStride>>;
Matrix<T, U3, U5, ViewStorageMut<'a, T, U3, U5, RStride, CStride>>;
/// A column-major 3x6 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut3x6)]
pub type MatrixSliceMut3x6<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U6, SliceStorageMut<'a, T, U3, U6, RStride, CStride>>;
Matrix<T, U3, U6, ViewStorageMut<'a, T, U3, U6, RStride, CStride>>;
/// A column-major 4x1 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut4x1)]
pub type MatrixSliceMut4x1<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U1, SliceStorageMut<'a, T, U4, U1, RStride, CStride>>;
Matrix<T, U4, U1, ViewStorageMut<'a, T, U4, U1, RStride, CStride>>;
/// A column-major 4x2 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut4x2)]
pub type MatrixSliceMut4x2<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U2, SliceStorageMut<'a, T, U4, U2, RStride, CStride>>;
Matrix<T, U4, U2, ViewStorageMut<'a, T, U4, U2, RStride, CStride>>;
/// A column-major 4x3 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut4x3)]
pub type MatrixSliceMut4x3<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U3, SliceStorageMut<'a, T, U4, U3, RStride, CStride>>;
Matrix<T, U4, U3, ViewStorageMut<'a, T, U4, U3, RStride, CStride>>;
/// A column-major 4x5 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut4x5)]
pub type MatrixSliceMut4x5<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U5, SliceStorageMut<'a, T, U4, U5, RStride, CStride>>;
Matrix<T, U4, U5, ViewStorageMut<'a, T, U4, U5, RStride, CStride>>;
/// A column-major 4x6 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut4x6)]
pub type MatrixSliceMut4x6<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U6, SliceStorageMut<'a, T, U4, U6, RStride, CStride>>;
Matrix<T, U4, U6, ViewStorageMut<'a, T, U4, U6, RStride, CStride>>;
/// A column-major 5x1 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut5x1)]
pub type MatrixSliceMut5x1<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U1, SliceStorageMut<'a, T, U5, U1, RStride, CStride>>;
Matrix<T, U5, U1, ViewStorageMut<'a, T, U5, U1, RStride, CStride>>;
/// A column-major 5x2 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut5x2)]
pub type MatrixSliceMut5x2<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U2, SliceStorageMut<'a, T, U5, U2, RStride, CStride>>;
Matrix<T, U5, U2, ViewStorageMut<'a, T, U5, U2, RStride, CStride>>;
/// A column-major 5x3 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut5x3)]
pub type MatrixSliceMut5x3<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U3, SliceStorageMut<'a, T, U5, U3, RStride, CStride>>;
Matrix<T, U5, U3, ViewStorageMut<'a, T, U5, U3, RStride, CStride>>;
/// A column-major 5x4 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut5x4)]
pub type MatrixSliceMut5x4<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U4, SliceStorageMut<'a, T, U5, U4, RStride, CStride>>;
Matrix<T, U5, U4, ViewStorageMut<'a, T, U5, U4, RStride, CStride>>;
/// A column-major 5x6 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut5x6)]
pub type MatrixSliceMut5x6<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U6, SliceStorageMut<'a, T, U5, U6, RStride, CStride>>;
Matrix<T, U5, U6, ViewStorageMut<'a, T, U5, U6, RStride, CStride>>;
/// A column-major 6x1 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut6x1)]
pub type MatrixSliceMut6x1<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U1, SliceStorageMut<'a, T, U6, U1, RStride, CStride>>;
Matrix<T, U6, U1, ViewStorageMut<'a, T, U6, U1, RStride, CStride>>;
/// A column-major 6x2 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut6x2)]
pub type MatrixSliceMut6x2<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U2, SliceStorageMut<'a, T, U6, U2, RStride, CStride>>;
Matrix<T, U6, U2, ViewStorageMut<'a, T, U6, U2, RStride, CStride>>;
/// A column-major 6x3 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut6x3)]
pub type MatrixSliceMut6x3<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U3, SliceStorageMut<'a, T, U6, U3, RStride, CStride>>;
Matrix<T, U6, U3, ViewStorageMut<'a, T, U6, U3, RStride, CStride>>;
/// A column-major 6x4 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut6x4)]
pub type MatrixSliceMut6x4<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U4, SliceStorageMut<'a, T, U6, U4, RStride, CStride>>;
Matrix<T, U6, U4, ViewStorageMut<'a, T, U6, U4, RStride, CStride>>;
/// A column-major 6x5 matrix slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(MatrixViewMut6x5)]
pub type MatrixSliceMut6x5<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U5, SliceStorageMut<'a, T, U6, U5, RStride, CStride>>;
Matrix<T, U6, U5, ViewStorageMut<'a, T, U6, U5, RStride, CStride>>;
/// A column-major matrix slice with 1 row and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixViewMut1xX)]
pub type MatrixSliceMut1xX<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, Dynamic, SliceStorageMut<'a, T, U1, Dynamic, RStride, CStride>>;
Matrix<T, U1, Dynamic, ViewStorageMut<'a, T, U1, Dynamic, RStride, CStride>>;
/// A column-major matrix slice with 2 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixViewMut2xX)]
pub type MatrixSliceMut2xX<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, Dynamic, SliceStorageMut<'a, T, U2, Dynamic, RStride, CStride>>;
Matrix<T, U2, Dynamic, ViewStorageMut<'a, T, U2, Dynamic, RStride, CStride>>;
/// A column-major matrix slice with 3 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixViewMut3xX)]
pub type MatrixSliceMut3xX<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, Dynamic, SliceStorageMut<'a, T, U3, Dynamic, RStride, CStride>>;
Matrix<T, U3, Dynamic, ViewStorageMut<'a, T, U3, Dynamic, RStride, CStride>>;
/// A column-major matrix slice with 4 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixViewMut4xX)]
pub type MatrixSliceMut4xX<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, Dynamic, SliceStorageMut<'a, T, U4, Dynamic, RStride, CStride>>;
Matrix<T, U4, Dynamic, ViewStorageMut<'a, T, U4, Dynamic, RStride, CStride>>;
/// A column-major matrix slice with 5 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixViewMut5xX)]
pub type MatrixSliceMut5xX<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, Dynamic, SliceStorageMut<'a, T, U5, Dynamic, RStride, CStride>>;
Matrix<T, U5, Dynamic, ViewStorageMut<'a, T, U5, Dynamic, RStride, CStride>>;
/// A column-major matrix slice with 6 rows and a number of columns chosen at runtime.
#[deprecated = slice_deprecation_note!(MatrixViewMut6xX)]
pub type MatrixSliceMut6xX<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, Dynamic, SliceStorageMut<'a, T, U6, Dynamic, RStride, CStride>>;
Matrix<T, U6, Dynamic, ViewStorageMut<'a, T, U6, Dynamic, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 1 column.
#[deprecated = slice_deprecation_note!(MatrixViewMutXx1)]
pub type MatrixSliceMutXx1<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U1, SliceStorageMut<'a, T, Dynamic, U1, RStride, CStride>>;
Matrix<T, Dynamic, U1, ViewStorageMut<'a, T, Dynamic, U1, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 2 columns.
#[deprecated = slice_deprecation_note!(MatrixViewMutXx2)]
pub type MatrixSliceMutXx2<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U2, SliceStorageMut<'a, T, Dynamic, U2, RStride, CStride>>;
Matrix<T, Dynamic, U2, ViewStorageMut<'a, T, Dynamic, U2, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 3 columns.
#[deprecated = slice_deprecation_note!(MatrixViewMutXx3)]
pub type MatrixSliceMutXx3<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U3, SliceStorageMut<'a, T, Dynamic, U3, RStride, CStride>>;
Matrix<T, Dynamic, U3, ViewStorageMut<'a, T, Dynamic, U3, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 4 columns.
#[deprecated = slice_deprecation_note!(MatrixViewMutXx4)]
pub type MatrixSliceMutXx4<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U4, SliceStorageMut<'a, T, Dynamic, U4, RStride, CStride>>;
Matrix<T, Dynamic, U4, ViewStorageMut<'a, T, Dynamic, U4, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 5 columns.
#[deprecated = slice_deprecation_note!(MatrixViewMutXx5)]
pub type MatrixSliceMutXx5<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U5, SliceStorageMut<'a, T, Dynamic, U5, RStride, CStride>>;
Matrix<T, Dynamic, U5, ViewStorageMut<'a, T, Dynamic, U5, RStride, CStride>>;
/// A column-major matrix slice with a number of rows chosen at runtime and 6 columns.
#[deprecated = slice_deprecation_note!(MatrixViewMutXx6)]
pub type MatrixSliceMutXx6<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U6, SliceStorageMut<'a, T, Dynamic, U6, RStride, CStride>>;
Matrix<T, Dynamic, U6, ViewStorageMut<'a, T, Dynamic, U6, RStride, CStride>>;
/// A column vector slice with dimensions known at compile-time.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(VectorViewMut)]
pub type VectorSliceMut<'a, T, D, RStride = U1, CStride = D> =
Matrix<T, D, U1, SliceStorageMut<'a, T, D, U1, RStride, CStride>>;
Matrix<T, D, U1, ViewStorageMut<'a, T, D, U1, RStride, CStride>>;
/// A column vector slice with dimensions known at compile-time.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(SVectorViewMut)]
pub type SVectorSliceMut<'a, T, const D: usize> =
Matrix<T, Const<D>, Const<1>, SliceStorageMut<'a, T, Const<D>, Const<1>, Const<1>, Const<D>>>;
Matrix<T, Const<D>, Const<1>, ViewStorageMut<'a, T, Const<D>, Const<1>, Const<1>, Const<D>>>;
/// A column vector slice dynamic numbers of rows and columns.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(DVectorViewMut)]
pub type DVectorSliceMut<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U1, SliceStorageMut<'a, T, Dynamic, U1, RStride, CStride>>;
Matrix<T, Dynamic, U1, ViewStorageMut<'a, T, Dynamic, U1, RStride, CStride>>;
/// A 1D column vector slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(VectorViewMut1)]
pub type VectorSliceMut1<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U1, SliceStorageMut<'a, T, U1, U1, RStride, CStride>>;
Matrix<T, U1, U1, ViewStorageMut<'a, T, U1, U1, RStride, CStride>>;
/// A 2D column vector slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(VectorViewMut2)]
pub type VectorSliceMut2<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U1, SliceStorageMut<'a, T, U2, U1, RStride, CStride>>;
Matrix<T, U2, U1, ViewStorageMut<'a, T, U2, U1, RStride, CStride>>;
/// A 3D column vector slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(VectorViewMut3)]
pub type VectorSliceMut3<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U1, SliceStorageMut<'a, T, U3, U1, RStride, CStride>>;
Matrix<T, U3, U1, ViewStorageMut<'a, T, U3, U1, RStride, CStride>>;
/// A 4D column vector slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(VectorViewMut4)]
pub type VectorSliceMut4<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U1, SliceStorageMut<'a, T, U4, U1, RStride, CStride>>;
Matrix<T, U4, U1, ViewStorageMut<'a, T, U4, U1, RStride, CStride>>;
/// A 5D column vector slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(VectorViewMut5)]
pub type VectorSliceMut5<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U1, SliceStorageMut<'a, T, U5, U1, RStride, CStride>>;
Matrix<T, U5, U1, ViewStorageMut<'a, T, U5, U1, RStride, CStride>>;
/// A 6D column vector slice.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
#[deprecated = slice_deprecation_note!(VectorViewMut6)]
pub type VectorSliceMut6<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U1, SliceStorageMut<'a, T, U6, U1, RStride, CStride>>;
Matrix<T, U6, U1, ViewStorageMut<'a, T, U6, U1, RStride, CStride>>;

589
src/base/alias_view.rs Normal file
View File

@ -0,0 +1,589 @@
use crate::base::dimension::{Dynamic, U1, U2, U3, U4, U5, U6};
use crate::base::matrix_view::{ViewStorage, ViewStorageMut};
use crate::base::{Const, Matrix};
/*
*
*
* Matrix view aliases.
*
*
*/
// NOTE: we can't provide defaults for the strides because it's not supported yet by min_const_generics.
/// A column-major matrix view with dimensions known at compile-time.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type SMatrixView<'a, T, const R: usize, const C: usize> =
Matrix<T, Const<R>, Const<C>, ViewStorage<'a, T, Const<R>, Const<C>, Const<1>, Const<R>>>;
/// A column-major matrix view dynamic numbers of rows and columns.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type DMatrixView<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, Dynamic, ViewStorage<'a, T, Dynamic, Dynamic, RStride, CStride>>;
/// A column-major 1x1 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView1<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U1, ViewStorage<'a, T, U1, U1, RStride, CStride>>;
/// A column-major 2x2 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView2<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U2, ViewStorage<'a, T, U2, U2, RStride, CStride>>;
/// A column-major 3x3 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView3<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U3, ViewStorage<'a, T, U3, U3, RStride, CStride>>;
/// A column-major 4x4 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView4<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U4, ViewStorage<'a, T, U4, U4, RStride, CStride>>;
/// A column-major 5x5 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView5<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U5, ViewStorage<'a, T, U5, U5, RStride, CStride>>;
/// A column-major 6x6 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView6<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U6, ViewStorage<'a, T, U6, U6, RStride, CStride>>;
/// A column-major 1x2 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView1x2<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U2, ViewStorage<'a, T, U1, U2, RStride, CStride>>;
/// A column-major 1x3 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView1x3<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U3, ViewStorage<'a, T, U1, U3, RStride, CStride>>;
/// A column-major 1x4 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView1x4<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U4, ViewStorage<'a, T, U1, U4, RStride, CStride>>;
/// A column-major 1x5 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView1x5<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U5, ViewStorage<'a, T, U1, U5, RStride, CStride>>;
/// A column-major 1x6 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView1x6<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U6, ViewStorage<'a, T, U1, U6, RStride, CStride>>;
/// A column-major 2x1 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView2x1<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U1, ViewStorage<'a, T, U2, U1, RStride, CStride>>;
/// A column-major 2x3 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView2x3<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U3, ViewStorage<'a, T, U2, U3, RStride, CStride>>;
/// A column-major 2x4 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView2x4<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U4, ViewStorage<'a, T, U2, U4, RStride, CStride>>;
/// A column-major 2x5 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView2x5<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U5, ViewStorage<'a, T, U2, U5, RStride, CStride>>;
/// A column-major 2x6 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView2x6<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U6, ViewStorage<'a, T, U2, U6, RStride, CStride>>;
/// A column-major 3x1 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView3x1<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U1, ViewStorage<'a, T, U3, U1, RStride, CStride>>;
/// A column-major 3x2 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView3x2<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U2, ViewStorage<'a, T, U3, U2, RStride, CStride>>;
/// A column-major 3x4 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView3x4<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U4, ViewStorage<'a, T, U3, U4, RStride, CStride>>;
/// A column-major 3x5 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView3x5<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U5, ViewStorage<'a, T, U3, U5, RStride, CStride>>;
/// A column-major 3x6 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView3x6<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U6, ViewStorage<'a, T, U3, U6, RStride, CStride>>;
/// A column-major 4x1 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView4x1<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U1, ViewStorage<'a, T, U4, U1, RStride, CStride>>;
/// A column-major 4x2 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView4x2<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U2, ViewStorage<'a, T, U4, U2, RStride, CStride>>;
/// A column-major 4x3 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView4x3<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U3, ViewStorage<'a, T, U4, U3, RStride, CStride>>;
/// A column-major 4x5 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView4x5<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U5, ViewStorage<'a, T, U4, U5, RStride, CStride>>;
/// A column-major 4x6 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView4x6<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U6, ViewStorage<'a, T, U4, U6, RStride, CStride>>;
/// A column-major 5x1 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView5x1<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U1, ViewStorage<'a, T, U5, U1, RStride, CStride>>;
/// A column-major 5x2 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView5x2<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U2, ViewStorage<'a, T, U5, U2, RStride, CStride>>;
/// A column-major 5x3 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView5x3<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U3, ViewStorage<'a, T, U5, U3, RStride, CStride>>;
/// A column-major 5x4 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView5x4<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U4, ViewStorage<'a, T, U5, U4, RStride, CStride>>;
/// A column-major 5x6 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView5x6<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U6, ViewStorage<'a, T, U5, U6, RStride, CStride>>;
/// A column-major 6x1 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView6x1<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U1, ViewStorage<'a, T, U6, U1, RStride, CStride>>;
/// A column-major 6x2 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView6x2<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U2, ViewStorage<'a, T, U6, U2, RStride, CStride>>;
/// A column-major 6x3 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView6x3<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U3, ViewStorage<'a, T, U6, U3, RStride, CStride>>;
/// A column-major 6x4 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView6x4<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U4, ViewStorage<'a, T, U6, U4, RStride, CStride>>;
/// A column-major 6x5 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixView6x5<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U5, ViewStorage<'a, T, U6, U5, RStride, CStride>>;
/// A column-major matrix view with 1 row and a number of columns chosen at runtime.
pub type MatrixView1xX<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, Dynamic, ViewStorage<'a, T, U1, Dynamic, RStride, CStride>>;
/// A column-major matrix view with 2 rows and a number of columns chosen at runtime.
pub type MatrixView2xX<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, Dynamic, ViewStorage<'a, T, U2, Dynamic, RStride, CStride>>;
/// A column-major matrix view with 3 rows and a number of columns chosen at runtime.
pub type MatrixView3xX<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, Dynamic, ViewStorage<'a, T, U3, Dynamic, RStride, CStride>>;
/// A column-major matrix view with 4 rows and a number of columns chosen at runtime.
pub type MatrixView4xX<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, Dynamic, ViewStorage<'a, T, U4, Dynamic, RStride, CStride>>;
/// A column-major matrix view with 5 rows and a number of columns chosen at runtime.
pub type MatrixView5xX<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, Dynamic, ViewStorage<'a, T, U5, Dynamic, RStride, CStride>>;
/// A column-major matrix view with 6 rows and a number of columns chosen at runtime.
pub type MatrixView6xX<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, Dynamic, ViewStorage<'a, T, U6, Dynamic, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 1 column.
pub type MatrixViewXx1<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U1, ViewStorage<'a, T, Dynamic, U1, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 2 columns.
pub type MatrixViewXx2<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U2, ViewStorage<'a, T, Dynamic, U2, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 3 columns.
pub type MatrixViewXx3<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U3, ViewStorage<'a, T, Dynamic, U3, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 4 columns.
pub type MatrixViewXx4<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U4, ViewStorage<'a, T, Dynamic, U4, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 5 columns.
pub type MatrixViewXx5<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U5, ViewStorage<'a, T, Dynamic, U5, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 6 columns.
pub type MatrixViewXx6<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U6, ViewStorage<'a, T, Dynamic, U6, RStride, CStride>>;
/// A column vector view with dimensions known at compile-time.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type VectorView<'a, T, D, RStride = U1, CStride = D> =
Matrix<T, D, U1, ViewStorage<'a, T, D, U1, RStride, CStride>>;
/// A column vector view with dimensions known at compile-time.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type SVectorView<'a, T, const D: usize> =
Matrix<T, Const<D>, Const<1>, ViewStorage<'a, T, Const<D>, Const<1>, Const<1>, Const<D>>>;
/// A column vector view dynamic numbers of rows and columns.
pub type DVectorView<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U1, ViewStorage<'a, T, Dynamic, U1, RStride, CStride>>;
/// A 1D column vector view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type VectorView1<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U1, ViewStorage<'a, T, U1, U1, RStride, CStride>>;
/// A 2D column vector view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type VectorView2<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U1, ViewStorage<'a, T, U2, U1, RStride, CStride>>;
/// A 3D column vector view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type VectorView3<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U1, ViewStorage<'a, T, U3, U1, RStride, CStride>>;
/// A 4D column vector view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type VectorView4<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U1, ViewStorage<'a, T, U4, U1, RStride, CStride>>;
/// A 5D column vector view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type VectorView5<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U1, ViewStorage<'a, T, U5, U1, RStride, CStride>>;
/// A 6D column vector view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type VectorView6<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U1, ViewStorage<'a, T, U6, U1, RStride, CStride>>;
/*
*
*
* Same thing, but for mutable views.
*
*
*/
/// A column-major matrix view with dimensions known at compile-time.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type SMatrixViewMut<'a, T, const R: usize, const C: usize> =
Matrix<T, Const<R>, Const<C>, ViewStorageMut<'a, T, Const<R>, Const<C>, Const<1>, Const<R>>>;
/// A column-major matrix view dynamic numbers of rows and columns.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type DMatrixViewMut<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, Dynamic, ViewStorageMut<'a, T, Dynamic, Dynamic, RStride, CStride>>;
/// A column-major 1x1 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut1<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U1, ViewStorageMut<'a, T, U1, U1, RStride, CStride>>;
/// A column-major 2x2 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut2<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U2, ViewStorageMut<'a, T, U2, U2, RStride, CStride>>;
/// A column-major 3x3 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut3<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U3, ViewStorageMut<'a, T, U3, U3, RStride, CStride>>;
/// A column-major 4x4 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut4<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U4, ViewStorageMut<'a, T, U4, U4, RStride, CStride>>;
/// A column-major 5x5 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut5<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U5, ViewStorageMut<'a, T, U5, U5, RStride, CStride>>;
/// A column-major 6x6 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut6<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U6, ViewStorageMut<'a, T, U6, U6, RStride, CStride>>;
/// A column-major 1x2 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut1x2<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U2, ViewStorageMut<'a, T, U1, U2, RStride, CStride>>;
/// A column-major 1x3 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut1x3<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U3, ViewStorageMut<'a, T, U1, U3, RStride, CStride>>;
/// A column-major 1x4 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut1x4<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U4, ViewStorageMut<'a, T, U1, U4, RStride, CStride>>;
/// A column-major 1x5 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut1x5<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U5, ViewStorageMut<'a, T, U1, U5, RStride, CStride>>;
/// A column-major 1x6 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut1x6<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U6, ViewStorageMut<'a, T, U1, U6, RStride, CStride>>;
/// A column-major 2x1 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut2x1<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U1, ViewStorageMut<'a, T, U2, U1, RStride, CStride>>;
/// A column-major 2x3 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut2x3<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U3, ViewStorageMut<'a, T, U2, U3, RStride, CStride>>;
/// A column-major 2x4 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut2x4<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U4, ViewStorageMut<'a, T, U2, U4, RStride, CStride>>;
/// A column-major 2x5 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut2x5<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U5, ViewStorageMut<'a, T, U2, U5, RStride, CStride>>;
/// A column-major 2x6 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut2x6<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U6, ViewStorageMut<'a, T, U2, U6, RStride, CStride>>;
/// A column-major 3x1 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut3x1<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U1, ViewStorageMut<'a, T, U3, U1, RStride, CStride>>;
/// A column-major 3x2 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut3x2<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U2, ViewStorageMut<'a, T, U3, U2, RStride, CStride>>;
/// A column-major 3x4 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut3x4<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U4, ViewStorageMut<'a, T, U3, U4, RStride, CStride>>;
/// A column-major 3x5 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut3x5<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U5, ViewStorageMut<'a, T, U3, U5, RStride, CStride>>;
/// A column-major 3x6 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut3x6<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U6, ViewStorageMut<'a, T, U3, U6, RStride, CStride>>;
/// A column-major 4x1 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut4x1<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U1, ViewStorageMut<'a, T, U4, U1, RStride, CStride>>;
/// A column-major 4x2 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut4x2<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U2, ViewStorageMut<'a, T, U4, U2, RStride, CStride>>;
/// A column-major 4x3 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut4x3<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U3, ViewStorageMut<'a, T, U4, U3, RStride, CStride>>;
/// A column-major 4x5 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut4x5<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U5, ViewStorageMut<'a, T, U4, U5, RStride, CStride>>;
/// A column-major 4x6 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut4x6<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U6, ViewStorageMut<'a, T, U4, U6, RStride, CStride>>;
/// A column-major 5x1 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut5x1<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U1, ViewStorageMut<'a, T, U5, U1, RStride, CStride>>;
/// A column-major 5x2 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut5x2<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U2, ViewStorageMut<'a, T, U5, U2, RStride, CStride>>;
/// A column-major 5x3 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut5x3<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U3, ViewStorageMut<'a, T, U5, U3, RStride, CStride>>;
/// A column-major 5x4 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut5x4<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U4, ViewStorageMut<'a, T, U5, U4, RStride, CStride>>;
/// A column-major 5x6 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut5x6<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U6, ViewStorageMut<'a, T, U5, U6, RStride, CStride>>;
/// A column-major 6x1 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut6x1<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U1, ViewStorageMut<'a, T, U6, U1, RStride, CStride>>;
/// A column-major 6x2 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut6x2<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U2, ViewStorageMut<'a, T, U6, U2, RStride, CStride>>;
/// A column-major 6x3 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut6x3<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U3, ViewStorageMut<'a, T, U6, U3, RStride, CStride>>;
/// A column-major 6x4 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut6x4<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U4, ViewStorageMut<'a, T, U6, U4, RStride, CStride>>;
/// A column-major 6x5 matrix view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type MatrixViewMut6x5<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U5, ViewStorageMut<'a, T, U6, U5, RStride, CStride>>;
/// A column-major matrix view with 1 row and a number of columns chosen at runtime.
pub type MatrixViewMut1xX<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, Dynamic, ViewStorageMut<'a, T, U1, Dynamic, RStride, CStride>>;
/// A column-major matrix view with 2 rows and a number of columns chosen at runtime.
pub type MatrixViewMut2xX<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, Dynamic, ViewStorageMut<'a, T, U2, Dynamic, RStride, CStride>>;
/// A column-major matrix view with 3 rows and a number of columns chosen at runtime.
pub type MatrixViewMut3xX<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, Dynamic, ViewStorageMut<'a, T, U3, Dynamic, RStride, CStride>>;
/// A column-major matrix view with 4 rows and a number of columns chosen at runtime.
pub type MatrixViewMut4xX<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, Dynamic, ViewStorageMut<'a, T, U4, Dynamic, RStride, CStride>>;
/// A column-major matrix view with 5 rows and a number of columns chosen at runtime.
pub type MatrixViewMut5xX<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, Dynamic, ViewStorageMut<'a, T, U5, Dynamic, RStride, CStride>>;
/// A column-major matrix view with 6 rows and a number of columns chosen at runtime.
pub type MatrixViewMut6xX<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, Dynamic, ViewStorageMut<'a, T, U6, Dynamic, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 1 column.
pub type MatrixViewMutXx1<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U1, ViewStorageMut<'a, T, Dynamic, U1, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 2 columns.
pub type MatrixViewMutXx2<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U2, ViewStorageMut<'a, T, Dynamic, U2, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 3 columns.
pub type MatrixViewMutXx3<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U3, ViewStorageMut<'a, T, Dynamic, U3, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 4 columns.
pub type MatrixViewMutXx4<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U4, ViewStorageMut<'a, T, Dynamic, U4, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 5 columns.
pub type MatrixViewMutXx5<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U5, ViewStorageMut<'a, T, Dynamic, U5, RStride, CStride>>;
/// A column-major matrix view with a number of rows chosen at runtime and 6 columns.
pub type MatrixViewMutXx6<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U6, ViewStorageMut<'a, T, Dynamic, U6, RStride, CStride>>;
/// A column vector view with dimensions known at compile-time.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type VectorViewMut<'a, T, D, RStride = U1, CStride = D> =
Matrix<T, D, U1, ViewStorageMut<'a, T, D, U1, RStride, CStride>>;
/// A column vector view with dimensions known at compile-time.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type SVectorViewMut<'a, T, const D: usize> =
Matrix<T, Const<D>, Const<1>, ViewStorageMut<'a, T, Const<D>, Const<1>, Const<1>, Const<D>>>;
/// A column vector view dynamic numbers of rows and columns.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type DVectorViewMut<'a, T, RStride = U1, CStride = Dynamic> =
Matrix<T, Dynamic, U1, ViewStorageMut<'a, T, Dynamic, U1, RStride, CStride>>;
/// A 1D column vector view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type VectorViewMut1<'a, T, RStride = U1, CStride = U1> =
Matrix<T, U1, U1, ViewStorageMut<'a, T, U1, U1, RStride, CStride>>;
/// A 2D column vector view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type VectorViewMut2<'a, T, RStride = U1, CStride = U2> =
Matrix<T, U2, U1, ViewStorageMut<'a, T, U2, U1, RStride, CStride>>;
/// A 3D column vector view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type VectorViewMut3<'a, T, RStride = U1, CStride = U3> =
Matrix<T, U3, U1, ViewStorageMut<'a, T, U3, U1, RStride, CStride>>;
/// A 4D column vector view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type VectorViewMut4<'a, T, RStride = U1, CStride = U4> =
Matrix<T, U4, U1, ViewStorageMut<'a, T, U4, U1, RStride, CStride>>;
/// A 5D column vector view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type VectorViewMut5<'a, T, RStride = U1, CStride = U5> =
Matrix<T, U5, U1, ViewStorageMut<'a, T, U5, U1, RStride, CStride>>;
/// A 6D column vector view.
///
/// **Because this is an alias, not all its methods are listed here. See the [`Matrix`](crate::base::Matrix) type too.**
pub type VectorViewMut6<'a, T, RStride = U1, CStride = U6> =
Matrix<T, U6, U1, ViewStorageMut<'a, T, U6, U1, RStride, CStride>>;

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,
@ -393,7 +393,7 @@ where
let col2 = a.column(0);
let val = unsafe { x.vget_unchecked(0).clone() };
self.axpy(alpha.clone() * val, &col2, beta);
self[0] += alpha.clone() * dot(&a.slice_range(1.., 0), &x.rows_range(1..));
self[0] += alpha.clone() * dot(&a.view_range(1.., 0), &x.rows_range(1..));
for j in 1..dim2 {
let col2 = a.column(j);
@ -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>,
@ -892,7 +892,7 @@ where
let val = unsafe { conjugate(y.vget_unchecked(j).clone()) };
let subdim = Dynamic::new(dim1 - j);
// TODO: avoid bound checks.
self.generic_slice_mut((j, j), (subdim, Const::<1>)).axpy(
self.generic_view_mut((j, j), (subdim, Const::<1>)).axpy(
alpha.clone() * val,
&x.rows_range(j..),
beta.clone(),

View File

@ -59,7 +59,7 @@ where
SB: Storage<T, DimNameDiff<D, U1>>,
{
let mut res = Self::identity();
res.generic_slice_mut(
res.generic_view_mut(
(0, D::dim() - 1),
(DimNameDiff::<D, U1>::name(), Const::<1>),
)
@ -382,19 +382,19 @@ impl<T: Scalar + Zero + One + ClosedMul + ClosedAdd, D: DimName, S: Storage<T, D
DefaultAllocator: Allocator<T, DimNameDiff<D, U1>>,
{
let scale = self
.generic_slice(
.generic_view(
(D::dim() - 1, 0),
(Const::<1>, DimNameDiff::<D, U1>::name()),
)
.tr_dot(shift);
let post_translation = self.generic_slice(
let post_translation = self.generic_view(
(0, 0),
(DimNameDiff::<D, U1>::name(), DimNameDiff::<D, U1>::name()),
) * shift;
self[(D::dim() - 1, D::dim() - 1)] += scale;
let mut translation = self.generic_slice_mut(
let mut translation = self.generic_view_mut(
(0, D::dim() - 1),
(DimNameDiff::<D, U1>::name(), Const::<1>),
);
@ -415,11 +415,11 @@ where
&self,
v: &OVector<T, DimNameDiff<D, U1>>,
) -> OVector<T, DimNameDiff<D, U1>> {
let transform = self.generic_slice(
let transform = self.generic_view(
(0, 0),
(DimNameDiff::<D, U1>::name(), DimNameDiff::<D, U1>::name()),
);
let normalizer = self.generic_slice(
let normalizer = self.generic_view(
(D::dim() - 1, 0),
(Const::<1>, DimNameDiff::<D, U1>::name()),
);
@ -437,9 +437,9 @@ impl<T: RealField, S: Storage<T, Const<3>, Const<3>>> SquareMatrix<T, Const<3>,
/// Transforms the given point, assuming the matrix `self` uses homogeneous coordinates.
#[inline]
pub fn transform_point(&self, pt: &Point<T, 2>) -> Point<T, 2> {
let transform = self.fixed_slice::<2, 2>(0, 0);
let translation = self.fixed_slice::<2, 1>(0, 2);
let normalizer = self.fixed_slice::<1, 2>(2, 0);
let transform = self.fixed_view::<2, 2>(0, 0);
let translation = self.fixed_view::<2, 1>(0, 2);
let normalizer = self.fixed_view::<1, 2>(2, 0);
let n = normalizer.tr_dot(&pt.coords) + unsafe { self.get_unchecked((2, 2)).clone() };
if !n.is_zero() {
@ -454,9 +454,9 @@ impl<T: RealField, S: Storage<T, Const<4>, Const<4>>> SquareMatrix<T, Const<4>,
/// Transforms the given point, assuming the matrix `self` uses homogeneous coordinates.
#[inline]
pub fn transform_point(&self, pt: &Point<T, 3>) -> Point<T, 3> {
let transform = self.fixed_slice::<3, 3>(0, 0);
let translation = self.fixed_slice::<3, 1>(0, 3);
let normalizer = self.fixed_slice::<1, 3>(3, 0);
let transform = self.fixed_view::<3, 3>(0, 0);
let translation = self.fixed_view::<3, 1>(0, 3);
let normalizer = self.fixed_view::<1, 3>(3, 0);
let n = normalizer.tr_dot(&pt.coords) + unsafe { self.get_unchecked((3, 3)).clone() };
if !n.is_zero() {

View File

@ -1,14 +1,14 @@
use crate::base::dimension::{Const, Dim, DimName, Dynamic};
use crate::base::matrix_slice::{SliceStorage, SliceStorageMut};
use crate::base::{MatrixSlice, MatrixSliceMutMN, Scalar};
use crate::base::matrix_view::{ViewStorage, ViewStorageMut};
use crate::base::{MatrixView, MatrixViewMut, Scalar};
use num_rational::Ratio;
/// # Creating matrix slices from `&[T]`
/// # Creating matrix views from `&[T]`
impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
MatrixSlice<'a, T, R, C, RStride, CStride>
MatrixView<'a, T, R, C, RStride, CStride>
{
/// Creates, without bound-checking, a matrix slice from an array and with dimensions and strides specified by generic types instances.
/// Creates, without bounds checking, a matrix view from an array and with dimensions and strides specified by generic types instances.
///
/// # Safety
/// This method is unsafe because the input data array is not checked to contain enough elements.
@ -22,7 +22,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
rstride: RStride,
cstride: CStride,
) -> Self {
let data = SliceStorage::from_raw_parts(
let data = ViewStorage::from_raw_parts(
data.as_ptr().add(start),
(nrows, ncols),
(rstride, cstride),
@ -30,7 +30,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
Self::from_data(data)
}
/// Creates a matrix slice from an array and with dimensions and strides specified by generic types instances.
/// Creates a matrix view from an array and with dimensions and strides specified by generic types instances.
///
/// Panics if the input data array dose not contain enough elements.
/// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`.
@ -48,7 +48,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
assert!(
data.len() + cstride.value() + rstride.value()
>= ncols.value() * cstride.value() + nrows.value() * rstride.value() + 1,
"Matrix slice: input data buffer to small."
"Matrix view: input data buffer too small."
);
unsafe {
@ -57,8 +57,8 @@ impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
}
}
impl<'a, T: Scalar, R: Dim, C: Dim> MatrixSlice<'a, T, R, C> {
/// Creates, without bound-checking, a matrix slice from an array and with dimensions specified by generic types instances.
impl<'a, T: Scalar, R: Dim, C: Dim> MatrixView<'a, T, R, C> {
/// Creates, without bound-checking, a matrix view from an array and with dimensions specified by generic types instances.
///
/// # Safety
/// This method is unsafe because the input data array is not checked to contain enough elements.
@ -75,7 +75,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim> MatrixSlice<'a, T, R, C> {
)
}
/// Creates a matrix slice from an array and with dimensions and strides specified by generic types instances.
/// Creates a matrix view from an array and with dimensions and strides specified by generic types instances.
///
/// Panics if the input data array dose not contain enough elements.
/// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`.
@ -87,8 +87,8 @@ impl<'a, T: Scalar, R: Dim, C: Dim> MatrixSlice<'a, T, R, C> {
macro_rules! impl_constructors(
($($Dims: ty),*; $(=> $DimIdent: ident: $DimBound: ident),*; $($gargs: expr),*; $($args: ident),*) => {
impl<'a, T: Scalar, $($DimIdent: $DimBound),*> MatrixSlice<'a, T, $($Dims),*> {
/// Creates a new matrix slice from the given data array.
impl<'a, T: Scalar, $($DimIdent: $DimBound),*> MatrixView<'a, T, $($Dims),*> {
/// Creates a new matrix view from the given data array.
///
/// Panics if `data` does not contain enough elements.
#[inline]
@ -96,15 +96,15 @@ macro_rules! impl_constructors(
Self::from_slice_generic(data, $($gargs),*)
}
/// Creates, without bound checking, a new matrix slice from the given data array.
/// Creates, without bound checking, a new matrix view from the given data array.
#[inline]
pub unsafe fn from_slice_unchecked(data: &'a [T], start: usize, $($args: usize),*) -> Self {
Self::from_slice_generic_unchecked(data, start, $($gargs),*)
}
}
impl<'a, T: Scalar, $($DimIdent: $DimBound, )*> MatrixSlice<'a, T, $($Dims,)* Dynamic, Dynamic> {
/// Creates a new matrix slice with the specified strides from the given data array.
impl<'a, T: Scalar, $($DimIdent: $DimBound, )*> MatrixView<'a, T, $($Dims,)* Dynamic, Dynamic> {
/// Creates a new matrix view with the specified strides from the given data array.
///
/// Panics if `data` does not contain enough elements.
#[inline]
@ -112,7 +112,7 @@ macro_rules! impl_constructors(
Self::from_slice_with_strides_generic(data, $($gargs,)* Dynamic::new(rstride), Dynamic::new(cstride))
}
/// Creates, without bound checking, a new matrix slice with the specified strides from the given data array.
/// Creates, without bound checking, a new matrix view with the specified strides from the given data array.
#[inline]
pub unsafe fn from_slice_with_strides_unchecked(data: &'a [T], start: usize, $($args: usize,)* rstride: usize, cstride: usize) -> Self {
Self::from_slice_with_strides_generic_unchecked(data, start, $($gargs,)* Dynamic::new(rstride), Dynamic::new(cstride))
@ -142,11 +142,11 @@ impl_constructors!(Dynamic, Dynamic;
Dynamic::new(nrows), Dynamic::new(ncols);
nrows, ncols);
/// # Creating mutable matrix slices from `&mut [T]`
/// # Creating mutable matrix views from `&mut [T]`
impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
MatrixSliceMutMN<'a, T, R, C, RStride, CStride>
MatrixViewMut<'a, T, R, C, RStride, CStride>
{
/// Creates, without bound-checking, a mutable matrix slice from an array and with dimensions and strides specified by generic types instances.
/// Creates, without bound-checking, a mutable matrix view from an array and with dimensions and strides specified by generic types instances.
///
/// # Safety
/// This method is unsafe because the input data array is not checked to contain enough elements.
@ -160,7 +160,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
rstride: RStride,
cstride: CStride,
) -> Self {
let data = SliceStorageMut::from_raw_parts(
let data = ViewStorageMut::from_raw_parts(
data.as_mut_ptr().add(start),
(nrows, ncols),
(rstride, cstride),
@ -168,7 +168,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
Self::from_data(data)
}
/// Creates a mutable matrix slice from an array and with dimensions and strides specified by generic types instances.
/// Creates a mutable matrix view from an array and with dimensions and strides specified by generic types instances.
///
/// Panics if the input data array dose not contain enough elements.
/// The generic types `R`, `C`, `RStride`, `CStride` can either be type-level integers or integers wrapped with `Dynamic::new()`.
@ -186,7 +186,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
assert!(
data.len() + cstride.value() + rstride.value()
>= ncols.value() * cstride.value() + nrows.value() * rstride.value() + 1,
"Matrix slice: input data buffer to small."
"Matrix view: input data buffer too small."
);
assert!(
@ -208,7 +208,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
}
}
},
"Matrix slice: dimensions and strides result in aliased indices."
"Matrix view: dimensions and strides result in aliased indices."
);
unsafe {
@ -217,8 +217,8 @@ impl<'a, T: Scalar, R: Dim, C: Dim, RStride: Dim, CStride: Dim>
}
}
impl<'a, T: Scalar, R: Dim, C: Dim> MatrixSliceMutMN<'a, T, R, C> {
/// Creates, without bound-checking, a mutable matrix slice from an array and with dimensions specified by generic types instances.
impl<'a, T: Scalar, R: Dim, C: Dim> MatrixViewMut<'a, T, R, C> {
/// Creates, without bound-checking, a mutable matrix view from an array and with dimensions specified by generic types instances.
///
/// # Safety
/// This method is unsafe because the input data array is not checked to contain enough elements.
@ -235,7 +235,7 @@ impl<'a, T: Scalar, R: Dim, C: Dim> MatrixSliceMutMN<'a, T, R, C> {
)
}
/// Creates a mutable matrix slice from an array and with dimensions and strides specified by generic types instances.
/// Creates a mutable matrix view from an array and with dimensions and strides specified by generic types instances.
///
/// Panics if the input data array dose not contain enough elements.
/// The generic types `R` and `C` can either be type-level integers or integers wrapped with `Dynamic::new()`.
@ -247,8 +247,8 @@ impl<'a, T: Scalar, R: Dim, C: Dim> MatrixSliceMutMN<'a, T, R, C> {
macro_rules! impl_constructors_mut(
($($Dims: ty),*; $(=> $DimIdent: ident: $DimBound: ident),*; $($gargs: expr),*; $($args: ident),*) => {
impl<'a, T: Scalar, $($DimIdent: $DimBound),*> MatrixSliceMutMN<'a, T, $($Dims),*> {
/// Creates a new mutable matrix slice from the given data array.
impl<'a, T: Scalar, $($DimIdent: $DimBound),*> MatrixViewMut<'a, T, $($Dims),*> {
/// Creates a new mutable matrix view from the given data array.
///
/// Panics if `data` does not contain enough elements.
#[inline]
@ -256,15 +256,15 @@ macro_rules! impl_constructors_mut(
Self::from_slice_generic(data, $($gargs),*)
}
/// Creates, without bound checking, a new mutable matrix slice from the given data array.
/// Creates, without bound checking, a new mutable matrix view from the given data array.
#[inline]
pub unsafe fn from_slice_unchecked(data: &'a mut [T], start: usize, $($args: usize),*) -> Self {
Self::from_slice_generic_unchecked(data, start, $($gargs),*)
}
}
impl<'a, T: Scalar, $($DimIdent: $DimBound, )*> MatrixSliceMutMN<'a, T, $($Dims,)* Dynamic, Dynamic> {
/// Creates a new mutable matrix slice with the specified strides from the given data array.
impl<'a, T: Scalar, $($DimIdent: $DimBound, )*> MatrixViewMut<'a, T, $($Dims,)* Dynamic, Dynamic> {
/// Creates a new mutable matrix view with the specified strides from the given data array.
///
/// Panics if `data` does not contain enough elements.
#[inline]
@ -273,7 +273,7 @@ macro_rules! impl_constructors_mut(
data, $($gargs,)* Dynamic::new(rstride), Dynamic::new(cstride))
}
/// Creates, without bound checking, a new mutable matrix slice with the specified strides from the given data array.
/// Creates, without bound checking, a new mutable matrix view with the specified strides from the given data array.
#[inline]
pub unsafe fn from_slice_with_strides_unchecked(data: &'a mut [T], start: usize, $($args: usize,)* rstride: usize, cstride: usize) -> Self {
Self::from_slice_with_strides_generic_unchecked(

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, MatrixSlice,
MatrixSliceMut, OMatrix, Scalar,
ArrayStorage, DVectorView, DVectorViewMut, DefaultAllocator, Matrix, MatrixView, MatrixViewMut,
OMatrix, Scalar,
};
#[cfg(any(feature = "std", feature = "alloc"))]
use crate::base::{DVector, RowDVector, VecStorage};
use crate::base::{SliceStorage, SliceStorageMut};
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()
}
}
@ -221,19 +221,19 @@ impl<T: Scalar, const R: usize, const C: usize> From<SMatrix<T, R, C>> for [[T;
}
impl<'a, T: Scalar, RStride: Dim, CStride: Dim, const R: usize, const C: usize>
From<MatrixSlice<'a, T, Const<R>, Const<C>, RStride, CStride>> for [[T; R]; C]
From<MatrixView<'a, T, Const<R>, Const<C>, RStride, CStride>> for [[T; R]; C]
{
#[inline]
fn from(mat: MatrixSlice<'a, T, Const<R>, Const<C>, RStride, CStride>) -> Self {
fn from(mat: MatrixView<'a, T, Const<R>, Const<C>, RStride, CStride>) -> Self {
mat.into_owned().into()
}
}
impl<'a, T: Scalar, RStride: Dim, CStride: Dim, const R: usize, const C: usize>
From<MatrixSliceMut<'a, T, Const<R>, Const<C>, RStride, CStride>> for [[T; R]; C]
From<MatrixViewMut<'a, T, Const<R>, Const<C>, RStride, CStride>> for [[T; R]; C]
{
#[inline]
fn from(mat: MatrixSliceMut<'a, T, Const<R>, Const<C>, RStride, CStride>) -> Self {
fn from(mat: MatrixViewMut<'a, T, Const<R>, Const<C>, RStride, CStride>) -> Self {
mat.into_owned().into()
}
}
@ -289,20 +289,20 @@ impl_from_into_asref_borrow_2D!(
);
impl<'a, T, RStride, CStride, const R: usize, const C: usize>
From<MatrixSlice<'a, T, Const<R>, Const<C>, RStride, CStride>>
From<MatrixView<'a, T, Const<R>, Const<C>, RStride, CStride>>
for Matrix<T, Const<R>, Const<C>, ArrayStorage<T, R, C>>
where
T: Scalar,
RStride: Dim,
CStride: Dim,
{
fn from(matrix_slice: MatrixSlice<'a, T, Const<R>, Const<C>, RStride, CStride>) -> Self {
matrix_slice.into_owned()
fn from(matrix_view: MatrixView<'a, T, Const<R>, Const<C>, RStride, CStride>) -> Self {
matrix_view.into_owned()
}
}
#[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, T, C, RStride, CStride> From<MatrixSlice<'a, T, Dynamic, C, RStride, CStride>>
impl<'a, T, C, RStride, CStride> From<MatrixView<'a, T, Dynamic, C, RStride, CStride>>
for Matrix<T, Dynamic, C, VecStorage<T, Dynamic, C>>
where
T: Scalar,
@ -310,13 +310,13 @@ where
RStride: Dim,
CStride: Dim,
{
fn from(matrix_slice: MatrixSlice<'a, T, Dynamic, C, RStride, CStride>) -> Self {
matrix_slice.into_owned()
fn from(matrix_view: MatrixView<'a, T, Dynamic, C, RStride, CStride>) -> Self {
matrix_view.into_owned()
}
}
#[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, T, R, RStride, CStride> From<MatrixSlice<'a, T, R, Dynamic, RStride, CStride>>
impl<'a, T, R, RStride, CStride> From<MatrixView<'a, T, R, Dynamic, RStride, CStride>>
for Matrix<T, R, Dynamic, VecStorage<T, R, Dynamic>>
where
T: Scalar,
@ -324,26 +324,26 @@ where
RStride: Dim,
CStride: Dim,
{
fn from(matrix_slice: MatrixSlice<'a, T, R, Dynamic, RStride, CStride>) -> Self {
matrix_slice.into_owned()
fn from(matrix_view: MatrixView<'a, T, R, Dynamic, RStride, CStride>) -> Self {
matrix_view.into_owned()
}
}
impl<'a, T, RStride, CStride, const R: usize, const C: usize>
From<MatrixSliceMut<'a, T, Const<R>, Const<C>, RStride, CStride>>
From<MatrixViewMut<'a, T, Const<R>, Const<C>, RStride, CStride>>
for Matrix<T, Const<R>, Const<C>, ArrayStorage<T, R, C>>
where
T: Scalar,
RStride: Dim,
CStride: Dim,
{
fn from(matrix_slice: MatrixSliceMut<'a, T, Const<R>, Const<C>, RStride, CStride>) -> Self {
matrix_slice.into_owned()
fn from(matrix_view: MatrixViewMut<'a, T, Const<R>, Const<C>, RStride, CStride>) -> Self {
matrix_view.into_owned()
}
}
#[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, T, C, RStride, CStride> From<MatrixSliceMut<'a, T, Dynamic, C, RStride, CStride>>
impl<'a, T, C, RStride, CStride> From<MatrixViewMut<'a, T, Dynamic, C, RStride, CStride>>
for Matrix<T, Dynamic, C, VecStorage<T, Dynamic, C>>
where
T: Scalar,
@ -351,13 +351,13 @@ where
RStride: Dim,
CStride: Dim,
{
fn from(matrix_slice: MatrixSliceMut<'a, T, Dynamic, C, RStride, CStride>) -> Self {
matrix_slice.into_owned()
fn from(matrix_view: MatrixViewMut<'a, T, Dynamic, C, RStride, CStride>) -> Self {
matrix_view.into_owned()
}
}
#[cfg(any(feature = "std", feature = "alloc"))]
impl<'a, T, R, RStride, CStride> From<MatrixSliceMut<'a, T, R, Dynamic, RStride, CStride>>
impl<'a, T, R, RStride, CStride> From<MatrixViewMut<'a, T, R, Dynamic, RStride, CStride>>
for Matrix<T, R, Dynamic, VecStorage<T, R, Dynamic>>
where
T: Scalar,
@ -365,116 +365,107 @@ where
RStride: Dim,
CStride: Dim,
{
fn from(matrix_slice: MatrixSliceMut<'a, T, R, Dynamic, RStride, CStride>) -> Self {
matrix_slice.into_owned()
fn from(matrix_view: MatrixViewMut<'a, T, R, Dynamic, RStride, CStride>) -> Self {
matrix_view.into_owned()
}
}
impl<'a, T, R, C, RSlice, CSlice, RStride, CStride, S> From<&'a Matrix<T, R, C, S>>
for MatrixSlice<'a, T, RSlice, CSlice, RStride, CStride>
impl<'a, T, R, C, RView, CView, RStride, CStride, S> From<&'a Matrix<T, R, C, S>>
for MatrixView<'a, T, RView, CView, RStride, CStride>
where
T: Scalar,
R: Dim,
C: Dim,
RSlice: Dim,
CSlice: Dim,
RView: Dim,
CView: Dim,
RStride: Dim,
CStride: Dim,
S: RawStorage<T, R, C>,
ShapeConstraint: DimEq<R, RSlice>
+ DimEq<C, CSlice>
+ DimEq<RStride, S::RStride>
+ DimEq<CStride, S::CStride>,
ShapeConstraint:
DimEq<R, RView> + DimEq<C, CView> + DimEq<RStride, S::RStride> + DimEq<CStride, S::CStride>,
{
fn from(m: &'a Matrix<T, R, C, S>) -> Self {
let (row, col) = m.shape_generic();
let row_slice = RSlice::from_usize(row.value());
let col_slice = CSlice::from_usize(col.value());
let rows_result = RView::from_usize(row.value());
let cols_result = CView::from_usize(col.value());
let (rstride, cstride) = m.strides();
let rstride_slice = RStride::from_usize(rstride);
let cstride_slice = CStride::from_usize(cstride);
let rstride_result = RStride::from_usize(rstride);
let cstride_result = CStride::from_usize(cstride);
unsafe {
let data = SliceStorage::from_raw_parts(
let data = ViewStorage::from_raw_parts(
m.data.ptr(),
(row_slice, col_slice),
(rstride_slice, cstride_slice),
(rows_result, cols_result),
(rstride_result, cstride_result),
);
Matrix::from_data_statically_unchecked(data)
}
}
}
impl<'a, T, R, C, RSlice, CSlice, RStride, CStride, S> From<&'a mut Matrix<T, R, C, S>>
for MatrixSlice<'a, T, RSlice, CSlice, RStride, CStride>
impl<'a, T, R, C, RView, CView, RStride, CStride, S> From<&'a mut Matrix<T, R, C, S>>
for MatrixView<'a, T, RView, CView, RStride, CStride>
where
T: Scalar,
R: Dim,
C: Dim,
RSlice: Dim,
CSlice: Dim,
RView: Dim,
CView: Dim,
RStride: Dim,
CStride: Dim,
S: RawStorage<T, R, C>,
ShapeConstraint: DimEq<R, RSlice>
+ DimEq<C, CSlice>
+ DimEq<RStride, S::RStride>
+ DimEq<CStride, S::CStride>,
ShapeConstraint:
DimEq<R, RView> + DimEq<C, CView> + DimEq<RStride, S::RStride> + DimEq<CStride, S::CStride>,
{
fn from(m: &'a mut Matrix<T, R, C, S>) -> Self {
let (row, col) = m.shape_generic();
let row_slice = RSlice::from_usize(row.value());
let col_slice = CSlice::from_usize(col.value());
let rows_result = RView::from_usize(row.value());
let cols_result = CView::from_usize(col.value());
let (rstride, cstride) = m.strides();
let rstride_slice = RStride::from_usize(rstride);
let cstride_slice = CStride::from_usize(cstride);
let rstride_result = RStride::from_usize(rstride);
let cstride_result = CStride::from_usize(cstride);
unsafe {
let data = SliceStorage::from_raw_parts(
let data = ViewStorage::from_raw_parts(
m.data.ptr(),
(row_slice, col_slice),
(rstride_slice, cstride_slice),
(rows_result, cols_result),
(rstride_result, cstride_result),
);
Matrix::from_data_statically_unchecked(data)
}
}
}
impl<'a, T, R, C, RSlice, CSlice, RStride, CStride, S> From<&'a mut Matrix<T, R, C, S>>
for MatrixSliceMut<'a, T, RSlice, CSlice, RStride, CStride>
impl<'a, T, R, C, RView, CView, RStride, CStride, S> From<&'a mut Matrix<T, R, C, S>>
for MatrixViewMut<'a, T, RView, CView, RStride, CStride>
where
T: Scalar,
R: Dim,
C: Dim,
RSlice: Dim,
CSlice: Dim,
RView: Dim,
CView: Dim,
RStride: Dim,
CStride: Dim,
S: RawStorageMut<T, R, C>,
ShapeConstraint: DimEq<R, RSlice>
+ DimEq<C, CSlice>
+ DimEq<RStride, S::RStride>
+ DimEq<CStride, S::CStride>,
ShapeConstraint:
DimEq<R, RView> + DimEq<C, CView> + DimEq<RStride, S::RStride> + DimEq<CStride, S::CStride>,
{
fn from(m: &'a mut Matrix<T, R, C, S>) -> Self {
let (row, col) = m.shape_generic();
let row_slice = RSlice::from_usize(row.value());
let col_slice = CSlice::from_usize(col.value());
let rows_result = RView::from_usize(row.value());
let cols_result = CView::from_usize(col.value());
let (rstride, cstride) = m.strides();
let rstride_slice = RStride::from_usize(rstride);
let cstride_slice = CStride::from_usize(cstride);
let rstride_result = RStride::from_usize(rstride);
let cstride_result = CStride::from_usize(cstride);
unsafe {
let data = SliceStorageMut::from_raw_parts(
let data = ViewStorageMut::from_raw_parts(
m.data.ptr_mut(),
(row_slice, col_slice),
(rstride_slice, cstride_slice),
(rows_result, cols_result),
(rstride_result, cstride_result),
);
Matrix::from_data_statically_unchecked(data)
}
@ -515,28 +506,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

@ -938,7 +938,7 @@ impl<T: Scalar, R: Dim, C: Dim, S: Storage<T, R, C>> Matrix<T, R, C, S> {
}
if new_nrows.value() > nrows {
res.slice_range_mut(nrows.., ..cmp::min(ncols, new_ncols.value()))
res.view_range_mut(nrows.., ..cmp::min(ncols, new_ncols.value()))
.fill_with(|| MaybeUninit::new(val.clone()));
}

View File

@ -3,7 +3,7 @@
use crate::base::storage::{RawStorage, RawStorageMut};
use crate::base::{
Const, Dim, DimDiff, DimName, DimSub, Dynamic, Matrix, MatrixSlice, MatrixSliceMut, Scalar, U1,
Const, Dim, DimDiff, DimName, DimSub, Dynamic, Matrix, MatrixView, MatrixViewMut, Scalar, U1,
};
use std::ops;
@ -378,7 +378,7 @@ pub trait MatrixIndexMut<'a, T, R: Dim, C: Dim, S: RawStorageMut<T, R, C>>:
}
}
/// # Slicing based on ranges
/// # Views based on ranges
/// ## Indices to Individual Elements
/// ### Two-Dimensional Indices
/// ```
@ -669,7 +669,7 @@ macro_rules! impl_index_pair {
$( $RConstraintType: $RConstraintBound $(<$( $RConstraintBoundParams $( = $REqBound )*),*>)* ,)*
$( $CConstraintType: $CConstraintBound $(<$( $CConstraintBoundParams $( = $CEqBound )*),*>)* ),*
{
type Output = MatrixSlice<'a, T, $ROut, $COut, S::RStride, S::CStride>;
type Output = MatrixView<'a, T, $ROut, $COut, S::RStride, S::CStride>;
#[doc(hidden)]
#[inline(always)]
@ -682,13 +682,13 @@ macro_rules! impl_index_pair {
#[doc(hidden)]
#[inline(always)]
unsafe fn get_unchecked(self, matrix: &'a Matrix<T, $R, $C, S>) -> Self::Output {
use crate::base::SliceStorage;
use crate::base::ViewStorage;
let (rows, cols) = self;
let (nrows, ncols) = matrix.shape_generic();
let data =
SliceStorage::new_unchecked(&matrix.data,
ViewStorage::new_unchecked(&matrix.data,
(rows.lower(nrows), cols.lower(ncols)),
(rows.length(nrows), cols.length(ncols)));
@ -705,18 +705,18 @@ macro_rules! impl_index_pair {
$( $RConstraintType: $RConstraintBound $(<$( $RConstraintBoundParams $( = $REqBound )*),*>)* ,)*
$( $CConstraintType: $CConstraintBound $(<$( $CConstraintBoundParams $( = $CEqBound )*),*>)* ),*
{
type OutputMut = MatrixSliceMut<'a, T, $ROut, $COut, S::RStride, S::CStride>;
type OutputMut = MatrixViewMut<'a, T, $ROut, $COut, S::RStride, S::CStride>;
#[doc(hidden)]
#[inline(always)]
unsafe fn get_unchecked_mut(self, matrix: &'a mut Matrix<T, $R, $C, S>) -> Self::OutputMut {
use crate::base::SliceStorageMut;
use crate::base::ViewStorageMut;
let (rows, cols) = self;
let (nrows, ncols) = matrix.shape_generic();
let data =
SliceStorageMut::new_unchecked(&mut matrix.data,
ViewStorageMut::new_unchecked(&mut matrix.data,
(rows.lower(nrows), cols.lower(ncols)),
(rows.length(nrows), cols.length(ncols)));

View File

@ -6,7 +6,7 @@ use std::mem;
use crate::base::dimension::{Dim, U1};
use crate::base::storage::{RawStorage, RawStorageMut};
use crate::base::{Matrix, MatrixSlice, MatrixSliceMut, Scalar};
use crate::base::{Matrix, MatrixView, MatrixViewMut, Scalar};
macro_rules! iterator {
(struct $Name:ident for $Storage:ident.$ptr: ident -> $Ptr:ty, $Ref:ty, $SRef: ty) => {
@ -193,7 +193,7 @@ impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorage<T, R, C>> RowIter<'a, T, R, C, S>
}
impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorage<T, R, C>> Iterator for RowIter<'a, T, R, C, S> {
type Item = MatrixSlice<'a, T, U1, C, S::RStride, S::CStride>;
type Item = MatrixView<'a, T, U1, C, S::RStride, S::CStride>;
#[inline]
fn next(&mut self) -> Option<Self::Item> {
@ -254,7 +254,7 @@ impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorageMut<T, R, C>> RowIterMut<'a, T, R,
impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorageMut<T, R, C>> Iterator
for RowIterMut<'a, T, R, C, S>
{
type Item = MatrixSliceMut<'a, T, U1, C, S::RStride, S::CStride>;
type Item = MatrixViewMut<'a, T, U1, C, S::RStride, S::CStride>;
#[inline]
fn next(&mut self) -> Option<Self::Item> {
@ -306,7 +306,7 @@ impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorage<T, R, C>> ColumnIter<'a, T, R, C,
}
impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorage<T, R, C>> Iterator for ColumnIter<'a, T, R, C, S> {
type Item = MatrixSlice<'a, T, R, U1, S::RStride, S::CStride>;
type Item = MatrixView<'a, T, R, U1, S::RStride, S::CStride>;
#[inline]
fn next(&mut self) -> Option<Self::Item> {
@ -367,7 +367,7 @@ impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorageMut<T, R, C>> ColumnIterMut<'a, T,
impl<'a, T, R: Dim, C: Dim, S: 'a + RawStorageMut<T, R, C>> Iterator
for ColumnIterMut<'a, T, R, C, S>
{
type Item = MatrixSliceMut<'a, T, R, U1, S::RStride, S::CStride>;
type Item = MatrixViewMut<'a, T, R, U1, S::RStride, S::CStride>;
#[inline]
fn next(&mut self) -> Option<Self::Item> {

View File

@ -99,13 +99,13 @@ pub type MatrixCross<T, R1, C1, R2, C2> =
/// - [Elementwise mapping and folding <span style="float:right;">`map`, `fold`, `zip_map`…</span>](#elementwise-mapping-and-folding)
/// - [Folding or columns and rows <span style="float:right;">`compress_rows`, `compress_columns`…</span>](#folding-on-columns-and-rows)
///
/// #### Vector and matrix slicing
/// - [Creating matrix slices from `&[T]` <span style="float:right;">`from_slice`, `from_slice_with_strides`…</span>](#creating-matrix-slices-from-t)
/// - [Creating mutable matrix slices from `&mut [T]` <span style="float:right;">`from_slice_mut`, `from_slice_with_strides_mut`…</span>](#creating-mutable-matrix-slices-from-mut-t)
/// - [Slicing based on index and length <span style="float:right;">`row`, `columns`, `slice`…</span>](#slicing-based-on-index-and-length)
/// - [Mutable slicing based on index and length <span style="float:right;">`row_mut`, `columns_mut`, `slice_mut`…</span>](#mutable-slicing-based-on-index-and-length)
/// - [Slicing based on ranges <span style="float:right;">`rows_range`, `columns_range`…</span>](#slicing-based-on-ranges)
/// - [Mutable slicing based on ranges <span style="float:right;">`rows_range_mut`, `columns_range_mut`…</span>](#mutable-slicing-based-on-ranges)
/// #### Vector and matrix views
/// - [Creating matrix views from `&[T]` <span style="float:right;">`from_slice`, `from_slice_with_strides`…</span>](#creating-matrix-views-from-t)
/// - [Creating mutable matrix views from `&mut [T]` <span style="float:right;">`from_slice_mut`, `from_slice_with_strides_mut`…</span>](#creating-mutable-matrix-views-from-mut-t)
/// - [Views based on index and length <span style="float:right;">`row`, `columns`, `view`…</span>](#views-based-on-index-and-length)
/// - [Mutable views based on index and length <span style="float:right;">`row_mut`, `columns_mut`, `view_mut`…</span>](#mutable-views-based-on-index-and-length)
/// - [Views based on ranges <span style="float:right;">`rows_range`, `columns_range`…</span>](#views-based-on-ranges)
/// - [Mutable views based on ranges <span style="float:right;">`rows_range_mut`, `columns_range_mut`…</span>](#mutable-views-based-on-ranges)
///
/// #### In-place modification of a single matrix or vector
/// - [In-place filling <span style="float:right;">`fill`, `fill_diagonal`, `fill_with_identity`…</span>](#in-place-filling)
@ -446,7 +446,7 @@ impl<T, R: Dim, C: Dim, S: RawStorage<T, R, C>> Matrix<T, R, C, S> {
/// ```
/// # use nalgebra::DMatrix;
/// let mat = DMatrix::<f32>::zeros(10, 10);
/// let slice = mat.slice_with_steps((0, 0), (5, 3), (1, 2));
/// let view = mat.view_with_steps((0, 0), (5, 3), (1, 2));
/// // The column strides is the number of steps (here 2) multiplied by the corresponding dimension.
/// assert_eq!(mat.strides(), (1, 10));
/// ```
@ -1633,7 +1633,7 @@ impl<T: Scalar + Zero + One, D: DimAdd<U1> + IsNotStaticOne, S: RawStorage<T, D,
);
let dim = DimSum::<D, U1>::from_usize(self.nrows() + 1);
let mut res = OMatrix::identity_generic(dim, dim);
res.generic_slice_mut::<D, D>((0, 0), self.shape_generic())
res.generic_view_mut::<D, D>((0, 0), self.shape_generic())
.copy_from(self);
res
}
@ -1661,7 +1661,7 @@ impl<T: Scalar + Zero, D: DimAdd<U1>, S: RawStorage<T, D>> Vector<T, D, S> {
{
if v[v.len() - 1].is_zero() {
let nrows = D::from_usize(v.len() - 1);
Some(v.generic_slice((0, 0), (nrows, Const::<1>)).into_owned())
Some(v.generic_view((0, 0), (nrows, Const::<1>)).into_owned())
} else {
None
}
@ -1681,7 +1681,7 @@ impl<T: Scalar, D: DimAdd<U1>, S: RawStorage<T, D>> Vector<T, D, S> {
let mut res = Matrix::uninit(hnrows, Const::<1>);
// This is basically a copy_from except that we warp the copied
// values into MaybeUninit.
res.generic_slice_mut((0, 0), self.shape_generic())
res.generic_view_mut((0, 0), self.shape_generic())
.zip_apply(self, |out, e| *out = MaybeUninit::new(e));
res[(len, 0)] = MaybeUninit::new(element);

File diff suppressed because it is too large Load Diff

View File

@ -12,18 +12,19 @@ pub mod storage;
mod alias;
mod alias_slice;
mod alias_view;
mod array_storage;
mod cg;
mod componentwise;
#[macro_use]
mod construction;
mod construction_slice;
mod construction_view;
mod conversion;
mod edition;
pub mod indexing;
mod matrix;
mod matrix_simba;
mod matrix_slice;
mod matrix_view;
mod norm;
mod properties;
mod scalar;
@ -51,8 +52,9 @@ pub use self::dimension::*;
pub use self::alias::*;
pub use self::alias_slice::*;
pub use self::alias_view::*;
pub use self::array_storage::*;
pub use self::matrix_slice::*;
pub use self::matrix_view::*;
pub use self::storage::*;
#[cfg(any(feature = "std", feature = "alloc"))]
pub use self::vec_storage::*;

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

@ -122,7 +122,7 @@ pub unsafe trait RawStorage<T, R: Dim, C: Dim = U1>: Sized {
/// # Safety
/// The matrix components may not be stored in a contiguous way, depending on the strides.
/// This method is unsafe because this can yield to invalid aliasing when called on some pairs
/// of matrix slices originating from the same matrix with strides.
/// of matrix views originating from the same matrix with strides.
///
/// Call the safe alternative `matrix.as_slice()` instead.
unsafe fn as_slice_unchecked(&self) -> &[T];
@ -148,7 +148,7 @@ pub unsafe trait Storage<T, R: Dim, C: Dim = U1>: RawStorage<T, R, C> {
/// contains `MaybeUninit<T>` elements.
///
/// Note that a mutable access does not mean that the matrix owns its data. For example, a mutable
/// matrix slice can provide mutable access to its elements even if it does not own its data (it
/// matrix view can provide mutable access to its elements even if it does not own its data (it
/// contains only an internal reference to them).
pub unsafe trait RawStorageMut<T, R: Dim, C: Dim = U1>: RawStorage<T, R, C> {
/// The matrix mutable data pointer.

View File

@ -428,7 +428,7 @@ impl<T: SimdRealField, R, const D: usize> Isometry<T, R, D> {
DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
{
let mut res: OMatrix<T, _, _> = crate::convert_ref(&self.rotation);
res.fixed_slice_mut::<D, 1>(0, D)
res.fixed_view_mut::<D, 1>(0, D)
.copy_from(&self.translation.vector);
res

View File

@ -153,8 +153,8 @@ where
#[inline]
fn is_in_subset(m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>) -> bool {
let rot = m.fixed_slice::<D, D>(0, 0);
let bottom = m.fixed_slice::<1, D>(D, 0);
let rot = m.fixed_view::<D, D>(0, 0);
let bottom = m.fixed_view::<1, D>(D, 0);
// Scalar types agree.
m.iter().all(|e| SupersetOf::<T1>::is_in_subset(e)) &&
@ -168,7 +168,7 @@ where
fn from_superset_unchecked(
m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
) -> Self {
let t = m.fixed_slice::<D, 1>(0, D).into_owned();
let t = m.fixed_view::<D, 1>(0, D).into_owned();
let t = Translation {
vector: crate::convert_unchecked(t),
};

View File

@ -207,7 +207,7 @@ where
let mut res = crate::Matrix::uninit(DimNameSum::<D, U1>::name(), Const::<1>);
// This is basically a copy_from except that we warp the copied
// values into MaybeUninit.
res.generic_slice_mut((0, 0), self.coords.shape_generic())
res.generic_view_mut((0, 0), self.coords.shape_generic())
.zip_apply(&self.coords, |out, e| *out = MaybeUninit::new(e));
res[(len, 0)] = MaybeUninit::new(T::one());

View File

@ -113,7 +113,7 @@ where
DefaultAllocator: Allocator<T, DimNameSum<D, U1>>,
{
if !v[D::dim()].is_zero() {
let coords = v.generic_slice((0, 0), (D::name(), Const::<1>)) / v[D::dim()].clone();
let coords = v.generic_view((0, 0), (D::name(), Const::<1>)) / v[D::dim()].clone();
Some(Self::from(coords))
} else {
None

View File

@ -66,7 +66,7 @@ where
#[inline]
fn from_superset_unchecked(v: &OVector<T2, DimNameSum<D, U1>>) -> Self {
let coords = v.generic_slice((0, 0), (D::name(), Const::<1>)) / v[D::dim()].clone();
let coords = v.generic_view((0, 0), (D::name(), Const::<1>)) / v[D::dim()].clone();
Self {
coords: crate::convert_unchecked(coords),
}

View File

@ -14,7 +14,7 @@ use simba::simd::{SimdBool, SimdOption, SimdRealField};
use crate::base::dimension::{U1, U3, U4};
use crate::base::storage::{CStride, RStride};
use crate::base::{
Matrix3, Matrix4, MatrixSlice, MatrixSliceMut, Normed, Scalar, Unit, Vector3, Vector4,
Matrix3, Matrix4, MatrixView, MatrixViewMut, Normed, Scalar, Unit, Vector3, Vector4,
};
use crate::geometry::{Point3, Rotation};
@ -191,7 +191,7 @@ where
/// ```
#[inline]
#[must_use]
pub fn vector(&self) -> MatrixSlice<'_, T, U3, U1, RStride<T, U4, U1>, CStride<T, U4, U1>> {
pub fn vector(&self) -> MatrixView<'_, T, U3, U1, RStride<T, U4, U1>, CStride<T, U4, U1>> {
self.coords.fixed_rows::<3>(0)
}
@ -584,7 +584,7 @@ where
#[inline]
pub fn vector_mut(
&mut self,
) -> MatrixSliceMut<'_, T, U3, U1, RStride<T, U4, U1>, CStride<T, U4, U1>> {
) -> MatrixViewMut<'_, T, U3, U1, RStride<T, U4, U1>, CStride<T, U4, U1>> {
self.coords.fixed_rows_mut::<3>(0)
}

View File

@ -261,7 +261,7 @@ impl<T: Scalar, const D: usize> Rotation<T, D> {
// adding the additional traits `DimAdd` and `IsNotStaticOne`. Maybe
// these things will get nicer once specialization lands in Rust.
let mut res = OMatrix::<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>::identity();
res.fixed_slice_mut::<D, D>(0, 0).copy_from(&self.matrix);
res.fixed_view_mut::<D, D>(0, 0).copy_from(&self.matrix);
res
}

View File

@ -211,8 +211,8 @@ where
#[inline]
fn is_in_subset(m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>) -> bool {
let rot = m.fixed_slice::<D, D>(0, 0);
let bottom = m.fixed_slice::<1, D>(D, 0);
let rot = m.fixed_view::<D, D>(0, 0);
let bottom = m.fixed_view::<1, D>(D, 0);
// Scalar types agree.
m.iter().all(|e| SupersetOf::<T1>::is_in_subset(e)) &&
@ -226,7 +226,7 @@ where
fn from_superset_unchecked(
m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
) -> Self {
let r = m.fixed_slice::<D, D>(0, 0);
let r = m.fixed_view::<D, D>(0, 0);
Self::from_matrix_unchecked(crate::convert_unchecked(r.into_owned()))
}
}

View File

@ -102,7 +102,7 @@ where
fn from_superset_unchecked(
m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
) -> Self {
let v = m.fixed_slice::<D, D>(0, 0).diagonal();
let v = m.fixed_view::<D, D>(0, 0).diagonal();
Self {
vector: crate::convert_unchecked(v),
}

View File

@ -304,7 +304,7 @@ impl<T: SimdRealField, R, const D: usize> Similarity<T, R, D> {
{
let mut res = self.isometry.to_homogeneous();
for e in res.fixed_slice_mut::<D, D>(0, 0).iter_mut() {
for e in res.fixed_view_mut::<D, D>(0, 0).iter_mut() {
*e *= self.scaling.clone()
}

View File

@ -106,7 +106,7 @@ where
#[inline]
fn is_in_subset(m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>) -> bool {
let mut rot = m.fixed_slice::<D, D>(0, 0).clone_owned();
let mut rot = m.fixed_view::<D, D>(0, 0).clone_owned();
if rot
.fixed_columns_mut::<1>(0)
.try_normalize_mut(T2::zero())
@ -128,7 +128,7 @@ where
rot.fixed_columns_mut::<1>(2).neg_mut();
}
let bottom = m.fixed_slice::<1, D>(D, 0);
let bottom = m.fixed_view::<1, D>(D, 0);
// Scalar types agree.
m.iter().all(|e| SupersetOf::<T1>::is_in_subset(e)) &&
// The normalized block part is a rotation.
@ -145,22 +145,22 @@ where
m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
) -> Self {
let mut mm = m.clone_owned();
let na = mm.fixed_slice_mut::<D, 1>(0, 0).normalize_mut();
let nb = mm.fixed_slice_mut::<D, 1>(0, 1).normalize_mut();
let nc = mm.fixed_slice_mut::<D, 1>(0, 2).normalize_mut();
let na = mm.fixed_view_mut::<D, 1>(0, 0).normalize_mut();
let nb = mm.fixed_view_mut::<D, 1>(0, 1).normalize_mut();
let nc = mm.fixed_view_mut::<D, 1>(0, 2).normalize_mut();
let mut scale = (na + nb + nc) / crate::convert(3.0); // We take the mean, for robustness.
// TODO: could we avoid the explicit computation of the determinant?
// (its sign is needed to see if the scaling factor is negative).
if mm.fixed_slice::<D, D>(0, 0).determinant() < T2::zero() {
mm.fixed_slice_mut::<D, 1>(0, 0).neg_mut();
mm.fixed_slice_mut::<D, 1>(0, 1).neg_mut();
mm.fixed_slice_mut::<D, 1>(0, 2).neg_mut();
if mm.fixed_view::<D, D>(0, 0).determinant() < T2::zero() {
mm.fixed_view_mut::<D, 1>(0, 0).neg_mut();
mm.fixed_view_mut::<D, 1>(0, 1).neg_mut();
mm.fixed_view_mut::<D, 1>(0, 2).neg_mut();
scale = -scale;
}
let t = m.fixed_slice::<D, 1>(0, D).into_owned();
let t = m.fixed_view::<D, 1>(0, D).into_owned();
let t = Translation {
vector: crate::convert_unchecked(t),
};

View File

@ -120,10 +120,10 @@ md_impl_all!(
[ref val] => self * &rhs;
[val ref] => &self * rhs;
[ref ref] => {
let transform = self.matrix().fixed_slice::<D, D>(0, 0);
let transform = self.matrix().fixed_view::<D, D>(0, 0);
if C::has_normalizer() {
let normalizer = self.matrix().fixed_slice::<1, D>(D, 0);
let normalizer = self.matrix().fixed_view::<1, D>(D, 0);
let n = normalizer.tr_dot(rhs);
if !n.is_zero() {
@ -148,11 +148,11 @@ md_impl_all!(
[ref val] => self * &rhs;
[val ref] => &self * rhs;
[ref ref] => {
let transform = self.matrix().fixed_slice::<D, D>(0, 0);
let translation = self.matrix().fixed_slice::<D, 1>(0, D);
let transform = self.matrix().fixed_view::<D, D>(0, 0);
let translation = self.matrix().fixed_view::<D, 1>(0, D);
if C::has_normalizer() {
let normalizer = self.matrix().fixed_slice::<1, D>(D, 0);
let normalizer = self.matrix().fixed_view::<1, D>(D, 0);
#[allow(clippy::suspicious_arithmetic_impl)]
let n = normalizer.tr_dot(&rhs.coords) + unsafe { self.matrix().get_unchecked((D, D)).clone() };

View File

@ -150,7 +150,7 @@ impl<T: Scalar, const D: usize> Translation<T, D> {
DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
{
let mut res = OMatrix::<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>::identity();
res.fixed_slice_mut::<D, 1>(0, D).copy_from(&self.vector);
res.fixed_view_mut::<D, 1>(0, D).copy_from(&self.vector);
res
}

View File

@ -159,7 +159,7 @@ where
#[inline]
fn is_in_subset(m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>) -> bool {
let id = m.generic_slice((0, 0), (DimNameSum::<Const<D>, U1>::name(), Const::<D>));
let id = m.generic_view((0, 0), (DimNameSum::<Const<D>, U1>::name(), Const::<D>));
// Scalar types agree.
m.iter().all(|e| SupersetOf::<T1>::is_in_subset(e)) &&
@ -173,7 +173,7 @@ where
fn from_superset_unchecked(
m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
) -> Self {
let t = m.fixed_slice::<D, 1>(0, D);
let t = m.fixed_view::<D, 1>(0, D);
Self {
vector: crate::convert_unchecked(t.into_owned()),
}

View File

@ -97,6 +97,19 @@ an optimized set of tools for computer graphics and physics. Those features incl
)]
#![cfg_attr(not(feature = "std"), no_std)]
/// Generates an appropriate deprecation note with a suggestion for replacement.
///
/// Used for deprecating slice types in various locations throughout the library.
/// See #1076 for more information.
macro_rules! slice_deprecation_note {
($replacement:ident) => {
concat!("Use ", stringify!($replacement),
r###" instead. See [issue #1076](https://github.com/dimforge/nalgebra/issues/1076) for more information."###)
}
}
pub(crate) use slice_deprecation_note;
#[cfg(feature = "rand-no-std")]
extern crate rand_package as rand;

View File

@ -202,7 +202,7 @@ where
);
let start = self.axis_shift();
res.slice_mut(start, (d.value() - 1, d.value() - 1))
res.view_mut(start, (d.value() - 1, d.value() - 1))
.set_partial_diagonal(
self.off_diagonal
.iter()
@ -226,11 +226,11 @@ where
let shift = self.axis_shift().0;
for i in (0..dim - shift).rev() {
let axis = self.uv.slice_range(i + shift.., i);
let axis = self.uv.view_range(i + shift.., i);
// TODO: sometimes, the axis might have a zero magnitude.
let refl = Reflection::new(Unit::new_unchecked(axis), T::zero());
let mut res_rows = res.slice_range_mut(i + shift.., i..);
let mut res_rows = res.view_range_mut(i + shift.., i..);
let sign = if self.upper_diagonal {
self.diagonal[i].clone().signum()
@ -260,13 +260,13 @@ where
let shift = self.axis_shift().1;
for i in (0..min_nrows_ncols.value() - shift).rev() {
let axis = self.uv.slice_range(i, i + shift..);
let axis = self.uv.view_range(i, i + shift..);
let mut axis_packed = axis_packed.rows_range_mut(i + shift..);
axis_packed.tr_copy_from(&axis);
// TODO: sometimes, the axis might have a zero magnitude.
let refl = Reflection::new(Unit::new_unchecked(axis_packed), T::zero());
let mut res_rows = res.slice_range_mut(i.., i + shift..);
let mut res_rows = res.view_range_mut(i.., i + shift..);
let sign = if self.upper_diagonal {
self.off_diagonal[i].clone().signum()
@ -346,7 +346,7 @@ where
// *b.vget_unchecked_mut(i) = coeff;
// }
//
// b.rows_range_mut(.. i).axpy(-coeff, &self.uv.slice_range(.. i, i), T::one());
// b.rows_range_mut(.. i).axpy(-coeff, &self.uv.view_range(.. i, i), T::one());
// }
// }
// }

View File

@ -67,7 +67,7 @@ where
*matrix.get_unchecked_mut((j, j)) = denom.clone();
}
let mut col = matrix.slice_range_mut(j + 1.., j);
let mut col = matrix.view_range_mut(j + 1.., j);
col /= denom;
}
@ -228,7 +228,7 @@ where
*matrix.get_unchecked_mut((j, j)) = denom.clone();
}
let mut col = matrix.slice_range_mut(j + 1.., j);
let mut col = matrix.view_range_mut(j + 1.., j);
col /= denom;
continue;
}
@ -283,17 +283,17 @@ where
self.chol.shape_generic().0.add(Const::<1>),
self.chol.shape_generic().1.add(Const::<1>),
);
chol.slice_range_mut(..j, ..j)
.copy_from(&self.chol.slice_range(..j, ..j));
chol.slice_range_mut(..j, j + 1..)
.copy_from(&self.chol.slice_range(..j, j..));
chol.slice_range_mut(j + 1.., ..j)
.copy_from(&self.chol.slice_range(j.., ..j));
chol.slice_range_mut(j + 1.., j + 1..)
.copy_from(&self.chol.slice_range(j.., j..));
chol.view_range_mut(..j, ..j)
.copy_from(&self.chol.view_range(..j, ..j));
chol.view_range_mut(..j, j + 1..)
.copy_from(&self.chol.view_range(..j, j..));
chol.view_range_mut(j + 1.., ..j)
.copy_from(&self.chol.view_range(j.., ..j));
chol.view_range_mut(j + 1.., j + 1..)
.copy_from(&self.chol.view_range(j.., j..));
// update the jth row
let top_left_corner = self.chol.slice_range(..j, ..j);
let top_left_corner = self.chol.view_range(..j, ..j);
let col_j = col[j].clone();
let (mut new_rowj_adjoint, mut new_colj) = col.rows_range_pair_mut(..j, j + 1..);
@ -302,14 +302,14 @@ where
"Cholesky::insert_column : Unable to solve lower triangular system!"
);
new_rowj_adjoint.adjoint_to(&mut chol.slice_range_mut(j, ..j));
new_rowj_adjoint.adjoint_to(&mut chol.view_range_mut(j, ..j));
// update the center element
let center_element = T::sqrt(col_j - T::from_real(new_rowj_adjoint.norm_squared()));
chol[(j, j)] = center_element.clone();
// update the jth column
let bottom_left_corner = self.chol.slice_range(j.., ..j);
let bottom_left_corner = self.chol.view_range(j.., ..j);
// new_colj = (col_jplus - bottom_left_corner * new_rowj.adjoint()) / center_element;
new_colj.gemm(
-T::one() / center_element.clone(),
@ -317,10 +317,10 @@ where
&new_rowj_adjoint,
T::one() / center_element,
);
chol.slice_range_mut(j + 1.., j).copy_from(&new_colj);
chol.view_range_mut(j + 1.., j).copy_from(&new_colj);
// update the bottom right corner
let mut bottom_right_corner = chol.slice_range_mut(j + 1.., j + 1..);
let mut bottom_right_corner = chol.view_range_mut(j + 1.., j + 1..);
Self::xx_rank_one_update(
&mut bottom_right_corner,
&mut new_colj,
@ -348,17 +348,17 @@ where
self.chol.shape_generic().0.sub(Const::<1>),
self.chol.shape_generic().1.sub(Const::<1>),
);
chol.slice_range_mut(..j, ..j)
.copy_from(&self.chol.slice_range(..j, ..j));
chol.slice_range_mut(..j, j..)
.copy_from(&self.chol.slice_range(..j, j + 1..));
chol.slice_range_mut(j.., ..j)
.copy_from(&self.chol.slice_range(j + 1.., ..j));
chol.slice_range_mut(j.., j..)
.copy_from(&self.chol.slice_range(j + 1.., j + 1..));
chol.view_range_mut(..j, ..j)
.copy_from(&self.chol.view_range(..j, ..j));
chol.view_range_mut(..j, j..)
.copy_from(&self.chol.view_range(..j, j + 1..));
chol.view_range_mut(j.., ..j)
.copy_from(&self.chol.view_range(j + 1.., ..j));
chol.view_range_mut(j.., j..)
.copy_from(&self.chol.view_range(j + 1.., j + 1..));
// updates the bottom right corner
let mut bottom_right_corner = chol.slice_range_mut(j.., j..);
let mut bottom_right_corner = chol.view_range_mut(j.., j..);
let mut workspace = self.chol.column(j).clone_owned();
let mut old_colj = workspace.rows_range_mut(j + 1..);
Self::xx_rank_one_update(&mut bottom_right_corner, &mut old_colj, T::RealField::one());
@ -370,7 +370,7 @@ where
/// performs a rank one update such that we end up with the decomposition of `M + sigma * (x * x.adjoint())`.
///
/// This helper method is called by `rank_one_update` but also `insert_column` and `remove_column`
/// where it is used on a square slice of the decomposition
/// where it is used on a square view of the decomposition
fn xx_rank_one_update<Dm, Sm, Rx, Sx>(
chol: &mut Matrix<T, Dm, Dm, Sm>,
x: &mut Vector<T, Rx, Sx>,
@ -404,7 +404,7 @@ where
beta += sigma_xj2 / diag2;
// updates the terms of L
let mut xjplus = x.rows_range_mut(j + 1..);
let mut col_j = chol.slice_range_mut(j + 1.., j);
let mut col_j = chol.view_range_mut(j + 1.., j);
// temp_jplus -= (wj / T::from_real(diag)) * col_j;
xjplus.axpy(-xj.clone() / T::from_real(diag.clone()), &col_j, T::one());
if gamma != crate::zero::<T::RealField>() {

View File

@ -78,7 +78,7 @@ where
let mut diag = Matrix::uninit(min_nrows_ncols, Const::<1>);
for i in 0..min_nrows_ncols.value() {
let piv = matrix.slice_range(i.., i..).icamax_full();
let piv = matrix.view_range(i.., i..).icamax_full();
let col_piv = piv.1 + i;
matrix.swap_columns(i, col_piv);
p.append_permutation(i, col_piv);
@ -144,11 +144,11 @@ where
let dim = self.diag.len();
for i in (0..dim).rev() {
let axis = self.col_piv_qr.slice_range(i.., i);
let axis = self.col_piv_qr.view_range(i.., i);
// TODO: sometimes, the axis might have a zero magnitude.
let refl = Reflection::new(Unit::new_unchecked(axis), T::zero());
let mut res_rows = res.slice_range_mut(i.., i..);
let mut res_rows = res.view_range_mut(i.., i..);
refl.reflect_with_sign(&mut res_rows, self.diag[i].clone().signum());
}
@ -191,7 +191,7 @@ where
let dim = self.diag.len();
for i in 0..dim {
let axis = self.col_piv_qr.slice_range(i.., i);
let axis = self.col_piv_qr.view_range(i.., i);
let refl = Reflection::new(Unit::new_unchecked(axis), T::zero());
let mut rhs_rows = rhs.rows_range_mut(i..);
@ -281,7 +281,7 @@ where
}
b.rows_range_mut(..i)
.axpy(-coeff, &self.col_piv_qr.slice_range(..i, i), T::one());
.axpy(-coeff, &self.col_piv_qr.view_range(..i, i), T::one());
}
}

View File

@ -64,7 +64,7 @@ where
}
for i in 0..min_nrows_ncols.value() {
let piv = matrix.slice_range(i.., i..).icamax_full();
let piv = matrix.view_range(i.., i..).icamax_full();
let row_piv = piv.0 + i;
let col_piv = piv.1 + i;
let diag = matrix[(row_piv, col_piv)].clone();

View File

@ -113,7 +113,7 @@ where
let dim = self.hess.nrows();
self.hess.fill_lower_triangle(T::zero(), 2);
self.hess
.slice_mut((1, 0), (dim - 1, dim - 1))
.view_mut((1, 0), (dim - 1, dim - 1))
.set_partial_diagonal(
self.subdiag
.iter()
@ -132,7 +132,7 @@ where
let dim = self.hess.nrows();
let mut res = self.hess.clone();
res.fill_lower_triangle(T::zero(), 2);
res.slice_mut((1, 0), (dim - 1, dim - 1))
res.view_mut((1, 0), (dim - 1, dim - 1))
.set_partial_diagonal(
self.subdiag
.iter()

View File

@ -128,10 +128,10 @@ where
let mut res = OMatrix::identity_generic(dim, dim);
for i in (0..dim.value() - 1).rev() {
let axis = m.slice_range(i + 1.., i);
let axis = m.view_range(i + 1.., i);
let refl = Reflection::new(Unit::new_unchecked(axis), T::zero());
let mut res_rows = res.slice_range_mut(i + 1.., i..);
let mut res_rows = res.view_range_mut(i + 1.., i..);
refl.reflect_with_sign(&mut res_rows, signs[i].clone().signum());
}

View File

@ -64,7 +64,7 @@ where
out.fill_with_identity();
for i in 0..dim {
let piv = matrix.slice_range(i.., i).icamax() + i;
let piv = matrix.view_range(i.., i).icamax() + i;
let diag = matrix[(piv, i)].clone();
if diag.is_zero() {
@ -100,7 +100,7 @@ where
}
for i in 0..min_nrows_ncols.value() {
let piv = matrix.slice_range(i.., i).icamax() + i;
let piv = matrix.view_range(i.., i).icamax() + i;
let diag = matrix[(piv, i)].clone();
if diag.is_zero() {
@ -338,7 +338,7 @@ where
T: Scalar + Field,
S: StorageMut<T, R, C>,
{
let mut submat = matrix.slice_range_mut(i.., i..);
let mut submat = matrix.view_range_mut(i.., i..);
let inv_diag = T::one() / diag;
@ -368,7 +368,7 @@ pub fn gauss_step_swap<T, R: Dim, C: Dim, S>(
S: StorageMut<T, R, C>,
{
let piv = piv - i;
let mut submat = matrix.slice_range_mut(i.., i..);
let mut submat = matrix.view_range_mut(i.., i..);
let inv_diag = T::one() / diag;

View File

@ -116,11 +116,11 @@ where
let dim = self.diag.len();
for i in (0..dim).rev() {
let axis = self.qr.slice_range(i.., i);
let axis = self.qr.view_range(i.., i);
// TODO: sometimes, the axis might have a zero magnitude.
let refl = Reflection::new(Unit::new_unchecked(axis), T::zero());
let mut res_rows = res.slice_range_mut(i.., i..);
let mut res_rows = res.view_range_mut(i.., i..);
refl.reflect_with_sign(&mut res_rows, self.diag[i].clone().signum());
}
@ -161,7 +161,7 @@ where
let dim = self.diag.len();
for i in 0..dim {
let axis = self.qr.slice_range(i.., i);
let axis = self.qr.view_range(i.., i);
let refl = Reflection::new(Unit::new_unchecked(axis), T::zero());
let mut rhs_rows = rhs.rows_range_mut(i..);
@ -247,7 +247,7 @@ where
}
b.rows_range_mut(..i)
.axpy(-coeff, &self.qr.slice_range(..i, i), T::one());
.axpy(-coeff, &self.qr.view_range(..i, i), T::one());
}
}

View File

@ -174,19 +174,19 @@ where
{
let krows = cmp::min(k + 4, end + 1);
let mut work = work.rows_mut(0, krows);
refl.reflect(&mut t.generic_slice_mut(
refl.reflect(&mut t.generic_view_mut(
(k, k),
(Const::<3>, Dynamic::new(dim.value() - k)),
));
refl.reflect_rows(
&mut t.generic_slice_mut((0, k), (Dynamic::new(krows), Const::<3>)),
&mut t.generic_view_mut((0, k), (Dynamic::new(krows), Const::<3>)),
&mut work,
);
}
if let Some(ref mut q) = q {
refl.reflect_rows(
&mut q.generic_slice_mut((0, k), (dim, Const::<3>)),
&mut q.generic_view_mut((0, k), (dim, Const::<3>)),
work,
);
}
@ -211,38 +211,37 @@ where
{
let mut work = work.rows_mut(0, end + 1);
refl.reflect(&mut t.generic_slice_mut(
(m, m),
(Const::<2>, Dynamic::new(dim.value() - m)),
));
refl.reflect(
&mut t.generic_view_mut(
(m, m),
(Const::<2>, Dynamic::new(dim.value() - m)),
),
);
refl.reflect_rows(
&mut t.generic_slice_mut((0, m), (Dynamic::new(end + 1), Const::<2>)),
&mut t.generic_view_mut((0, m), (Dynamic::new(end + 1), Const::<2>)),
&mut work,
);
}
if let Some(ref mut q) = q {
refl.reflect_rows(
&mut q.generic_slice_mut((0, m), (dim, Const::<2>)),
work,
);
refl.reflect_rows(&mut q.generic_view_mut((0, m), (dim, Const::<2>)), work);
}
}
} else {
// Decouple the 2x2 block if it has real eigenvalues.
if let Some(rot) = compute_2x2_basis(&t.fixed_slice::<2, 2>(start, start)) {
if let Some(rot) = compute_2x2_basis(&t.fixed_view::<2, 2>(start, start)) {
let inv_rot = rot.inverse();
inv_rot.rotate(&mut t.generic_slice_mut(
inv_rot.rotate(&mut t.generic_view_mut(
(start, start),
(Const::<2>, Dynamic::new(dim.value() - start)),
));
rot.rotate_rows(
&mut t.generic_slice_mut((0, start), (Dynamic::new(end + 1), Const::<2>)),
&mut t.generic_view_mut((0, start), (Dynamic::new(end + 1), Const::<2>)),
);
t[(end, start)] = T::zero();
if let Some(ref mut q) = q {
rot.rotate_rows(&mut q.generic_slice_mut((0, start), (dim, Const::<2>)));
rot.rotate_rows(&mut q.generic_view_mut((0, start), (dim, Const::<2>)));
}
}
@ -427,9 +426,9 @@ where
{
let dim = m.shape_generic().0;
let mut q = None;
match compute_2x2_basis(&m.fixed_slice::<2, 2>(0, 0)) {
match compute_2x2_basis(&m.fixed_view::<2, 2>(0, 0)) {
Some(rot) => {
let mut m = m.fixed_slice_mut::<2, 2>(0, 0);
let mut m = m.fixed_view_mut::<2, 2>(0, 0);
let inv_rot = rot.inverse();
inv_rot.rotate(&mut m);
rot.rotate_rows(&mut m);
@ -530,7 +529,7 @@ where
if self.nrows() == 2 {
// TODO: can we avoid this slicing
// (which is needed here just to transform D to U2)?
let me = self.fixed_slice::<2, 2>(0, 0);
let me = self.fixed_view::<2, 2>(0, 0);
return match compute_2x2_eigvals(&me) {
Some((a, b)) => {
work[0] = a;

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
@ -93,7 +93,7 @@ impl<T: ComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
}
b.rows_range_mut(i + 1..)
.axpy(-coeff, &self.slice_range(i + 1.., i), T::one());
.axpy(-coeff, &self.view_range(i + 1.., i), T::one());
}
true
@ -125,7 +125,7 @@ impl<T: ComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
for i in 0..dim - 1 {
let coeff = unsafe { bcol.vget_unchecked(i).clone() } / diag.clone();
bcol.rows_range_mut(i + 1..)
.axpy(-coeff, &self.slice_range(i + 1.., i), T::one());
.axpy(-coeff, &self.view_range(i + 1.., i), T::one());
}
}
@ -175,7 +175,7 @@ impl<T: ComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
}
b.rows_range_mut(..i)
.axpy(-coeff, &self.slice_range(..i, i), T::one());
.axpy(-coeff, &self.view_range(..i, i), T::one());
}
true
@ -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
@ -387,7 +387,7 @@ impl<T: ComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
let dim = self.nrows();
for i in (0..dim).rev() {
let dot = dot(&self.slice_range(i + 1.., i), &b.slice_range(i + 1.., 0));
let dot = dot(&self.view_range(i + 1.., i), &b.view_range(i + 1.., 0));
unsafe {
let b_i = b.vget_unchecked_mut(i);
@ -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
@ -422,7 +422,7 @@ impl<T: ComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
let dim = self.nrows();
for i in 0..dim {
let dot = dot(&self.slice_range(..i, i), &b.slice_range(..i, 0));
let dot = dot(&self.view_range(..i, i), &b.view_range(..i, 0));
unsafe {
let b_i = b.vget_unchecked_mut(i);
@ -514,7 +514,7 @@ impl<T: SimdComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
}
b.rows_range_mut(i + 1..)
.axpy(-coeff.clone(), &self.slice_range(i + 1.., i), T::one());
.axpy(-coeff.clone(), &self.view_range(i + 1.., i), T::one());
}
}
@ -539,7 +539,7 @@ impl<T: SimdComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
for i in 0..dim - 1 {
let coeff = unsafe { bcol.vget_unchecked(i).clone() } / diag.clone();
bcol.rows_range_mut(i + 1..)
.axpy(-coeff, &self.slice_range(i + 1.., i), T::one());
.axpy(-coeff, &self.view_range(i + 1.., i), T::one());
}
}
}
@ -575,7 +575,7 @@ impl<T: SimdComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
}
b.rows_range_mut(..i)
.axpy(-coeff, &self.slice_range(..i, i), T::one());
.axpy(-coeff, &self.view_range(..i, i), T::one());
}
}
@ -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>,
@ -744,7 +744,7 @@ impl<T: SimdComplexField, D: Dim, S: Storage<T, D, D>> SquareMatrix<T, D, S> {
let dim = self.nrows();
for i in (0..dim).rev() {
let dot = dot(&self.slice_range(i + 1.., i), &b.slice_range(i + 1.., 0));
let dot = dot(&self.view_range(i + 1.., i), &b.view_range(i + 1.., 0));
unsafe {
let b_i = b.vget_unchecked_mut(i);
@ -760,15 +760,15 @@ 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>,
ShapeConstraint: SameNumberOfRows<R2, D>,
{
for i in 0..self.nrows() {
let dot = dot(&self.slice_range(..i, i), &b.slice_range(..i, 0));
let dot = dot(&self.view_range(..i, i), &b.view_range(..i, 0));
unsafe {
let b_i = b.vget_unchecked_mut(i);

View File

@ -7,7 +7,7 @@ use na::{
RowVector5, RowVector6, Similarity3, Transform3, UnitQuaternion, Vector1, Vector2, Vector3,
Vector4, Vector5, Vector6,
};
use na::{DMatrix, DMatrixSlice, DMatrixSliceMut, MatrixSlice, MatrixSliceMut};
use na::{DMatrix, DMatrixView, DMatrixViewMut, MatrixView, MatrixViewMut};
use na::{U1, U3, U4};
use crate::proptest::*;
@ -266,24 +266,24 @@ fn matrix_slice_from_matrix_ref() {
// Note: these have to be macros, and not functions, because the input type is different
// across the different tests. Moreover, the output type depends on the stride of the input,
// which is different for static and dynamic matrices.
macro_rules! dynamic_slice {
macro_rules! dynamic_view {
($mref:expr) => {
DMatrixSlice::<_>::from($mref)
DMatrixView::<_>::from($mref)
};
}
macro_rules! dynamic_slice_mut {
macro_rules! dynamic_view_mut {
($mref:expr) => {
DMatrixSliceMut::<_>::from($mref)
DMatrixViewMut::<_>::from($mref)
};
}
macro_rules! fixed_slice {
macro_rules! fixed_view {
($mref:expr) => {
MatrixSlice::<_, U3, U4, U1, U3>::from($mref)
MatrixView::<_, U3, U4, U1, U3>::from($mref)
};
}
macro_rules! fixed_slice_mut {
macro_rules! fixed_view_mut {
($mref:expr) => {
MatrixSliceMut::<_, U3, U4, U1, U3>::from($mref)
MatrixViewMut::<_, U3, U4, U1, U3>::from($mref)
};
}
@ -291,66 +291,66 @@ fn matrix_slice_from_matrix_ref() {
// Self and RHS. See issue #674. Once this is implemented, we can remove `into_owned`
// from the below tests.
// Construct slices from reference to a
// Construct views from reference to a
{
assert_eq!(a, fixed_slice!(&a).into_owned());
assert_eq!(d, dynamic_slice!(&a).into_owned());
assert_eq!(a, fixed_view!(&a).into_owned());
assert_eq!(d, dynamic_view!(&a).into_owned());
}
// Construct slices from mutable reference to a
// Construct views from mutable reference to a
{
let mut a_clone = a.clone();
assert_eq!(a, fixed_slice!(&mut a_clone).into_owned());
assert_eq!(d, dynamic_slice!(&mut a_clone).into_owned());
assert_eq!(a, fixed_view!(&mut a_clone).into_owned());
assert_eq!(d, dynamic_view!(&mut a_clone).into_owned());
}
// Construct mutable slices from mutable reference to a
{
let mut a_clone = a.clone();
assert_eq!(a, fixed_slice_mut!(&mut a_clone).into_owned());
assert_eq!(d, dynamic_slice_mut!(&mut a_clone).into_owned());
assert_eq!(a, fixed_view_mut!(&mut a_clone).into_owned());
assert_eq!(d, dynamic_view_mut!(&mut a_clone).into_owned());
}
// Construct slices from reference to d
{
assert_eq!(a, fixed_slice!(&d).into_owned());
assert_eq!(d, dynamic_slice!(&d).into_owned());
assert_eq!(a, fixed_view!(&d).into_owned());
assert_eq!(d, dynamic_view!(&d).into_owned());
}
// Construct slices from mutable reference to d
{
let mut d_clone = a.clone();
assert_eq!(a, fixed_slice!(&mut d_clone).into_owned());
assert_eq!(d, dynamic_slice!(&mut d_clone).into_owned());
assert_eq!(a, fixed_view!(&mut d_clone).into_owned());
assert_eq!(d, dynamic_view!(&mut d_clone).into_owned());
}
// Construct mutable slices from mutable reference to d
{
let mut d_clone = d.clone();
assert_eq!(a, fixed_slice_mut!(&mut d_clone).into_owned());
assert_eq!(d, dynamic_slice_mut!(&mut d_clone).into_owned());
assert_eq!(a, fixed_view_mut!(&mut d_clone).into_owned());
assert_eq!(d, dynamic_view_mut!(&mut d_clone).into_owned());
}
// Construct slices from a slice of a
{
let mut a_slice = fixed_slice!(&a);
assert_eq!(a, fixed_slice!(&a_slice).into_owned());
assert_eq!(a, fixed_slice!(&mut a_slice).into_owned());
assert_eq!(d, dynamic_slice!(&a_slice).into_owned());
assert_eq!(d, dynamic_slice!(&mut a_slice).into_owned());
let mut a_slice = fixed_view!(&a);
assert_eq!(a, fixed_view!(&a_slice).into_owned());
assert_eq!(a, fixed_view!(&mut a_slice).into_owned());
assert_eq!(d, dynamic_view!(&a_slice).into_owned());
assert_eq!(d, dynamic_view!(&mut a_slice).into_owned());
}
// Construct slices from a slice mut of a
{
// Need a clone of a here, so that we can both have a mutable borrow and compare equality
let mut a_clone = a.clone();
let mut a_slice = fixed_slice_mut!(&mut a_clone);
let mut a_slice = fixed_view_mut!(&mut a_clone);
assert_eq!(a, fixed_slice!(&a_slice).into_owned());
assert_eq!(a, fixed_slice!(&mut a_slice).into_owned());
assert_eq!(d, dynamic_slice!(&a_slice).into_owned());
assert_eq!(d, dynamic_slice!(&mut a_slice).into_owned());
assert_eq!(a, fixed_slice_mut!(&mut a_slice).into_owned());
assert_eq!(d, dynamic_slice_mut!(&mut a_slice).into_owned());
assert_eq!(a, fixed_view!(&a_slice).into_owned());
assert_eq!(a, fixed_view!(&mut a_slice).into_owned());
assert_eq!(d, dynamic_view!(&a_slice).into_owned());
assert_eq!(d, dynamic_view!(&mut a_slice).into_owned());
assert_eq!(a, fixed_view_mut!(&mut a_slice).into_owned());
assert_eq!(d, dynamic_view_mut!(&mut a_slice).into_owned());
}
}

View File

@ -1066,43 +1066,43 @@ fn partial_eq_different_types() {
let static_mat = Matrix2x4::new(1, 2, 3, 4, 5, 6, 7, 8);
let mut typenum_static_mat = OMatrix::<u8, Const<1024>, Const<4>>::zeros();
let mut slice = typenum_static_mat.slice_mut((0, 0), (2, 4));
slice += static_mat;
let mut view = typenum_static_mat.view_mut((0, 0), (2, 4));
view += static_mat;
let fslice_of_dmat = dynamic_mat.fixed_slice::<2, 2>(0, 0);
let dslice_of_dmat = dynamic_mat.slice((0, 0), (2, 2));
let fslice_of_smat = static_mat.fixed_slice::<2, 2>(0, 0);
let dslice_of_smat = static_mat.slice((0, 0), (2, 2));
let fview_of_dmat = dynamic_mat.fixed_view::<2, 2>(0, 0);
let dview_of_dmat = dynamic_mat.view((0, 0), (2, 2));
let fview_of_smat = static_mat.fixed_view::<2, 2>(0, 0);
let dview_of_smat = static_mat.view((0, 0), (2, 2));
assert_eq!(dynamic_mat, static_mat);
assert_eq!(static_mat, dynamic_mat);
assert_eq!(dynamic_mat, slice);
assert_eq!(slice, dynamic_mat);
assert_eq!(dynamic_mat, view);
assert_eq!(view, dynamic_mat);
assert_eq!(static_mat, slice);
assert_eq!(slice, static_mat);
assert_eq!(static_mat, view);
assert_eq!(view, static_mat);
assert_eq!(fslice_of_dmat, dslice_of_dmat);
assert_eq!(dslice_of_dmat, fslice_of_dmat);
assert_eq!(fview_of_dmat, dview_of_dmat);
assert_eq!(dview_of_dmat, fview_of_dmat);
assert_eq!(fslice_of_dmat, fslice_of_smat);
assert_eq!(fslice_of_smat, fslice_of_dmat);
assert_eq!(fview_of_dmat, fview_of_smat);
assert_eq!(fview_of_smat, fview_of_dmat);
assert_eq!(fslice_of_dmat, dslice_of_smat);
assert_eq!(dslice_of_smat, fslice_of_dmat);
assert_eq!(fview_of_dmat, dview_of_smat);
assert_eq!(dview_of_smat, fview_of_dmat);
assert_eq!(dslice_of_dmat, fslice_of_smat);
assert_eq!(fslice_of_smat, dslice_of_dmat);
assert_eq!(dview_of_dmat, fview_of_smat);
assert_eq!(fview_of_smat, dview_of_dmat);
assert_eq!(dslice_of_dmat, dslice_of_smat);
assert_eq!(dslice_of_smat, dslice_of_dmat);
assert_eq!(dview_of_dmat, dview_of_smat);
assert_eq!(dview_of_smat, dview_of_dmat);
assert_eq!(fslice_of_smat, dslice_of_smat);
assert_eq!(dslice_of_smat, fslice_of_smat);
assert_eq!(fview_of_smat, dview_of_smat);
assert_eq!(dview_of_smat, fview_of_smat);
assert_ne!(dynamic_mat, dslice_of_smat);
assert_ne!(dslice_of_smat, dynamic_mat);
assert_ne!(dynamic_mat, dview_of_smat);
assert_ne!(dview_of_smat, dynamic_mat);
// TODO - implement those comparisons
// assert_ne!(static_mat, typenum_static_mat);

View File

@ -1,22 +1,22 @@
#![allow(non_snake_case)]
use na::{
DMatrix, DMatrixSlice, DMatrixSliceMut, Matrix2, Matrix2x3, Matrix2x4, Matrix2x6, Matrix3,
Matrix3x2, Matrix3x4, Matrix4x2, Matrix6x2, MatrixSlice2, MatrixSlice2x3, MatrixSlice2xX,
MatrixSlice3, MatrixSlice3x2, MatrixSliceMut2, MatrixSliceMut2x3, MatrixSliceMut2xX,
MatrixSliceMut3, MatrixSliceMut3x2, MatrixSliceMutXx3, MatrixSliceXx3, RowVector4, Vector3,
DMatrix, DMatrixView, DMatrixViewMut, Matrix2, Matrix2x3, Matrix2x4, Matrix2x6, Matrix3,
Matrix3x2, Matrix3x4, Matrix4x2, Matrix6x2, MatrixView2, MatrixView2x3, MatrixView2xX,
MatrixView3, MatrixView3x2, MatrixViewMut2, MatrixViewMut2x3, MatrixViewMut2xX, MatrixViewMut3,
MatrixViewMut3x2, MatrixViewMutXx3, MatrixViewXx3, RowVector4, Vector3,
};
#[test]
#[rustfmt::skip]
fn nested_fixed_slices() {
fn nested_fixed_views() {
let a = Matrix3x4::new(11.0, 12.0, 13.0, 14.0,
21.0, 22.0, 23.0, 24.0,
31.0, 32.0, 33.0, 34.0);
let s1 = a.fixed_slice::<3, 3>(0, 1); // Simple slice.
let s2 = s1.fixed_slice::<2, 2>(1, 1); // Slice of slice.
let s3 = s1.fixed_slice_with_steps::<2, 2>((0, 0), (1, 1)); // Slice of slice with steps.
let s1 = a.fixed_view::<3, 3>(0, 1); // Simple view.
let s2 = s1.fixed_view::<2, 2>(1, 1); // View of view.
let s3 = s1.fixed_view_with_steps::<2, 2>((0, 0), (1, 1)); // View of view with steps.
let expected_owned_s1 = Matrix3::new(12.0, 13.0, 14.0,
22.0, 23.0, 24.0,
@ -35,14 +35,14 @@ fn nested_fixed_slices() {
#[test]
#[rustfmt::skip]
fn nested_slices() {
fn nested_views() {
let a = Matrix3x4::new(11.0, 12.0, 13.0, 14.0,
21.0, 22.0, 23.0, 24.0,
31.0, 32.0, 33.0, 34.0);
let s1 = a.slice((0, 1), (3, 3));
let s2 = s1.slice((1, 1), (2, 2));
let s3 = s1.slice_with_steps((0, 0), (2, 2), (1, 1));
let s1 = a.view((0, 1), (3, 3));
let s2 = s1.view((1, 1), (2, 2));
let s3 = s1.view_with_steps((0, 0), (2, 2), (1, 1));
let expected_owned_s1 = DMatrix::from_row_slice(3, 3, &[ 12.0, 13.0, 14.0,
22.0, 23.0, 24.0,
@ -61,14 +61,14 @@ fn nested_slices() {
#[test]
#[rustfmt::skip]
fn slice_mut() {
fn view_mut() {
let mut a = Matrix3x4::new(11.0, 12.0, 13.0, 14.0,
21.0, 22.0, 23.0, 24.0,
31.0, 32.0, 33.0, 34.0);
{
// We modify `a` through the mutable slice.
let mut s1 = a.slice_with_steps_mut((0, 1), (2, 2), (1, 1));
// We modify `a` through the mutable view.
let mut s1 = a.view_with_steps_mut((0, 1), (2, 2), (1, 1));
s1.fill(0.0);
}
@ -81,7 +81,7 @@ fn slice_mut() {
#[test]
#[rustfmt::skip]
fn nested_row_slices() {
fn nested_row_views() {
let a = Matrix6x2::new(11.0, 12.0,
21.0, 22.0,
31.0, 32.0,
@ -105,7 +105,7 @@ fn nested_row_slices() {
#[test]
#[rustfmt::skip]
fn row_slice_mut() {
fn row_view_mut() {
let mut a = Matrix6x2::new(11.0, 12.0,
21.0, 22.0,
31.0, 32.0,
@ -113,7 +113,7 @@ fn row_slice_mut() {
51.0, 52.0,
61.0, 62.0);
{
// We modify `a` through the mutable slice.
// We modify `a` through the mutable view.
let mut s1 = a.rows_with_step_mut(1, 3, 1);
s1.fill(0.0);
}
@ -130,7 +130,7 @@ fn row_slice_mut() {
#[test]
#[rustfmt::skip]
fn nested_col_slices() {
fn nested_col_views() {
let a = Matrix2x6::new(11.0, 12.0, 13.0, 14.0, 15.0, 16.0,
21.0, 22.0, 23.0, 24.0, 25.0, 26.0);
let s1 = a.fixed_columns::<4>(1);
@ -148,12 +148,12 @@ fn nested_col_slices() {
#[test]
#[rustfmt::skip]
fn col_slice_mut() {
fn col_view_mut() {
let mut a = Matrix2x6::new(11.0, 12.0, 13.0, 14.0, 15.0, 16.0,
21.0, 22.0, 23.0, 24.0, 25.0, 26.0);
{
// We modify `a` through the mutable slice.
// We modify `a` through the mutable view.
let mut s1 = a.columns_with_step_mut(1, 3, 1);
s1.fill(0.0);
}
@ -203,7 +203,7 @@ fn columns_range_pair() {
#[test]
#[rustfmt::skip]
fn new_slice() {
fn new_from_slice() {
let data = [ 1.0, 2.0, 3.0, 4.0,
5.0, 6.0, 7.0, 8.0,
9.0, 10.0, 11.0, 12.0 ];
@ -214,13 +214,13 @@ fn new_slice() {
let expected3x2 = Matrix3x2::from_column_slice(&data);
{
let m2 = MatrixSlice2::from_slice(&data);
let m3 = MatrixSlice3::from_slice(&data);
let m2x3 = MatrixSlice2x3::from_slice(&data);
let m3x2 = MatrixSlice3x2::from_slice(&data);
let m2xX = MatrixSlice2xX::from_slice(&data, 3);
let mXx3 = MatrixSliceXx3::from_slice(&data, 2);
let mXxX = DMatrixSlice::from_slice(&data, 2, 3);
let m2 = MatrixView2::from_slice(&data);
let m3 = MatrixView3::from_slice(&data);
let m2x3 = MatrixView2x3::from_slice(&data);
let m3x2 = MatrixView3x2::from_slice(&data);
let m2xX = MatrixView2xX::from_slice(&data, 3);
let mXx3 = MatrixViewXx3::from_slice(&data, 2);
let mXxX = DMatrixView::from_slice(&data, 2, 3);
assert!(m2.eq(&expected2));
assert!(m3.eq(&expected3));
@ -234,7 +234,7 @@ fn new_slice() {
#[test]
#[rustfmt::skip]
fn new_slice_mut() {
fn new_from_slice_mut() {
let data = [ 1.0, 2.0, 3.0, 4.0,
5.0, 6.0, 7.0, 8.0,
9.0, 10.0, 11.0, 12.0 ];
@ -252,31 +252,31 @@ fn new_slice_mut() {
9.0, 10.0, 11.0, 12.0 ];
let mut data_mut = data.clone();
MatrixSliceMut2::from_slice(&mut data_mut).fill(0.0);
MatrixViewMut2::from_slice(&mut data_mut).fill(0.0);
assert!(data_mut == expected2);
let mut data_mut = data.clone();
MatrixSliceMut3::from_slice(&mut data_mut).fill(0.0);
MatrixViewMut3::from_slice(&mut data_mut).fill(0.0);
assert!(data_mut == expected3);
let mut data_mut = data.clone();
MatrixSliceMut2x3::from_slice(&mut data_mut).fill(0.0);
MatrixViewMut2x3::from_slice(&mut data_mut).fill(0.0);
assert!(data_mut == expected2x3);
let mut data_mut = data.clone();
MatrixSliceMut3x2::from_slice(&mut data_mut).fill(0.0);
MatrixViewMut3x2::from_slice(&mut data_mut).fill(0.0);
assert!(data_mut == expected3x2);
let mut data_mut = data.clone();
MatrixSliceMut2xX::from_slice(&mut data_mut, 3).fill(0.0);
MatrixViewMut2xX::from_slice(&mut data_mut, 3).fill(0.0);
assert!(data_mut == expected2x3);
let mut data_mut = data.clone();
MatrixSliceMutXx3::from_slice(&mut data_mut, 2).fill(0.0);
MatrixViewMutXx3::from_slice(&mut data_mut, 2).fill(0.0);
assert!(data_mut == expected2x3);
let mut data_mut = data.clone();
DMatrixSliceMut::from_slice(&mut data_mut, 2, 3).fill(0.0);
DMatrixViewMut::from_slice(&mut data_mut, 2, 3).fill(0.0);
assert!(data_mut == expected2x3);
}
@ -324,14 +324,14 @@ fn columns_with_step_out_of_bounds() {
#[test]
#[should_panic]
fn slice_out_of_bounds() {
fn view_out_of_bounds() {
let a = Matrix3x4::<f32>::zeros();
a.slice((1, 2), (3, 1));
a.view((1, 2), (3, 1));
}
#[test]
#[should_panic]
fn slice_with_steps_out_of_bounds() {
fn view_with_steps_out_of_bounds() {
let a = Matrix3x4::<f32>::zeros();
a.slice_with_steps((1, 2), (2, 2), (0, 1));
a.view_with_steps((1, 2), (2, 2), (0, 1));
}

View File

@ -4,7 +4,7 @@ mod conversion;
mod edition;
mod empty;
mod matrix;
mod matrix_slice;
mod matrix_view;
#[cfg(feature = "mint")]
mod mint;
#[cfg(feature = "rkyv-serialize-no-std")]