[−][src]Struct simd_aligned::MatrixD
A dynamic (heap allocated) matrix with one axis aligned for fast and safe SIMD access that also provides a flat view on its data.
You can use MatrixD
when you need to deal with multiple SIMD vectors, but
want them arranged in a compact cache-friendly manner. Internally this struct is backed by a
continuous vector of aligned vectors, and dynamically sliced according to row / column access.
Example
use packed_simd::*; use simd_aligned::*; // Create a matrix of height 10x`f32` and width 5x`f32`, optimized for row access. let mut m = MatrixD::<f32s, Rows>::with_dimension(10, 5); // A `RowOptimized` matrix provides `row` access. In this example, you could query // rows `0` to `9` and receive vectors that can hold a total of at least `5` elements. let _ = m.row(4); // But accessing columns doesn't work, as there is no continuous view in memory. // m.column(3); --> panic! // However, you can always get a flat view of the matrix, for "scalar-speed" // query and update all elements: let mut m_flat = m.flat_mut(); m_flat[(2, 4)] = 42_f32;
Methods
impl<T, O> MatrixD<T, O> where
T: Simd + Default + Clone,
O: AccessStrategy,
[src]
T: Simd + Default + Clone,
O: AccessStrategy,
pub fn with_dimension(width: usize, height: usize) -> Self
[src]
Creates a new MatrixD
with the given dimension.
pub fn dimension(&self) -> (usize, usize)
[src]
Returns the size as (rows
, columns
).
pub fn flat(&self) -> MatrixFlat<T, O>
[src]
Provides a flat, immutable view of the contained data.
pub fn flat_mut(&mut self) -> MatrixFlatMut<T, O>
[src]
Provides a flat mutable view of the contained data.
impl<T> MatrixD<T, Rows> where
T: Simd + Default + Clone,
[src]
T: Simd + Default + Clone,
pub fn row(&self, i: usize) -> &[T]
[src]
pub fn row_iter(&self) -> Matrix2DIter<T, Rows>
[src]
pub fn row_mut(&mut self, i: usize) -> &mut [T]
[src]
pub fn row_as_flat(&self, i: usize) -> &[T::Element]
[src]
pub fn row_as_flat_mut(&mut self, i: usize) -> &mut [T::Element]
[src]
impl<T> MatrixD<T, Columns> where
T: Simd + Default + Clone,
[src]
T: Simd + Default + Clone,
pub fn column(&self, i: usize) -> &[T]
[src]
pub fn column_iter(&self) -> Matrix2DIter<T, Columns>
[src]
pub fn column_mut(&mut self, i: usize) -> &mut [T]
[src]
pub fn column_as_flat(&self, i: usize) -> &[T::Element]
[src]
pub fn column_as_flat_mut(&mut self, i: usize) -> &mut [T::Element]
[src]
Trait Implementations
impl<T: Clone, A: Clone> Clone for MatrixD<T, A> where
T: Simd + Default + Clone,
A: AccessStrategy,
[src]
T: Simd + Default + Clone,
A: AccessStrategy,
fn clone(&self) -> MatrixD<T, A>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Debug, A: Debug> Debug for MatrixD<T, A> where
T: Simd + Default + Clone,
A: AccessStrategy,
[src]
T: Simd + Default + Clone,
A: AccessStrategy,
Auto Trait Implementations
impl<T, A> Send for MatrixD<T, A> where
A: Send,
T: Send,
A: Send,
T: Send,
impl<T, A> Sync for MatrixD<T, A> where
A: Sync,
T: Sync,
A: Sync,
T: Sync,
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> FromCast<T> for T
[src]
impl<T, U> Cast<U> for T where
U: FromCast<T>,
[src]
U: FromCast<T>,