Struct pathfinding::Matrix
[−]
[src]
pub struct Matrix<C> { pub rows: usize, pub columns: usize, // some fields omitted }
Matrix of an arbitrary type. Data are stored consecutively in
memory, by rows. Raw data can be accessed using as_ref()
or as_mut()
.
Fields
rows: usize
Rows
columns: usize
Columns
Methods
impl<C: Clone> Matrix<C>
[src]
fn new(rows: usize, columns: usize, value: C) -> Matrix<C>
[src]
Create new matrix with an initial value.
fn new_square(size: usize, value: C) -> Matrix<C>
[src]
Create new square matrix with initial value.
fn fill(&mut self, value: C)
[src]
Fill with a known value.
fn slice(&self, rows: Range<usize>, columns: Range<usize>) -> Matrix<C>
[src]
Return a copy of a sub-matrix.
fn rotated_cw(&self, times: usize) -> Matrix<C>
[src]
Return a copy of a square matrix rotated clock-wise a number of times.
Panics
This function panics if the matrix is not square.
fn rotated_ccw(&self, times: usize) -> Matrix<C>
[src]
Return a copy of a square matrix rotated counter-clock-wise a number of times.
Panics
This function panics if the matrix is not square.
fn flipped_lr(&self) -> Matrix<C>
[src]
Return a copy of the matrix flipped along the vertical axis.
fn flipped_ud(&self) -> Matrix<C>
[src]
Return a copy of the matrix flipped along the horizontal axis.
fn transposed(&self) -> Matrix<C>
[src]
Return a copy of the matrix after transposition.
impl<C: Copy> Matrix<C>
[src]
fn set_slice(&mut self, pos: &(usize, usize), slice: &Matrix<C>)
[src]
Replace a slice of the current matrix with the content of another one.
impl<C> Matrix<C>
[src]
fn from_vec(rows: usize, columns: usize, values: Vec<C>) -> Matrix<C>
[src]
Create new matrix from vector values. The first value will be assigned to index (0, 0), the second one to index (0, 1), and so on.
Panics
This function will panic if the number of values does not correspond to the announced size.
fn square_from_vec(values: Vec<C>) -> Matrix<C>
[src]
Create new square matrix from vector values. The first value will be assigned to index (0, 0), the second one to index (0, 1), and so on.
Panics
This function will panic if the number of values is not a square number.
fn is_square(&self) -> bool
[src]
Check if a matrix is a square one.
fn idx(&self, i: &(usize, usize)) -> usize
[src]
Index in raw data of a given position.
fn flip_lr(&mut self)
[src]
Flip the matrix around the vertical axis.
fn flip_ud(&mut self)
[src]
Flip the matrix around the horizontal axis.
fn rotate_cw(&mut self, times: usize)
[src]
Rotate a square matrix clock-wise a number of times.
Panics
This function panics if the matrix is not square.
fn rotate_ccw(&mut self, times: usize)
[src]
Rotate a square matrix counter-clock-wise a number of times.
Panics
This function panics if the matrix is not square.
Trait Implementations
impl<C: Copy> Weights<C> for Matrix<C>
[src]
fn rows(&self) -> usize
[src]
Return the number of rows.
fn columns(&self) -> usize
[src]
Return the number of columns.
fn at(&self, row: usize, col: usize) -> C
[src]
Return the element at position.
fn neg(&self) -> Self where
C: Signed,
[src]
C: Signed,
Return the negated weights.
impl<C: Clone> Clone for Matrix<C>
[src]
fn clone(&self) -> Matrix<C>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<C: Debug> Debug for Matrix<C>
[src]
impl<C: Eq> Eq for Matrix<C>
[src]
impl<C: Hash> Hash for Matrix<C>
[src]
fn hash<__HC: Hasher>(&self, __arg_0: &mut __HC)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl<C: PartialEq> PartialEq for Matrix<C>
[src]
fn eq(&self, __arg_0: &Matrix<C>) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Matrix<C>) -> bool
[src]
This method tests for !=
.
impl<C: Send> Send for Matrix<C>
[src]
impl<C: Clone + Signed> Neg for Matrix<C>
[src]
type Output = Matrix<C>
The resulting type after applying the -
operator.
fn neg(self) -> Matrix<C>
[src]
Performs the unary -
operation.
impl<'a, C> Index<&'a (usize, usize)> for Matrix<C>
[src]
type Output = C
The returned type after indexing.
fn index(&self, index: &'a (usize, usize)) -> &C
[src]
Performs the indexing (container[index]
) operation.
impl<'a, C> IndexMut<&'a (usize, usize)> for Matrix<C>
[src]
fn index_mut(&mut self, index: &'a (usize, usize)) -> &mut C
[src]
Performs the mutable indexing (container[index]
) operation.