Row

Struct Row 

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

Row of a matrix.

This struct points to a slice making up a row in a matrix. You can deref this struct to retrieve a MatrixSlice of the row.

§Example

use rulinalg::matrix::BaseMatrix;

let mat = matrix![1.0, 2.0;
                  3.0, 4.0];

let row = mat.row(1);
assert_eq!((*row + 2.0).sum(), 11.0);

Implementations§

Source§

impl<'a, T: 'a> Row<'a, T>

Source

pub fn raw_slice(&self) -> &'a [T]

Returns the row as a slice.

Trait Implementations§

Source§

impl<'a, T> BaseMatrix<T> for Row<'a, T>

Source§

fn rows(&self) -> usize

Rows in the matrix.
Source§

fn cols(&self) -> usize

Columns in the matrix.
Source§

fn row_stride(&self) -> usize

Row stride in the matrix.
Source§

fn as_ptr(&self) -> *const T

Top left index of the matrix.
Source§

fn is_empty(&self) -> bool

Returns true if the matrix contais no elements
Source§

fn as_slice(&self) -> MatrixSlice<'_, T>

Returns a MatrixSlice over the whole matrix. Read more
Source§

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

Get a reference to a point in the matrix without bounds checking.
Source§

fn col(&self, index: usize) -> Column<'_, T>

Returns the column of a matrix at the given index. None if the index is out of bounds. Read more
Source§

unsafe fn col_unchecked(&self, index: usize) -> Column<'_, T>

Returns the column of a matrix at the given index without doing a bounds check. Read more
Source§

fn row(&self, index: usize) -> Row<'_, T>

Returns the row of a matrix at the given index. Read more
Source§

unsafe fn row_unchecked(&self, index: usize) -> Row<'_, T>

Returns the row of a matrix at the given index without doing unbounds checking Read more
Source§

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

Returns an iterator over the matrix data. Read more
Source§

fn col_iter(&self) -> Cols<'_, T>

Iterate over the columns of the matrix. Read more
Source§

fn row_iter(&self) -> Rows<'_, T>

Iterate over the rows of the matrix. Read more
Source§

fn diag_iter(&self, k: DiagOffset) -> Diagonal<'_, T, Self>

Iterate over diagonal entries Read more
Source§

fn sum_rows(&self) -> Vector<T>
where T: Copy + Zero + Add<T, Output = T>,

The sum of the rows of the matrix. Read more
Source§

fn sum_cols(&self) -> Vector<T>
where T: Copy + Zero + Add<T, Output = T>,

The sum of the columns of the matrix. Read more
Source§

fn norm<N: MatrixNorm<T, Self>>(&self, norm: N) -> T
where T: Float,

Compute given matrix norm for matrix. Read more
Source§

fn metric<'a, 'b, B, M>(&'a self, mat: &'b B, metric: M) -> T
where B: 'b + BaseMatrix<T>, M: MatrixMetric<'a, 'b, T, Self, B>,

Compute the metric distance between two matrices. Read more
Source§

fn sum(&self) -> T
where T: Copy + Zero + Add<T, Output = T>,

The sum of all elements in the matrix Read more
Source§

fn min(&self, axis: Axes) -> Vector<T>
where T: Copy + PartialOrd,

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

fn max(&self, axis: Axes) -> Vector<T>
where T: Copy + PartialOrd,

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

fn into_matrix(self) -> Matrix<T>
where T: Copy,

Convert the matrix struct into a owned Matrix.
Source§

fn select_rows<'a, I>(&self, rows: I) -> Matrix<T>
where T: Copy, I: IntoIterator<Item = &'a usize>, I::IntoIter: ExactSizeIterator + Clone,

Select rows from matrix Read more
Source§

fn select_cols<'a, I>(&self, cols: I) -> Matrix<T>
where T: Copy, I: IntoIterator<Item = &'a usize>, I::IntoIter: ExactSizeIterator + Clone,

Select columns from matrix Read more
Source§

fn elemul(&self, m: &Self) -> Matrix<T>
where T: Copy + Mul<T, Output = T>,

The elementwise product of two matrices. Read more
Source§

fn elediv(&self, m: &Self) -> Matrix<T>
where T: Copy + Div<T, Output = T>,

The elementwise division of two matrices. Read more
Source§

fn select(&self, rows: &[usize], cols: &[usize]) -> Matrix<T>
where T: Copy,

Select block matrix from matrix Read more
Source§

fn hcat<S>(&self, m: &S) -> Matrix<T>
where T: Copy, S: BaseMatrix<T>,

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

fn vcat<S>(&self, m: &S) -> Matrix<T>
where T: Copy, S: BaseMatrix<T>,

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

fn diag(&self) -> Diagonal<'_, T, Self>

Extract the diagonal of the matrix Read more
Source§

fn transpose(&self) -> Matrix<T>
where T: Copy,

Tranposes the given matrix Read more
Source§

fn is_diag(&self) -> bool
where T: Zero + PartialEq,

Checks if matrix is diagonal. Read more
Source§

fn solve_u_triangular(&self, y: Vector<T>) -> Result<Vector<T>, Error>
where T: Any + Float,

Solves an upper triangular linear system. Read more
Source§

fn solve_l_triangular(&self, y: Vector<T>) -> Result<Vector<T>, Error>
where T: Any + Float,

Solves a lower triangular linear system. Read more
Source§

fn split_at( &self, mid: usize, axis: Axes, ) -> (MatrixSlice<'_, T>, MatrixSlice<'_, T>)

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

fn sub_slice<'a>( &self, start: [usize; 2], rows: usize, cols: usize, ) -> MatrixSlice<'a, T>
where T: 'a,

Produce a MatrixSlice from an existing matrix. Read more
Source§

impl<'a, T: Clone + 'a> Clone for Row<'a, T>

Source§

fn clone(&self) -> Row<'a, T>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a, T: Debug + 'a> Debug for Row<'a, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a, T: 'a> Deref for Row<'a, T>

Source§

type Target = MatrixSlice<'a, T>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &MatrixSlice<'a, T>

Dereferences the value.
Source§

impl<'a, T: Clone> From<Row<'a, T>> for Vector<T>

Source§

fn from(row: Row<'a, T>) -> Self

Converts to this type from the input type.
Source§

impl<'a, T: 'a + Copy> FromIterator<Row<'a, T>> for Matrix<T>

Source§

fn from_iter<I: IntoIterator<Item = Row<'a, T>>>(iterable: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<'a, T> Index<usize> for Row<'a, T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, idx: usize) -> &T

Performs the indexing (container[index]) operation. Read more
Source§

impl<'a, T: Copy + 'a> Copy for Row<'a, T>

Auto Trait Implementations§

§

impl<'a, T> Freeze for Row<'a, T>

§

impl<'a, T> RefUnwindSafe for Row<'a, T>
where T: RefUnwindSafe,

§

impl<'a, T> !Send for Row<'a, T>

§

impl<'a, T> !Sync for Row<'a, T>

§

impl<'a, T> Unpin for Row<'a, T>

§

impl<'a, T> UnwindSafe for Row<'a, T>
where T: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.