Struct nalgebra::base::MatrixVec [−][src]
A Vec-based matrix data storage. It may be dynamically-sized.
Methods
impl<N, R: Dim, C: Dim> MatrixVec<N, R, C>
[src]
impl<N, R: Dim, C: Dim> MatrixVec<N, R, C>
pub fn new(nrows: R, ncols: C, data: Vec<N>) -> MatrixVec<N, R, C>
[src]
pub fn new(nrows: R, ncols: C, data: Vec<N>) -> MatrixVec<N, R, C>
Creates a new dynamic matrix data storage from the given vector and shape.
pub fn data(&self) -> &Vec<N>
[src]
pub fn data(&self) -> &Vec<N>
The underlying data storage.
pub unsafe fn data_mut(&mut self) -> &mut Vec<N>
[src]
pub unsafe fn data_mut(&mut self) -> &mut Vec<N>
The underlying mutable data storage.
This is unsafe because this may cause UB if the vector is modified by the user.
pub unsafe fn resize(self, sz: usize) -> Vec<N>
[src]
pub unsafe fn resize(self, sz: usize) -> Vec<N>
Resizes the underlying mutable data storage and unwraps it.
If sz
is larger than the current size, additional elements are uninitialized.
If sz
is smaller than the current size, additional elements are truncated.
Methods from Deref<Target = Vec<N>>
pub fn capacity(&self) -> usize
1.0.0[src]
pub fn capacity(&self) -> usize
Returns the number of elements the vector can hold without reallocating.
Examples
let vec: Vec<i32> = Vec::with_capacity(10); assert_eq!(vec.capacity(), 10);
pub fn as_slice(&self) -> &[T]
1.7.0[src]
pub fn as_slice(&self) -> &[T]
Extracts a slice containing the entire vector.
Equivalent to &s[..]
.
Examples
use std::io::{self, Write}; let buffer = vec![1, 2, 3, 5, 8]; io::sink().write(buffer.as_slice()).unwrap();
pub fn len(&self) -> usize
1.0.0[src]
pub fn len(&self) -> usize
Returns the number of elements in the vector, also referred to as its 'length'.
Examples
let a = vec![1, 2, 3]; assert_eq!(a.len(), 3);
pub fn is_empty(&self) -> bool
1.0.0[src]
pub fn is_empty(&self) -> bool
Returns true
if the vector contains no elements.
Examples
let mut v = Vec::new(); assert!(v.is_empty()); v.push(1); assert!(!v.is_empty());
Trait Implementations
impl<N: Eq, R: Eq + Dim, C: Eq + Dim> Eq for MatrixVec<N, R, C>
[src]
impl<N: Eq, R: Eq + Dim, C: Eq + Dim> Eq for MatrixVec<N, R, C>
impl<N: Debug, R: Debug + Dim, C: Debug + Dim> Debug for MatrixVec<N, R, C>
[src]
impl<N: Debug, R: Debug + Dim, C: Debug + Dim> Debug for MatrixVec<N, R, C>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<N: Clone, R: Clone + Dim, C: Clone + Dim> Clone for MatrixVec<N, R, C>
[src]
impl<N: Clone, R: Clone + Dim, C: Clone + Dim> Clone for MatrixVec<N, R, C>
fn clone(&self) -> MatrixVec<N, R, C>
[src]
fn clone(&self) -> MatrixVec<N, R, C>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<N: PartialEq, R: PartialEq + Dim, C: PartialEq + Dim> PartialEq for MatrixVec<N, R, C>
[src]
impl<N: PartialEq, R: PartialEq + Dim, C: PartialEq + Dim> PartialEq for MatrixVec<N, R, C>
fn eq(&self, other: &MatrixVec<N, R, C>) -> bool
[src]
fn eq(&self, other: &MatrixVec<N, R, C>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &MatrixVec<N, R, C>) -> bool
[src]
fn ne(&self, other: &MatrixVec<N, R, C>) -> bool
This method tests for !=
.
impl<N, R: Dim, C: Dim> Deref for MatrixVec<N, R, C>
[src]
impl<N, R: Dim, C: Dim> Deref for MatrixVec<N, R, C>
type Target = Vec<N>
The resulting type after dereferencing.
fn deref(&self) -> &Self::Target
[src]
fn deref(&self) -> &Self::Target
Dereferences the value.
impl<N: Scalar, C: Dim> Storage<N, Dynamic, C> for MatrixVec<N, Dynamic, C> where
DefaultAllocator: Allocator<N, Dynamic, C, Buffer = Self>,
[src]
impl<N: Scalar, C: Dim> Storage<N, Dynamic, C> for MatrixVec<N, Dynamic, C> where
DefaultAllocator: Allocator<N, Dynamic, C, Buffer = Self>,
type RStride = U1
The static stride of this storage's rows.
type CStride = Dynamic
The static stride of this storage's columns.
fn ptr(&self) -> *const N
[src]
fn ptr(&self) -> *const N
The matrix data pointer.
fn shape(&self) -> (Dynamic, C)
[src]
fn shape(&self) -> (Dynamic, C)
The dimension of the matrix at run-time. Arr length of zero indicates the additive identity element of any dimension. Must be equal to Self::dimension()
if it is not None
. Read more
fn strides(&self) -> (Self::RStride, Self::CStride)
[src]
fn strides(&self) -> (Self::RStride, Self::CStride)
The spacing between consecutive row elements and consecutive column elements. Read more
fn is_contiguous(&self) -> bool
[src]
fn is_contiguous(&self) -> bool
Indicates whether this data buffer stores its elements contiguously.
fn into_owned(self) -> Owned<N, Dynamic, C> where
DefaultAllocator: Allocator<N, Dynamic, C>,
[src]
fn into_owned(self) -> Owned<N, Dynamic, C> where
DefaultAllocator: Allocator<N, Dynamic, C>,
Builds a matrix data storage that does not contain any reference.
fn clone_owned(&self) -> Owned<N, Dynamic, C> where
DefaultAllocator: Allocator<N, Dynamic, C>,
[src]
fn clone_owned(&self) -> Owned<N, Dynamic, C> where
DefaultAllocator: Allocator<N, Dynamic, C>,
Clones this data storage to one that does not contain any reference.
fn as_slice(&self) -> &[N]
[src]
fn as_slice(&self) -> &[N]
Retrieves the data buffer as a contiguous slice. Read more
fn linear_index(&self, irow: usize, icol: usize) -> usize
[src]
fn linear_index(&self, irow: usize, icol: usize) -> usize
Compute the index corresponding to the irow-th row and icol-th column of this matrix. The index must be such that the following holds: Read more
unsafe fn get_address_unchecked_linear(&self, i: usize) -> *const N
[src]
unsafe fn get_address_unchecked_linear(&self, i: usize) -> *const N
Gets the address of the i-th matrix component without performing bound-checking.
unsafe fn get_address_unchecked(&self, irow: usize, icol: usize) -> *const N
[src]
unsafe fn get_address_unchecked(&self, irow: usize, icol: usize) -> *const N
Gets the address of the i-th matrix component without performing bound-checking.
ⓘImportant traits for &'a mut Runsafe fn get_unchecked_linear(&self, i: usize) -> &N
[src]
unsafe fn get_unchecked_linear(&self, i: usize) -> &N
Retrieves a reference to the i-th element without bound-checking.
ⓘImportant traits for &'a mut Runsafe fn get_unchecked(&self, irow: usize, icol: usize) -> &N
[src]
unsafe fn get_unchecked(&self, irow: usize, icol: usize) -> &N
Retrieves a reference to the i-th element without bound-checking.
impl<N: Scalar, R: DimName> Storage<N, R, Dynamic> for MatrixVec<N, R, Dynamic> where
DefaultAllocator: Allocator<N, R, Dynamic, Buffer = Self>,
[src]
impl<N: Scalar, R: DimName> Storage<N, R, Dynamic> for MatrixVec<N, R, Dynamic> where
DefaultAllocator: Allocator<N, R, Dynamic, Buffer = Self>,
type RStride = U1
The static stride of this storage's rows.
type CStride = R
The static stride of this storage's columns.
fn ptr(&self) -> *const N
[src]
fn ptr(&self) -> *const N
The matrix data pointer.
fn shape(&self) -> (R, Dynamic)
[src]
fn shape(&self) -> (R, Dynamic)
The dimension of the matrix at run-time. Arr length of zero indicates the additive identity element of any dimension. Must be equal to Self::dimension()
if it is not None
. Read more
fn strides(&self) -> (Self::RStride, Self::CStride)
[src]
fn strides(&self) -> (Self::RStride, Self::CStride)
The spacing between consecutive row elements and consecutive column elements. Read more
fn is_contiguous(&self) -> bool
[src]
fn is_contiguous(&self) -> bool
Indicates whether this data buffer stores its elements contiguously.
fn into_owned(self) -> Owned<N, R, Dynamic> where
DefaultAllocator: Allocator<N, R, Dynamic>,
[src]
fn into_owned(self) -> Owned<N, R, Dynamic> where
DefaultAllocator: Allocator<N, R, Dynamic>,
Builds a matrix data storage that does not contain any reference.
fn clone_owned(&self) -> Owned<N, R, Dynamic> where
DefaultAllocator: Allocator<N, R, Dynamic>,
[src]
fn clone_owned(&self) -> Owned<N, R, Dynamic> where
DefaultAllocator: Allocator<N, R, Dynamic>,
Clones this data storage to one that does not contain any reference.
fn as_slice(&self) -> &[N]
[src]
fn as_slice(&self) -> &[N]
Retrieves the data buffer as a contiguous slice. Read more
fn linear_index(&self, irow: usize, icol: usize) -> usize
[src]
fn linear_index(&self, irow: usize, icol: usize) -> usize
Compute the index corresponding to the irow-th row and icol-th column of this matrix. The index must be such that the following holds: Read more
unsafe fn get_address_unchecked_linear(&self, i: usize) -> *const N
[src]
unsafe fn get_address_unchecked_linear(&self, i: usize) -> *const N
Gets the address of the i-th matrix component without performing bound-checking.
unsafe fn get_address_unchecked(&self, irow: usize, icol: usize) -> *const N
[src]
unsafe fn get_address_unchecked(&self, irow: usize, icol: usize) -> *const N
Gets the address of the i-th matrix component without performing bound-checking.
ⓘImportant traits for &'a mut Runsafe fn get_unchecked_linear(&self, i: usize) -> &N
[src]
unsafe fn get_unchecked_linear(&self, i: usize) -> &N
Retrieves a reference to the i-th element without bound-checking.
ⓘImportant traits for &'a mut Runsafe fn get_unchecked(&self, irow: usize, icol: usize) -> &N
[src]
unsafe fn get_unchecked(&self, irow: usize, icol: usize) -> &N
Retrieves a reference to the i-th element without bound-checking.
impl<N: Scalar, C: Dim> StorageMut<N, Dynamic, C> for MatrixVec<N, Dynamic, C> where
DefaultAllocator: Allocator<N, Dynamic, C, Buffer = Self>,
[src]
impl<N: Scalar, C: Dim> StorageMut<N, Dynamic, C> for MatrixVec<N, Dynamic, C> where
DefaultAllocator: Allocator<N, Dynamic, C, Buffer = Self>,
fn ptr_mut(&mut self) -> *mut N
[src]
fn ptr_mut(&mut self) -> *mut N
The matrix mutable data pointer.
fn as_mut_slice(&mut self) -> &mut [N]
[src]
fn as_mut_slice(&mut self) -> &mut [N]
Retrieves the mutable data buffer as a contiguous slice. Read more
unsafe fn get_address_unchecked_linear_mut(&mut self, i: usize) -> *mut N
[src]
unsafe fn get_address_unchecked_linear_mut(&mut self, i: usize) -> *mut N
Gets the mutable address of the i-th matrix component without performing bound-checking.
unsafe fn get_address_unchecked_mut(
&mut self,
irow: usize,
icol: usize
) -> *mut N
[src]
unsafe fn get_address_unchecked_mut(
&mut self,
irow: usize,
icol: usize
) -> *mut N
Gets the mutable address of the i-th matrix component without performing bound-checking.
ⓘImportant traits for &'a mut Runsafe fn get_unchecked_linear_mut(&mut self, i: usize) -> &mut N
[src]
unsafe fn get_unchecked_linear_mut(&mut self, i: usize) -> &mut N
Retrieves a mutable reference to the i-th element without bound-checking.
ⓘImportant traits for &'a mut Runsafe fn get_unchecked_mut(&mut self, irow: usize, icol: usize) -> &mut N
[src]
unsafe fn get_unchecked_mut(&mut self, irow: usize, icol: usize) -> &mut N
Retrieves a mutable reference to the element at (irow, icol)
without bound-checking.
unsafe fn swap_unchecked_linear(&mut self, i1: usize, i2: usize)
[src]
unsafe fn swap_unchecked_linear(&mut self, i1: usize, i2: usize)
Swaps two elements using their linear index without bound-checking.
unsafe fn swap_unchecked(
&mut self,
row_col1: (usize, usize),
row_col2: (usize, usize)
)
[src]
unsafe fn swap_unchecked(
&mut self,
row_col1: (usize, usize),
row_col2: (usize, usize)
)
Swaps two elements without bound-checking.
impl<N: Scalar, C: Dim> ContiguousStorage<N, Dynamic, C> for MatrixVec<N, Dynamic, C> where
DefaultAllocator: Allocator<N, Dynamic, C, Buffer = Self>,
[src]
impl<N: Scalar, C: Dim> ContiguousStorage<N, Dynamic, C> for MatrixVec<N, Dynamic, C> where
DefaultAllocator: Allocator<N, Dynamic, C, Buffer = Self>,
impl<N: Scalar, C: Dim> ContiguousStorageMut<N, Dynamic, C> for MatrixVec<N, Dynamic, C> where
DefaultAllocator: Allocator<N, Dynamic, C, Buffer = Self>,
[src]
impl<N: Scalar, C: Dim> ContiguousStorageMut<N, Dynamic, C> for MatrixVec<N, Dynamic, C> where
DefaultAllocator: Allocator<N, Dynamic, C, Buffer = Self>,
impl<N: Scalar, R: DimName> StorageMut<N, R, Dynamic> for MatrixVec<N, R, Dynamic> where
DefaultAllocator: Allocator<N, R, Dynamic, Buffer = Self>,
[src]
impl<N: Scalar, R: DimName> StorageMut<N, R, Dynamic> for MatrixVec<N, R, Dynamic> where
DefaultAllocator: Allocator<N, R, Dynamic, Buffer = Self>,
fn ptr_mut(&mut self) -> *mut N
[src]
fn ptr_mut(&mut self) -> *mut N
The matrix mutable data pointer.
fn as_mut_slice(&mut self) -> &mut [N]
[src]
fn as_mut_slice(&mut self) -> &mut [N]
Retrieves the mutable data buffer as a contiguous slice. Read more
unsafe fn get_address_unchecked_linear_mut(&mut self, i: usize) -> *mut N
[src]
unsafe fn get_address_unchecked_linear_mut(&mut self, i: usize) -> *mut N
Gets the mutable address of the i-th matrix component without performing bound-checking.
unsafe fn get_address_unchecked_mut(
&mut self,
irow: usize,
icol: usize
) -> *mut N
[src]
unsafe fn get_address_unchecked_mut(
&mut self,
irow: usize,
icol: usize
) -> *mut N
Gets the mutable address of the i-th matrix component without performing bound-checking.
ⓘImportant traits for &'a mut Runsafe fn get_unchecked_linear_mut(&mut self, i: usize) -> &mut N
[src]
unsafe fn get_unchecked_linear_mut(&mut self, i: usize) -> &mut N
Retrieves a mutable reference to the i-th element without bound-checking.
ⓘImportant traits for &'a mut Runsafe fn get_unchecked_mut(&mut self, irow: usize, icol: usize) -> &mut N
[src]
unsafe fn get_unchecked_mut(&mut self, irow: usize, icol: usize) -> &mut N
Retrieves a mutable reference to the element at (irow, icol)
without bound-checking.
unsafe fn swap_unchecked_linear(&mut self, i1: usize, i2: usize)
[src]
unsafe fn swap_unchecked_linear(&mut self, i1: usize, i2: usize)
Swaps two elements using their linear index without bound-checking.
unsafe fn swap_unchecked(
&mut self,
row_col1: (usize, usize),
row_col2: (usize, usize)
)
[src]
unsafe fn swap_unchecked(
&mut self,
row_col1: (usize, usize),
row_col2: (usize, usize)
)
Swaps two elements without bound-checking.
impl<N: Scalar, R: DimName> ContiguousStorage<N, R, Dynamic> for MatrixVec<N, R, Dynamic> where
DefaultAllocator: Allocator<N, R, Dynamic, Buffer = Self>,
[src]
impl<N: Scalar, R: DimName> ContiguousStorage<N, R, Dynamic> for MatrixVec<N, R, Dynamic> where
DefaultAllocator: Allocator<N, R, Dynamic, Buffer = Self>,
impl<N: Scalar, R: DimName> ContiguousStorageMut<N, R, Dynamic> for MatrixVec<N, R, Dynamic> where
DefaultAllocator: Allocator<N, R, Dynamic, Buffer = Self>,
[src]
impl<N: Scalar, R: DimName> ContiguousStorageMut<N, R, Dynamic> for MatrixVec<N, R, Dynamic> where
DefaultAllocator: Allocator<N, R, Dynamic, Buffer = Self>,