pub trait Array1<T: Debug + Display + Copy + Sized>:
MutArrayView1<T>
+ Sized
+ Clone {
Show 26 methods
// Required methods
fn slice<'a>(&'a self, range: Range<usize>) -> Box<dyn ArrayView1<T> + 'a>;
fn slice_mut<'a>(
&'a mut self,
range: Range<usize>,
) -> Box<dyn MutArrayView1<T> + 'a>;
fn fill(len: usize, value: T) -> Self
where Self: Sized;
fn from_iterator<I: Iterator<Item = T>>(iter: I, len: usize) -> Self
where Self: Sized;
fn from_vec_slice(slice: &[T]) -> Self
where Self: Sized;
fn from_slice(slice: &dyn ArrayView1<T>) -> Self
where Self: Sized;
// Provided methods
fn zeros(len: usize) -> Self
where T: Number,
Self: Sized { ... }
fn ones(len: usize) -> Self
where T: Number,
Self: Sized { ... }
fn rand(len: usize) -> Self
where T: RealNumber,
Self: Sized { ... }
fn add_scalar(&self, x: T) -> Self
where T: Number,
Self: Sized { ... }
fn sub_scalar(&self, x: T) -> Self
where T: Number,
Self: Sized { ... }
fn div_scalar(&self, x: T) -> Self
where T: Number,
Self: Sized { ... }
fn mul_scalar(&self, x: T) -> Self
where T: Number,
Self: Sized { ... }
fn add(&self, other: &dyn Array<T, usize>) -> Self
where T: Number,
Self: Sized { ... }
fn sub(&self, other: &impl Array1<T>) -> Self
where T: Number,
Self: Sized { ... }
fn mul(&self, other: &dyn Array<T, usize>) -> Self
where T: Number,
Self: Sized { ... }
fn div(&self, other: &dyn Array<T, usize>) -> Self
where T: Number,
Self: Sized { ... }
fn take(&self, index: &[usize]) -> Self
where Self: Sized { ... }
fn abs(&self) -> Self
where T: Number + Signed,
Self: Sized { ... }
fn neg(&self) -> Self
where T: Number + Neg<Output = T>,
Self: Sized { ... }
fn pow(&self, p: T) -> Self
where T: RealNumber,
Self: Sized { ... }
fn argsort(&self) -> Vec<usize>
where T: Number + PartialOrd { ... }
fn map<O: Debug + Display + Copy + Sized, A: Array1<O>, F: FnMut(&T) -> O>(
self,
f: F,
) -> A { ... }
fn softmax(&self) -> Self
where T: RealNumber,
Self: Sized { ... }
fn xa(&self, a_transpose: bool, a: &dyn ArrayView2<T>) -> Self
where T: Number,
Self: Sized { ... }
fn approximate_eq(&self, other: &Self, error: T) -> bool
where T: Number + RealNumber,
Self: Sized { ... }
}Expand description
Trait for mutable 1D-array view
Required Methods§
Sourcefn slice<'a>(&'a self, range: Range<usize>) -> Box<dyn ArrayView1<T> + 'a>
fn slice<'a>(&'a self, range: Range<usize>) -> Box<dyn ArrayView1<T> + 'a>
return a view of the array
Sourcefn slice_mut<'a>(
&'a mut self,
range: Range<usize>,
) -> Box<dyn MutArrayView1<T> + 'a>
fn slice_mut<'a>( &'a mut self, range: Range<usize>, ) -> Box<dyn MutArrayView1<T> + 'a>
return a mutable view of the array
Sourcefn from_iterator<I: Iterator<Item = T>>(iter: I, len: usize) -> Selfwhere
Self: Sized,
fn from_iterator<I: Iterator<Item = T>>(iter: I, len: usize) -> Selfwhere
Self: Sized,
create array from iterator
Sourcefn from_vec_slice(slice: &[T]) -> Selfwhere
Self: Sized,
fn from_vec_slice(slice: &[T]) -> Selfwhere
Self: Sized,
create array from vector
Sourcefn from_slice(slice: &dyn ArrayView1<T>) -> Selfwhere
Self: Sized,
fn from_slice(slice: &dyn ArrayView1<T>) -> Selfwhere
Self: Sized,
create array from slice
Provided Methods§
Sourcefn rand(len: usize) -> Selfwhere
T: RealNumber,
Self: Sized,
fn rand(len: usize) -> Selfwhere
T: RealNumber,
Self: Sized,
create an array of random values
Sourcefn add_scalar(&self, x: T) -> Self
fn add_scalar(&self, x: T) -> Self
add a scalar to the array
Sourcefn sub_scalar(&self, x: T) -> Self
fn sub_scalar(&self, x: T) -> Self
subtract a scalar from the array
Sourcefn div_scalar(&self, x: T) -> Self
fn div_scalar(&self, x: T) -> Self
divide a scalar from the array
Sourcefn mul_scalar(&self, x: T) -> Self
fn mul_scalar(&self, x: T) -> Self
multiply a scalar to the array
Sourcefn pow(&self, p: T) -> Selfwhere
T: RealNumber,
Self: Sized,
fn pow(&self, p: T) -> Selfwhere
T: RealNumber,
Self: Sized,
create a view of the array with values at power p
Sourcefn map<O: Debug + Display + Copy + Sized, A: Array1<O>, F: FnMut(&T) -> O>(
self,
f: F,
) -> A
fn map<O: Debug + Display + Copy + Sized, A: Array1<O>, F: FnMut(&T) -> O>( self, f: F, ) -> A
map values of the array
Sourcefn softmax(&self) -> Selfwhere
T: RealNumber,
Self: Sized,
fn softmax(&self) -> Selfwhere
T: RealNumber,
Self: Sized,
apply softmax to the array
Sourcefn xa(&self, a_transpose: bool, a: &dyn ArrayView2<T>) -> Self
fn xa(&self, a_transpose: bool, a: &dyn ArrayView2<T>) -> Self
multiply array by matrix
Sourcefn approximate_eq(&self, other: &Self, error: T) -> bool
fn approximate_eq(&self, other: &Self, error: T) -> bool
check if two arrays are approximately equal
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".