Struct rulinalg::matrix::MatrixSliceMut [] [src]

pub struct MatrixSliceMut<'a, T: 'a> {
    // some fields omitted
}

A mutable MatrixSliceMut

This struct provides a mutable 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> MatrixSliceMut<'a, T>
[src]

fn iter_rows(&self) -> Rows<T>

Iterate over the rows of the mutable matrix slice.

Examples

use rulinalg::matrix::{Matrix, MatrixSliceMut};

let mut a = Matrix::new(3 ,2, (0..6).collect::<Vec<usize>>());
let b = MatrixSliceMut::from_matrix(&mut a, [0,0], 2, 2);

// Prints "2" two times.
for row in b.iter_rows() {
    println!("{}", row.len());
}

fn iter_rows_mut(&self) -> RowsMut<T>

Iterate over the mutable rows of the matrix.

Examples

use rulinalg::matrix::{Matrix, MatrixSliceMut};

let mut a = Matrix::new(3, 2, (0..6).collect::<Vec<usize>>());

// New scope (so we can consume `a` after)
{
   let b = MatrixSliceMut::from_matrix(&mut a, [0,0], 2, 2);

    for row in b.iter_rows_mut() {
        for r in row {
            *r = *r + 1;
        }
    }
}

// The first two rows have been incremented by 1
println!("{}", a);

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

fn from_matrix(mat: &'a mut Matrix<T>, start: [usize; 2], rows: usize, cols: usize) -> MatrixSliceMut<T>

Produce a matrix slice from a matrix

Examples

use rulinalg::matrix::Matrix;
use rulinalg::matrix::MatrixSliceMut;

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

unsafe fn from_raw_parts(ptr: *mut T, rows: usize, cols: usize, row_stride: usize) -> MatrixSliceMut<'a, T>

Creates a mutable matrix slice from raw parts.

Examples

use rulinalg::matrix::MatrixSliceMut;

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

unsafe {
    // Create a mutable 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 = MatrixSliceMut::from_raw_parts(a.as_mut_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.

fn reslice(self, start: [usize; 2], rows: usize, cols: usize) -> MatrixSliceMut<'a, T>

Produce a matrix slice from an existing matrix slice.

Examples

use rulinalg::matrix::Matrix;
use rulinalg::matrix::MatrixSliceMut;

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

fn iter(&self) -> SliceIter<'a, T>

Returns an iterator over the matrix slice.

Examples

use rulinalg::matrix::Matrix;
use rulinalg::matrix::MatrixSliceMut;

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

let slice_data = slice.iter().map(|v| *v).collect::<Vec<usize>>();
assert_eq!(slice_data, vec![4,5,7,8]);

fn iter_mut(&mut self) -> SliceIterMut<'a, T>

Returns a mutable iterator over the matrix slice.

Examples

use rulinalg::matrix::Matrix;
use rulinalg::matrix::MatrixSliceMut;

let mut a = Matrix::new(3,3, (0..9).collect::<Vec<usize>>());

{
    let mut slice = MatrixSliceMut::from_matrix(&mut a, [1,1], 2, 2);

    for d in slice.iter_mut() {
        *d = *d + 2;
    }
}

// Only the matrix slice is updated.
assert_eq!(a.into_vec(), vec![0,1,2,3,6,7,6,9,10]);

fn get_row_mut(&mut self, index: usize) -> Option<&mut [T]>

Returns a mutable reference to the row of a MatrixSliceMut at the given index. None if the index is out of bounds.

Examples

use rulinalg::matrix::Matrix;
use rulinalg::matrix::MatrixSliceMut;

let mut a = Matrix::new(3,3, (0..9).collect::<Vec<usize>>());
let mut slice = MatrixSliceMut::from_matrix(&mut a, [1,1], 2, 2);
{
    let row = slice.get_row_mut(1);
    let mut expected = vec![7usize, 8];
    assert_eq!(row, Some(&mut *expected));
}
assert!(slice.get_row_mut(5).is_none());

unsafe fn get_row_unchecked_mut(&mut self, index: usize) -> &mut [T]

Returns a mutable reference to the row of a MatrixSliceMut at the given index without doing unbounds checking

Examples

use rulinalg::matrix::Matrix;
use rulinalg::matrix::MatrixSliceMut;

let mut a = Matrix::new(3,3, (0..9).collect::<Vec<usize>>());
let mut slice = MatrixSliceMut::from_matrix(&mut a, [1,1], 2, 2);
let row = unsafe { slice.get_row_unchecked_mut(1) };
let mut expected = vec![7usize, 8];
assert_eq!(row, &mut *expected);

impl<'a, T: Copy> MatrixSliceMut<'a, T>
[src]

fn into_matrix(self) -> Matrix<T>

Convert the matrix slice into a new Matrix.

fn set_to(self, target: MatrixSlice<T>)

Sets the underlying matrix data to the target data.

Examples

use rulinalg::matrix::{Matrix, MatrixSliceMut};

let mut mat = Matrix::<f32>::zeros(4,4);
let one_block = Matrix::<f32>::ones(2,2);

// Get a mutable slice of the upper left 2x2 block.
let mat_block = MatrixSliceMut::from_matrix(&mut mat, [0,0], 2, 2);

// Set the upper left 2x2 block to be ones.
mat_block.set_to(one_block.as_slice());

Panics

Panics if the dimensions of self and target are not the same.

Trait Implementations

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

Indexes mutable matrix slice. Takes row index first then column.

type Output = T

The returned type after indexing

fn index(&self, idx: [usize; 2]) -> &T

The method for the indexing (Foo[Bar]) operation

impl<'a, T> IndexMut<[usize; 2]> for MatrixSliceMut<'a, T>
[src]

Indexes mutable matrix slice.

Takes row index first then column.

fn index_mut(&mut self, idx: [usize; 2]) -> &mut T

The method for the indexing (Foo[Bar]) operation

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

Scalar multiplication with matrix slice.

type Output = Matrix<T>

The resulting type after applying the * operator

fn mul(self, f: T) -> Matrix<T>

The method for the * operator

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

Scalar multiplication with matrix slice.

type Output = Matrix<T>

The resulting type after applying the * operator

fn mul(self, f: &T) -> Matrix<T>

The method for the * operator

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

Scalar multiplication with matrix slice.

type Output = Matrix<T>

The resulting type after applying the * operator

fn mul(self, f: T) -> Matrix<T>

The method for the * operator

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

Scalar multiplication with matrix slice.

type Output = Matrix<T>

The resulting type after applying the * operator

fn mul(self, f: &T) -> Matrix<T>

The method for the * operator

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

Scalar division with matrix slice.

type Output = Matrix<T>

The resulting type after applying the / operator

fn div(self, f: T) -> Matrix<T>

The method for the / operator

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

Scalar division with matrix slice.

type Output = Matrix<T>

The resulting type after applying the / operator

fn div(self, f: &T) -> Matrix<T>

The method for the / operator

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

Scalar division with matrix slice.

type Output = Matrix<T>

The resulting type after applying the / operator

fn div(self, f: T) -> Matrix<T>

The method for the / operator

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

Scalar division with matrix slice.

type Output = Matrix<T>

The resulting type after applying the / operator

fn div(self, f: &T) -> Matrix<T>

The method for the / operator

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

Scalar addition with matrix slice.

type Output = Matrix<T>

The resulting type after applying the + operator

fn add(self, f: T) -> Matrix<T>

The method for the + operator

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

Scalar addition with matrix slice.

type Output = Matrix<T>

The resulting type after applying the + operator

fn add(self, f: &T) -> Matrix<T>

The method for the + operator

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

Scalar addition with matrix slice.

type Output = Matrix<T>

The resulting type after applying the + operator

fn add(self, f: T) -> Matrix<T>

The method for the + operator

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

Scalar addition with matrix slice.

type Output = Matrix<T>

The resulting type after applying the + operator

fn add(self, f: &T) -> Matrix<T>

The method for the + operator

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

Scalar subtraction with matrix slice.

type Output = Matrix<T>

The resulting type after applying the - operator

fn sub(self, f: T) -> Matrix<T>

The method for the - operator

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

Scalar subtraction with matrix slice.

type Output = Matrix<T>

The resulting type after applying the - operator

fn sub(self, f: &T) -> Matrix<T>

The method for the - operator

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

Scalar subtraction with matrix slice.

type Output = Matrix<T>

The resulting type after applying the - operator

fn sub(self, f: T) -> Matrix<T>

The method for the - operator

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

Scalar subtraction with matrix slice.

type Output = Matrix<T>

The resulting type after applying the - operator

fn sub(self, f: &T) -> Matrix<T>

The method for the - operator

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

Performs elementwise addition between the slices.

type Output = Matrix<T>

The resulting type after applying the + operator

fn add(self, s: MatrixSlice<T>) -> Matrix<T>

The method for the + operator

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

Performs elementwise addition between the slices.

type Output = Matrix<T>

The resulting type after applying the + operator

fn add(self, s: MatrixSlice<T>) -> Matrix<T>

The method for the + operator

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

Performs elementwise addition between the slices.

type Output = Matrix<T>

The resulting type after applying the + operator

fn add(self, s: &MatrixSlice<T>) -> Matrix<T>

The method for the + operator

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

Performs elementwise addition between the slices.

type Output = Matrix<T>

The resulting type after applying the + operator

fn add(self, s: &MatrixSlice<T>) -> Matrix<T>

The method for the + operator

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

Performs elementwise addition between the slices.

type Output = Matrix<T>

The resulting type after applying the + operator

fn add(self, s: MatrixSliceMut<T>) -> Matrix<T>

The method for the + operator

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

Performs elementwise addition between the slices.

type Output = Matrix<T>

The resulting type after applying the + operator

fn add(self, s: MatrixSliceMut<T>) -> Matrix<T>

The method for the + operator

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

Performs elementwise addition between the slices.

type Output = Matrix<T>

The resulting type after applying the + operator

fn add(self, s: &MatrixSliceMut<T>) -> Matrix<T>

The method for the + operator

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

Performs elementwise addition between the slices.

type Output = Matrix<T>

The resulting type after applying the + operator

fn add(self, s: &MatrixSliceMut<T>) -> Matrix<T>

The method for the + operator

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

Performs elementwise subtraction between the slices.

type Output = Matrix<T>

The resulting type after applying the - operator

fn sub(self, s: MatrixSlice<T>) -> Matrix<T>

The method for the - operator

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

Performs elementwise subtraction between the slices.

type Output = Matrix<T>

The resulting type after applying the - operator

fn sub(self, s: MatrixSlice<T>) -> Matrix<T>

The method for the - operator

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

Performs elementwise subtraction between the slices.

type Output = Matrix<T>

The resulting type after applying the - operator

fn sub(self, s: &MatrixSlice<T>) -> Matrix<T>

The method for the - operator

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

Performs elementwise subtraction between the slices.

type Output = Matrix<T>

The resulting type after applying the - operator

fn sub(self, s: &MatrixSlice<T>) -> Matrix<T>

The method for the - operator

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

Performs elementwise subtraction between the slices.

type Output = Matrix<T>

The resulting type after applying the - operator

fn sub(self, s: MatrixSliceMut<T>) -> Matrix<T>

The method for the - operator

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

Performs elementwise subtraction between the slices.

type Output = Matrix<T>

The resulting type after applying the - operator

fn sub(self, s: MatrixSliceMut<T>) -> Matrix<T>

The method for the - operator

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

Performs elementwise subtraction between the slices.

type Output = Matrix<T>

The resulting type after applying the - operator

fn sub(self, s: &MatrixSliceMut<T>) -> Matrix<T>

The method for the - operator

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

Performs elementwise subtraction between the slices.

type Output = Matrix<T>

The resulting type after applying the - operator

fn sub(self, s: &MatrixSliceMut<T>) -> Matrix<T>

The method for the - operator

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

Performs elementwise addition between Matrix and MatrixSlice.

type Output = Matrix<T>

The resulting type after applying the + operator

fn add(self, m: Matrix<T>) -> Matrix<T>

The method for the + operator

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

Performs elementwise addition between Matrix and MatrixSlice.

type Output = Matrix<T>

The resulting type after applying the + operator

fn add(self, m: Matrix<T>) -> Matrix<T>

The method for the + operator

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

Performs elementwise addition between Matrix and MatrixSlice.

type Output = Matrix<T>

The resulting type after applying the + operator

fn add(self, m: &Matrix<T>) -> Matrix<T>

The method for the + operator

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

Performs elementwise addition between Matrix and MatrixSlice.

type Output = Matrix<T>

The resulting type after applying the + operator

fn add(self, m: &Matrix<T>) -> Matrix<T>

The method for the + operator

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

Performs elementwise subtraction between Matrix and MatrixSlice.

type Output = Matrix<T>

The resulting type after applying the - operator

fn sub(self, m: Matrix<T>) -> Matrix<T>

The method for the - operator

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

Performs elementwise subtraction between Matrix and MatrixSlice.

type Output = Matrix<T>

The resulting type after applying the - operator

fn sub(self, m: Matrix<T>) -> Matrix<T>

The method for the - operator

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

Performs elementwise subtraction between Matrix and MatrixSlice.

type Output = Matrix<T>

The resulting type after applying the - operator

fn sub(self, m: &Matrix<T>) -> Matrix<T>

The method for the - operator

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

Performs elementwise subtraction between Matrix and MatrixSlice.

type Output = Matrix<T>

The resulting type after applying the - operator

fn sub(self, m: &Matrix<T>) -> Matrix<T>

The method for the - operator

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

Performs addition assignment between a mutable matrix slice and a scalar.

fn add_assign(&mut self, _rhs: T)

The method for the += operator

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

Performs addition assignment between a mutable matrix slice and a scalar.

fn add_assign(&mut self, _rhs: &T)

The method for the += operator

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

Performs subtraction assignment between a mutable matrix slice and a scalar.

fn sub_assign(&mut self, _rhs: T)

The method for the -= operator

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

Performs subtraction assignment between a mutable matrix slice and a scalar.

fn sub_assign(&mut self, _rhs: &T)

The method for the -= operator

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

Performs division assignment between a mutable matrix slice and a scalar.

fn div_assign(&mut self, _rhs: T)

The method for the /= operator

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

Performs division assignment between a mutable matrix slice and a scalar.

fn div_assign(&mut self, _rhs: &T)

The method for the /= operator

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

Performs multiplication assignment between a mutable matrix slice and a scalar.

fn mul_assign(&mut self, _rhs: T)

The method for the *= operator

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

Performs multiplication assignment between a mutable matrix slice and a scalar.

fn mul_assign(&mut self, _rhs: &T)

The method for the *= operator

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

Performs elementwise addition assignment between two matrices.

fn add_assign(&mut self, _rhs: Matrix<T>)

The method for the += operator

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

Performs elementwise addition assignment between two matrices.

fn add_assign(&mut self, _rhs: &Matrix<T>)

The method for the += operator

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

Performs elementwise subtraction assignment between two matrices.

fn sub_assign(&mut self, _rhs: Matrix<T>)

The method for the -= operator

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

Performs elementwise subtraction assignment between two matrices.

fn sub_assign(&mut self, _rhs: &Matrix<T>)

The method for the -= operator

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

Performs elementwise addition assignment between two matrices.

fn add_assign(&mut self, _rhs: MatrixSlice<T>)

The method for the += operator

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

Performs elementwise addition assignment between two matrices.

fn add_assign(&mut self, _rhs: &MatrixSlice<T>)

The method for the += operator

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

Performs elementwise subtraction assignment between two matrices.

fn sub_assign(&mut self, _rhs: MatrixSlice<T>)

The method for the -= operator

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

Performs elementwise subtraction assignment between two matrices.

fn sub_assign(&mut self, _rhs: &MatrixSlice<T>)

The method for the -= operator

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

Performs elementwise addition assignment between two matrices.

fn add_assign(&mut self, _rhs: MatrixSliceMut<T>)

The method for the += operator

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

Performs elementwise addition assignment between two matrices.

fn add_assign(&mut self, _rhs: &MatrixSliceMut<T>)

The method for the += operator

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

Performs elementwise subtraction assignment between two matrices.

fn sub_assign(&mut self, _rhs: MatrixSliceMut<T>)

The method for the -= operator

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

Performs elementwise subtraction assignment between two matrices.

fn sub_assign(&mut self, _rhs: &MatrixSliceMut<T>)

The method for the -= operator

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

Gets negative of matrix slice.

type Output = Matrix<T>

The resulting type after applying the - operator

fn neg(self) -> Matrix<T>

The method for the unary - operator

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

Gets negative of matrix slice.

type Output = Matrix<T>

The resulting type after applying the - operator

fn neg(self) -> Matrix<T>

The method for the unary - operator

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

Multiplies two matrices together.

type Output = Matrix<T>

The resulting type after applying the * operator

fn mul(self, m: Matrix<T>) -> Matrix<T>

The method for the * operator

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

Multiplies two matrices together.

type Output = Matrix<T>

The resulting type after applying the * operator

fn mul(self, m: &Matrix<T>) -> Matrix<T>

The method for the * operator

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

Multiplies two matrices together.

type Output = Matrix<T>

The resulting type after applying the * operator

fn mul(self, m: Matrix<T>) -> Matrix<T>

The method for the * operator

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

Multiplies two matrices together.

type Output = Matrix<T>

The resulting type after applying the * operator

fn mul(self, m: &Matrix<T>) -> Matrix<T>

The method for the * operator

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

Multiplies two matrices together.

type Output = Matrix<T>

The resulting type after applying the * operator

fn mul(self, m: MatrixSlice<T>) -> Matrix<T>

The method for the * operator

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

Multiplies two matrices together.

type Output = Matrix<T>

The resulting type after applying the * operator

fn mul(self, m: &MatrixSlice<T>) -> Matrix<T>

The method for the * operator

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

Multiplies two matrices together.

type Output = Matrix<T>

The resulting type after applying the * operator

fn mul(self, m: MatrixSlice<T>) -> Matrix<T>

The method for the * operator

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

Multiplies two matrices together.

type Output = Matrix<T>

The resulting type after applying the * operator

fn mul(self, m: &MatrixSlice<T>) -> Matrix<T>

The method for the * operator

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

Multiplies two matrices together.

type Output = Matrix<T>

The resulting type after applying the * operator

fn mul(self, m: MatrixSliceMut<T>) -> Matrix<T>

The method for the * operator

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

Multiplies two matrices together.

type Output = Matrix<T>

The resulting type after applying the * operator

fn mul(self, m: &MatrixSliceMut<T>) -> Matrix<T>

The method for the * operator

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

Multiplies two matrices together.

type Output = Matrix<T>

The resulting type after applying the * operator

fn mul(self, m: MatrixSliceMut<T>) -> Matrix<T>

The method for the * operator

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

Multiplies two matrices together.

type Output = Matrix<T>

The resulting type after applying the * operator

fn mul(self, m: &MatrixSliceMut<T>) -> Matrix<T>

The method for the * operator

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

type Item = &'a mut T

The type of the elements being iterated over.

type IntoIter = SliceIterMut<'a, T>

Which kind of iterator are we turning this into?

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

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

type Item = &'a T

The type of the elements being iterated over.

type IntoIter = SliceIter<'a, T>

Which kind of iterator are we turning this into?

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

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

type Item = &'a mut T

The type of the elements being iterated over.

type IntoIter = SliceIterMut<'a, T>

Which kind of iterator are we turning this into?

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

impl<'a, T> BaseSlice<T> for MatrixSliceMut<'a, T>
[src]

fn rows(&self) -> usize

Rows in the slice.

fn cols(&self) -> usize

Columns in the slice.

fn row_stride(&self) -> usize

Row stride in the slice.

fn as_ptr(&self) -> *const T

Top left index of the slice.

unsafe fn get_unchecked(&self, index: [usize; 2]) -> &T

Get a reference to a point in the slice without bounds checking.

fn get_row(&self, index: usize) -> Option<&[T]>

Returns the row of a Matrix at the given index. None if the index is out of bounds. Read more

unsafe fn get_row_unchecked(&self, index: usize) -> &[T]

Returns the row of a BaseSlice at the given index without doing unbounds checking Read more

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

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<'a, T: Float> Metric<T> for MatrixSliceMut<'a, T>
[src]

fn norm(&self) -> T

Compute euclidean norm for matrix.

Examples

use rulinalg::matrix::{Matrix, MatrixSliceMut};
use rulinalg::Metric;

let mut a = Matrix::new(2,1, vec![3.0,4.0]);
let b = MatrixSliceMut::from_matrix(&mut a, [0,0], 2, 1);
let c = b.norm();

assert_eq!(c, 5.0);