Struct rulinalg::matrix::MatrixSlice [] [src]

pub struct MatrixSlice<'a, T: 'a> { /* fields omitted */ }

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.

Methods

impl<'a, T> MatrixSlice<'a, T>
[src]

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

impl<'a, T> BaseMatrix<T> for MatrixSlice<'a, T>
[src]

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 a point in the matrix without bounds checking.

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

The sum of the rows of the matrix. Read more

The sum of the columns of the matrix. Read more

Compute given matrix norm for matrix. Read more

Compute the metric distance between two matrices. Read more

The sum of all elements in the matrix Read more

The min of the specified axis of the matrix. Read more

The max of the specified axis of the matrix. Read more

Convert the matrix struct into a owned Matrix.

Select rows from matrix Read more

Select columns from matrix Read more

The elementwise product of two matrices. Read more

The elementwise division of two matrices. Read more

Select block matrix from matrix Read more

Horizontally concatenates two matrices. With self on the left. Read more

Vertically concatenates two matrices. With self on top. Read more

Extract the diagonal of the matrix Read more

Tranposes the given matrix Read more

Checks if matrix is diagonal. Read more

Solves an upper triangular linear system. Read more

Solves a lower triangular linear system. Read more

Split the matrix at the specified axis returning two MatrixSlices. Read more

Produce a MatrixSlice from an existing matrix. Read more

impl<'a, T> Index<[usize; 2]> for MatrixSlice<'a, T>
[src]

Indexes matrix slice. Takes row index first then column.

The returned type after indexing

The method for the indexing (container[index]) operation

impl<'a, T> Mul<T> for MatrixSlice<'a, T> where T: Copy + Mul<T, Output=T>
[src]

Scalar multiplication with matrix slice.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, T> Mul<&'b T> for MatrixSlice<'a, T> where T: Copy + Mul<T, Output=T>
[src]

Scalar multiplication with matrix slice.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, T> Mul<T> for &'b MatrixSlice<'a, T> where T: Copy + Mul<T, Output=T>
[src]

Scalar multiplication with matrix slice.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, 'c, T> Mul<&'c T> for &'b MatrixSlice<'a, T> where T: Copy + Mul<T, Output=T>
[src]

Scalar multiplication with matrix slice.

The resulting type after applying the * operator

The method for the * operator

impl<'a, T> Div<T> for MatrixSlice<'a, T> where T: Copy + Div<T, Output=T>
[src]

Scalar division with matrix slice.

The resulting type after applying the / operator

The method for the / operator

impl<'a, 'b, T> Div<&'b T> for MatrixSlice<'a, T> where T: Copy + Div<T, Output=T>
[src]

Scalar division with matrix slice.

The resulting type after applying the / operator

The method for the / operator

impl<'a, 'b, T> Div<T> for &'b MatrixSlice<'a, T> where T: Copy + Div<T, Output=T>
[src]

Scalar division with matrix slice.

The resulting type after applying the / operator

The method for the / operator

impl<'a, 'b, 'c, T> Div<&'c T> for &'b MatrixSlice<'a, T> where T: Copy + Div<T, Output=T>
[src]

Scalar division with matrix slice.

The resulting type after applying the / operator

The method for the / operator

impl<'a, T> Add<T> for MatrixSlice<'a, T> where T: Copy + Add<T, Output=T>
[src]

Scalar addition with matrix slice.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, T> Add<&'b T> for MatrixSlice<'a, T> where T: Copy + Add<T, Output=T>
[src]

Scalar addition with matrix slice.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, T> Add<T> for &'b MatrixSlice<'a, T> where T: Copy + Add<T, Output=T>
[src]

Scalar addition with matrix slice.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, 'c, T> Add<&'c T> for &'b MatrixSlice<'a, T> where T: Copy + Add<T, Output=T>
[src]

Scalar addition with matrix slice.

The resulting type after applying the + operator

The method for the + operator

impl<'a, T> Sub<T> for MatrixSlice<'a, T> where T: Copy + Sub<T, Output=T>
[src]

Scalar subtraction with matrix slice.

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, T> Sub<&'b T> for MatrixSlice<'a, T> where T: Copy + Sub<T, Output=T>
[src]

Scalar subtraction with matrix slice.

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, T> Sub<T> for &'b MatrixSlice<'a, T> where T: Copy + Sub<T, Output=T>
[src]

Scalar subtraction with matrix slice.

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, 'c, T> Sub<&'c T> for &'b MatrixSlice<'a, T> where T: Copy + Sub<T, Output=T>
[src]

Scalar subtraction with matrix slice.

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, T> Add<MatrixSlice<'b, T>> for MatrixSlice<'a, T> where T: Copy + Add<T, Output=T>
[src]

Performs elementwise addition between the slices.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, 'c, T> Add<MatrixSlice<'b, T>> for &'c MatrixSlice<'a, T> where T: Copy + Add<T, Output=T>
[src]

Performs elementwise addition between the slices.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, 'c, T> Add<&'c MatrixSlice<'b, T>> for MatrixSlice<'a, T> where T: Copy + Add<T, Output=T>
[src]

Performs elementwise addition between the slices.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, 'c, 'd, T> Add<&'d MatrixSlice<'b, T>> for &'c MatrixSlice<'a, T> where T: Copy + Add<T, Output=T>
[src]

Performs elementwise addition between the slices.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, T> Add<MatrixSliceMut<'b, T>> for MatrixSlice<'a, T> where T: Copy + Add<T, Output=T>
[src]

Performs elementwise addition between the slices.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, 'c, T> Add<MatrixSliceMut<'b, T>> for &'c MatrixSlice<'a, T> where T: Copy + Add<T, Output=T>
[src]

Performs elementwise addition between the slices.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, 'c, T> Add<&'c MatrixSliceMut<'b, T>> for MatrixSlice<'a, T> where T: Copy + Add<T, Output=T>
[src]

Performs elementwise addition between the slices.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, 'c, 'd, T> Add<&'d MatrixSliceMut<'b, T>> for &'c MatrixSlice<'a, T> where T: Copy + Add<T, Output=T>
[src]

Performs elementwise addition between the slices.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, T> Sub<MatrixSlice<'b, T>> for MatrixSlice<'a, T> where T: Copy + Sub<T, Output=T>
[src]

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, 'c, T> Sub<MatrixSlice<'b, T>> for &'c MatrixSlice<'a, T> where T: Copy + Sub<T, Output=T>
[src]

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, 'c, T> Sub<&'c MatrixSlice<'b, T>> for MatrixSlice<'a, T> where T: Copy + Sub<T, Output=T>
[src]

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, 'c, 'd, T> Sub<&'d MatrixSlice<'b, T>> for &'c MatrixSlice<'a, T> where T: Copy + Sub<T, Output=T>
[src]

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, T> Sub<MatrixSliceMut<'b, T>> for MatrixSlice<'a, T> where T: Copy + Sub<T, Output=T>
[src]

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, 'c, T> Sub<MatrixSliceMut<'b, T>> for &'c MatrixSlice<'a, T> where T: Copy + Sub<T, Output=T>
[src]

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, 'c, T> Sub<&'c MatrixSliceMut<'b, T>> for MatrixSlice<'a, T> where T: Copy + Sub<T, Output=T>
[src]

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, 'c, 'd, T> Sub<&'d MatrixSliceMut<'b, T>> for &'c MatrixSlice<'a, T> where T: Copy + Sub<T, Output=T>
[src]

Performs elementwise subtraction between the slices.

The resulting type after applying the - operator

The method for the - operator

impl<'a, T> Add<Matrix<T>> for MatrixSlice<'a, T> where T: Copy + Add<T, Output=T>
[src]

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, T> Add<Matrix<T>> for &'b MatrixSlice<'a, T> where T: Copy + Add<T, Output=T>
[src]

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, T> Add<&'b Matrix<T>> for MatrixSlice<'a, T> where T: Copy + Add<T, Output=T>
[src]

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, 'c, T> Add<&'c Matrix<T>> for &'b MatrixSlice<'a, T> where T: Copy + Add<T, Output=T>
[src]

Performs elementwise addition between Matrix and MatrixSlice.

The resulting type after applying the + operator

The method for the + operator

impl<'a, T> Sub<Matrix<T>> for MatrixSlice<'a, T> where T: Copy + Sub<T, Output=T>
[src]

Performs elementwise subtraction between Matrix and MatrixSlice.

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, T> Sub<Matrix<T>> for &'b MatrixSlice<'a, T> where T: Copy + Sub<T, Output=T>
[src]

Performs elementwise subtraction between Matrix and MatrixSlice.

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, T> Sub<&'b Matrix<T>> for MatrixSlice<'a, T> where T: Copy + Sub<T, Output=T>
[src]

Performs elementwise subtraction between Matrix and MatrixSlice.

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, 'c, T> Sub<&'c Matrix<T>> for &'b MatrixSlice<'a, T> where T: Copy + Sub<T, Output=T>
[src]

Performs elementwise subtraction between Matrix and MatrixSlice.

The resulting type after applying the - operator

The method for the - operator

impl<'a, T> Neg for MatrixSlice<'a, T> where T: Neg<Output=T> + Copy
[src]

Gets negative of matrix slice.

The resulting type after applying the - operator

The method for the unary - operator

impl<'a, 'b, T> Neg for &'b MatrixSlice<'a, T> where T: Neg<Output=T> + Copy
[src]

Gets negative of matrix slice.

The resulting type after applying the - operator

The method for the unary - operator

impl<'a, T> IntoIterator for MatrixSlice<'a, T>
[src]

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

impl<'a, T> IntoIterator for &'a MatrixSlice<'a, T>
[src]

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

impl<'a, T> IntoIterator for &'a mut MatrixSlice<'a, T>
[src]

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

impl<'a, T> Mul<Matrix<T>> for MatrixSlice<'a, T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, T> Mul<&'b Matrix<T>> for MatrixSlice<'a, T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, T> Mul<Matrix<T>> for &'b MatrixSlice<'a, T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, 'c, T> Mul<&'c Matrix<T>> for &'b MatrixSlice<'a, T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, T> Mul<MatrixSlice<'b, T>> for MatrixSlice<'a, T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, 'c, T> Mul<&'c MatrixSlice<'b, T>> for MatrixSlice<'a, T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, 'c, T> Mul<MatrixSlice<'b, T>> for &'c MatrixSlice<'a, T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, 'c, 'd, T> Mul<&'d MatrixSlice<'b, T>> for &'c MatrixSlice<'a, T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, T> Mul<MatrixSliceMut<'b, T>> for MatrixSlice<'a, T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, 'c, T> Mul<&'c MatrixSliceMut<'b, T>> for MatrixSlice<'a, T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, 'c, T> Mul<MatrixSliceMut<'b, T>> for &'c MatrixSlice<'a, T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, 'c, 'd, T> Mul<&'d MatrixSliceMut<'b, T>> for &'c MatrixSlice<'a, T> where T: Any + Copy + Zero + Add<T, Output=T> + Mul<T, Output=T>
[src]

Multiplies two matrices together.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'm, T> Mul<PermutationMatrix<T>> for &'a MatrixSlice<'m, T> where T: Zero + Clone
[src]

Right-multiply a matrix by a permutation matrix.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, 'm, T> Mul<&'b PermutationMatrix<T>> for &'a MatrixSlice<'m, T> where T: Zero + Clone
[src]

Right-multiply a matrix by a permutation matrix.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'm, T> Mul<PermutationMatrix<T>> for MatrixSlice<'m, T> where T: Zero + Clone
[src]

Right-multiply a matrix by a permutation matrix.

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, 'm, T> Mul<&'b PermutationMatrix<T>> for MatrixSlice<'m, T> where T: Zero + Clone
[src]

Right-multiply a matrix by a permutation matrix.

The resulting type after applying the * operator

The method for the * operator

impl<'a, T: Debug + 'a> Debug for MatrixSlice<'a, T>
[src]

Formats the value using the given formatter.

impl<'a, T: Clone + 'a> Clone for MatrixSlice<'a, T>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a, T: Copy + 'a> Copy for MatrixSlice<'a, T>
[src]