StridedViewMut

Struct StridedViewMut 

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

Dynamic-rank mutable strided view.

Always uses Identity element operation for write simplicity. Julia typically applies ops on the read side.

Implementations§

§

impl<'a, T> StridedViewMut<'a, T>

pub fn new( data: &'a mut [T], dims: &[usize], strides: &[isize], offset: isize, ) -> Result<StridedViewMut<'a, T>, StridedError>

Create a new mutable strided view.

pub unsafe fn new_unchecked( data: &'a mut [T], dims: &[usize], strides: &[isize], offset: isize, ) -> StridedViewMut<'a, T>

Create without bounds checking.

§Safety

Caller must ensure all index combinations stay within bounds.

pub fn dims(&self) -> &[usize]

Returns the shape (dimension sizes) of this view.

pub fn strides(&self) -> &[isize]

Returns the strides (in units of T) for each dimension.

pub fn offset(&self) -> isize

Returns the byte offset into the backing data.

pub fn ndim(&self) -> usize

Returns the number of dimensions (rank).

pub fn len(&self) -> usize

Returns the total number of elements.

pub fn is_empty(&self) -> bool

Returns true if any dimension is zero.

pub fn ptr(&self) -> *const T

Raw const pointer to element at the view’s base offset.

pub fn as_mut_ptr(&self) -> *mut T

Raw mutable pointer to element at the view’s base offset.

pub fn permute( self, perm: &[usize], ) -> Result<StridedViewMut<'a, T>, StridedError>

Permute dimensions, consuming the mutable view.

Returns a new mutable view with reordered dimensions and strides. Takes self by value to prevent aliasing of mutable views.

pub fn as_view(&self) -> StridedView<'_, T>

Reborrow as an immutable view.

§

impl<'a, T> StridedViewMut<'a, T>
where T: Copy,

pub fn get(&self, indices: &[usize]) -> T

Get an element.

pub fn set(&mut self, indices: &[usize], value: T)

Set an element.

Trait Implementations§

§

impl<T> Debug for StridedViewMut<'_, T>
where T: Debug,

§

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

Formats the value using the given formatter. Read more
§

impl<T> Send for StridedViewMut<'_, T>
where T: Send,

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

impl<'a, T> !UnwindSafe for StridedViewMut<'a, T>

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> 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<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.
Source§

impl<T> MaybeSend for T

Source§

impl<T> MaybeSendSync for T

Source§

impl<T> MaybeSync for T