pub struct MatrixSlice<'a, T>where
    T: 'a,
{ /* private fields */ }
Expand description

A MatrixSlice

This struct provides a slice into a matrix.

The struct contains the upper left point of the slice and the width and height of the slice.

Implementations

Produce a MatrixSlice from a Matrix

Examples
use rulinalg::matrix::{Matrix, MatrixSlice};

let a = Matrix::new(3,3, (0..9).collect::<Vec<usize>>());
let slice = MatrixSlice::from_matrix(&a, [1,1], 2, 2);

Creates a MatrixSlice from raw parts.

Examples
use rulinalg::matrix::MatrixSlice;

let mut a = vec![4.0; 16];

unsafe {
    // Create a matrix slice with 3 rows, and 3 cols
    // The row stride of 4 specifies the distance between the start of each row in the data.
    let b = MatrixSlice::from_raw_parts(a.as_ptr(), 3, 3, 4);
}
Safety

The pointer must be followed by a contiguous slice of data larger than row_stride * rows. If not then other operations will produce undefined behaviour.

Additionally cols should be less than the row_stride. It is possible to use this function safely whilst violating this condition. So long as max(cols, row_stride) * rows is less than the data size.

Trait Implementations

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator.
Performs the + operation. Read more

Scalar addition with matrix slice.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between the slices.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between the slices.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between the slices.

The resulting type after applying the + operator.
Performs the + operation. Read more

Scalar addition with matrix slice.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between the slices.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between the slices.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between the slices.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between the slices.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between the slices.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between the slices.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between the slices.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between the slices.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition between the slices.

The resulting type after applying the + operator.
Performs the + operation. Read more

Scalar addition with matrix slice.

The resulting type after applying the + operator.
Performs the + operation. Read more

Scalar addition with matrix slice.

The resulting type after applying the + operator.
Performs the + operation. Read more

Performs elementwise addition assignment between two matrices.

Performs the += operation. Read more

Performs elementwise addition assignment between two matrices.

Performs the += operation. Read more

Performs elementwise addition assignment between two matrices.

Performs the += operation. Read more

Performs elementwise addition assignment between two matrices.

Performs the += operation. Read more
Rows in the matrix.
Columns in the matrix.
Row stride in the matrix.
Top left index of the matrix.
Returns true if the matrix contais no elements
Returns a MatrixSlice over the whole matrix. Read more
Get a reference to an element in the matrix without bounds checking.
Get a reference to an element in the matrix. Read more
Returns the column of a matrix at the given index. None if the index is out of bounds. Read more
Returns the column of a matrix at the given index without doing a bounds check. Read more
Returns the row of a matrix at the given index. Read more
Returns the row of a matrix at the given index without doing unbounds checking Read more
Returns an iterator over the matrix data. Read more
Iterate over the columns of the matrix. Read more
Iterate over the rows of the matrix. Read more
Iterate over diagonal entries Read more
Compute the metric distance between two matrices. Read more
Extract the diagonal of the matrix Read more
Split the matrix at the specified axis returning two MatrixSlices. Read more
Produce a MatrixSlice from an existing matrix. Read more
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Scalar division with matrix slice.

The resulting type after applying the / operator.
Performs the / operation. Read more

Scalar division with matrix slice.

The resulting type after applying the / operator.
Performs the / operation. Read more

Scalar division with matrix slice.

The resulting type after applying the / operator.
Performs the / operation. Read more

Scalar division with matrix slice.

The resulting type after applying the / operator.
Performs the / operation. Read more
Converts to this type from the input type.

Indexes matrix slice. Takes row index first then column.

The returned type after indexing.
Performs the indexing (container[index]) operation. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more
The type of the elements being iterated over.
Which kind of iterator are we turning this into?
Creates an iterator from a value. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Right-multiply a matrix by a permutation matrix.

The resulting type after applying the * operator.
Performs the * operation. Read more

Right-multiply a matrix by a permutation matrix.

The resulting type after applying the * operator.
Performs the * operation. Read more

Scalar multiplication with matrix slice.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Scalar multiplication with matrix slice.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Multiplies two matrices together.

The resulting type after applying the * operator.
Performs the * operation. Read more

Right-multiply a matrix by a permutation matrix.

The resulting type after applying the * operator.
Performs the * operation. Read more

Right-multiply a matrix by a permutation matrix.

The resulting type after applying the * operator.
Performs the * operation. Read more

Scalar multiplication with matrix slice.

The resulting type after applying the * operator.
Performs the * operation. Read more

Scalar multiplication with matrix slice.

The resulting type after applying the * operator.
Performs the * operation. Read more

Gets negative of matrix slice.

The resulting type after applying the - operator.
Performs the unary - operation. Read more

Gets negative of matrix slice.

The resulting type after applying the - operator.
Performs the unary - operation. Read more

Performs elementwise subtraction between Matrix and MatrixSlice.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between Matrix and MatrixSlice.

The resulting type after applying the - operator.
Performs the - operation. Read more

Scalar subtraction with matrix slice.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between Matrix and MatrixSlice.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between Matrix and MatrixSlice.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator.
Performs the - operation. Read more

Scalar subtraction with matrix slice.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between Matrix and MatrixSlice.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between Matrix and MatrixSlice.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between Matrix and MatrixSlice.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between Matrix and MatrixSlice.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator.
Performs the - operation. Read more

Scalar subtraction with matrix slice.

The resulting type after applying the - operator.
Performs the - operation. Read more

Scalar subtraction with matrix slice.

The resulting type after applying the - operator.
Performs the - operation. Read more

Performs elementwise subtraction assignment between two matrices.

Performs the -= operation. Read more

Performs elementwise subtraction assignment between two matrices.

Performs the -= operation. Read more

Performs elementwise subtraction assignment between two matrices.

Performs the -= operation. Read more

Performs elementwise subtraction assignment between two matrices.

Performs the -= operation. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.