pub struct HostArray { /* private fields */ }Expand description
a read-only array that is allocated in rust and can be safely accessed in the host language (e.g. Python) without copying
Implementations§
Source§impl HostArray
impl HostArray
pub fn new( ptr: *mut u8, shape: Vec<usize>, strides: Vec<usize>, dtype: ScalarType, ) -> Self
pub fn new_vector(ptr: *mut u8, len: usize, dtype: ScalarType) -> Self
pub fn alloc_vector(len: usize, dtype: ScalarType) -> Self
pub fn new_col_major( ptr: *mut u8, rows: usize, cols: usize, row_stride_elems: isize, col_stride_elems: isize, dtype: ScalarType, ) -> Self
pub fn as_array<'h, T: Scalar>( &self, ) -> Result<ArrayView2<'h, T>, DiffsolRtError>
pub fn as_slice<T: Scalar>(&self) -> Result<&[T], DiffsolRtError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HostArray
impl !RefUnwindSafe for HostArray
impl !Send for HostArray
impl !Sync for HostArray
impl Unpin for HostArray
impl UnsafeUnpin for HostArray
impl !UnwindSafe for HostArray
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.