pub struct NdArray<'a, T: RawDataType> { /* private fields */ }Implementations§
Source§impl<'a, T: RawDataType> NdArray<'a, T>
impl<'a, T: RawDataType> NdArray<'a, T>
Sourcepub fn value(&self) -> T
pub fn value(&self) -> T
Retrieves the single value contained within an ndarray with a singular element.
§Panics
If the ndarray contains more than one element (i.e., it is not a scalar or an ndarray with a single element)
§Example
let ndarray = NdArray::scalar(50f32);
let value = ndarray.value();
assert_eq!(value, 50.0);§Notes
This function is only meant for arrays that are guaranteed to have exactly one element. For arrays with multiple elements, consider using appropriate methods to access individual elements or slices safely.
Sourcepub fn data_slice(&self) -> &'a [T]
pub fn data_slice(&self) -> &'a [T]
Returns a slice of the ndarray’s (flattened) data buffer
§Example
let ndarray = NdArray::new([[50, 60], [-5, -10]]);
let data = ndarray.data_slice();
assert_eq!(data, &[50, 60, -5, -10]);Sourcepub fn into_data_vector(self) -> Vec<T>
pub fn into_data_vector(self) -> Vec<T>
Source§impl<T: RawDataType> NdArray<'_, T>
impl<T: RawDataType> NdArray<'_, T>
pub fn flatiter(&self) -> FlatIterator<T>
pub fn flatiter_ptr(&self) -> BufferIterator<T> ⓘ
Source§impl<'a, T: RawDataType> NdArray<'a, T>
impl<'a, T: RawDataType> NdArray<'a, T>
pub fn iter(&'a self) -> NdIterator<'a, T> ⓘ
pub fn iter_along(&'a self, axis: impl AxisType) -> NdIterator<'a, T> ⓘ
pub fn nditer(&'a self, axes: impl AxesType) -> NdIterator<'a, T> ⓘ
Source§impl<'a, T: RawDataType> NdArray<'a, T>
impl<'a, T: RawDataType> NdArray<'a, T>
Sourcepub fn flatten(&self) -> NdArray<'static, T>
pub fn flatten(&self) -> NdArray<'static, T>
Returns a 1D copy of a flattened multidimensional ndarray.
If copying the data is not desirable, it may be possible to return a view.
See NdArray::ravel().
§Examples
let ndarray = NdArray::new([[1, 2, 3], [4, 5, 6]]);
let flat_array = ndarray.flatten();
assert_eq!(flat_array, NdArray::new([1, 2, 3, 4, 5, 6]));Source§impl<T: NumericDataType> NdArray<'_, T>
impl<T: NumericDataType> NdArray<'_, T>
Sourcepub fn sum(&self) -> NdArray<'static, T>
pub fn sum(&self) -> NdArray<'static, T>
Computes the sum of all elements in the array.
§Example
use redstone_ml::*;
let array = NdArray::new(vec![1, 2, 3, 4]);
let sum = array.sum();
assert_eq!(sum.value(), 1 + 2 + 3 + 4);pub fn sum_along(&self, axes: impl ToVec<isize>) -> NdArray<'static, T>
Sourcepub fn product(&self) -> NdArray<'static, T>
pub fn product(&self) -> NdArray<'static, T>
Computes the product of all elements in the array.
§Example
use redstone_ml::*;
let array = NdArray::new(vec![1, 2, 3, 4]);
let prod = array.product();
assert_eq!(prod.value(), 1 * 2 * 3 * 4);pub fn product_along(&self, axes: impl ToVec<isize>) -> NdArray<'static, T>
Sourcepub fn min(&self) -> NdArray<'static, T>
pub fn min(&self) -> NdArray<'static, T>
Computes the minimum of all elements in the array.
§Example
use redstone_ml::*;
let array = NdArray::new(vec![-1, 3, -7, 8]);
let min = array.min();
assert_eq!(min.value(), -7);pub fn min_along(&self, axes: impl ToVec<isize>) -> NdArray<'static, T>
Sourcepub fn max(&self) -> NdArray<'static, T>
pub fn max(&self) -> NdArray<'static, T>
Computes the maximum of all elements in the array.
§Example
use redstone_ml::*;
let array = NdArray::new(vec![-1, 3, -7, 8]);
let max = array.max();
assert_eq!(max.value(), 8);pub fn max_along(&self, axes: impl ToVec<isize>) -> NdArray<'static, T>
Sourcepub fn min_magnitude(&self) -> NdArray<'static, T>
pub fn min_magnitude(&self) -> NdArray<'static, T>
Computes the minimum absolute value of all elements in the array.
§Example
use redstone_ml::*;
let array = NdArray::new(vec![-1, 3, -7, 8]);
let min = array.min_magnitude();
assert_eq!(min.value(), 1);pub fn min_magnitude_along( &self, axes: impl ToVec<isize>, ) -> NdArray<'static, T>
Sourcepub fn max_magnitude(&self) -> NdArray<'static, T>
pub fn max_magnitude(&self) -> NdArray<'static, T>
Computes the maximum absolute value of all elements in the array.
§Example
use redstone_ml::*;
let array = NdArray::new(vec![-1, 3, -9, 8]);
let max = array.max_magnitude();
assert_eq!(max.value(), 9);pub fn max_magnitude_along( &self, axes: impl ToVec<isize>, ) -> NdArray<'static, T>
Sourcepub fn mean(&self) -> NdArray<'static, T>where
T: FloatDataType,
pub fn mean(&self) -> NdArray<'static, T>where
T: FloatDataType,
Computes the mean of all elements in the array.
§Example
use redstone_ml::*;
let array = NdArray::new(vec![1.0, 3.0, 5.0, 7.0]);
let mean = array.mean();
assert_eq!(mean.value(), 4.0);pub fn mean_along(&self, axes: impl ToVec<isize>) -> NdArray<'static, T>where
T: FloatDataType,
Source§impl<'a, T: RawDataType> NdArray<'a, T>
impl<'a, T: RawDataType> NdArray<'a, T>
pub fn slice_along<S: Indexer>(&'a self, axis: Axis, index: S) -> NdArray<'a, T>
pub fn slice<S, I>(&'a self, index: I) -> NdArray<'a, T>where
S: Indexer,
I: IntoIterator<Item = S>,
Source§impl<T: RawDataType> NdArray<'_, T>
impl<T: RawDataType> NdArray<'_, T>
Source§impl<'a, T: RawDataType> NdArray<'a, T>
impl<'a, T: RawDataType> NdArray<'a, T>
Sourcepub fn broadcast_to(&'a self, shape: &[usize]) -> NdArray<'a, T>
pub fn broadcast_to(&'a self, shape: &[usize]) -> NdArray<'a, T>
Broadcasts the NdArray to the specified shape.
This method returns a readonly view of the ndarray with the desired shape. Broadcasting is done by left-padding the ndarray’s shape with ones until they reach the desired dimension. Then, any axes with length 1 are repeated to match the target shape.
For example, suppose the ndarray’s shape is [2, 3] and the broadcast shape is [3, 2, 3].
Then the ndarray’s shape becomes [1, 2, 3] after padding and [3, 2, 3] after repeating
the first axis.
§Panics
This method panics if the target shape is incompatible with the ndarray.
- If
shape.len()is less than the dimensionality of the ndarray. - If a dimension in
shapedoes not equal the corresponding dimension in the ndarray’sshapeand cannot be broadcasted (i.e., it is not 1 or does not match).
§Example
let ndarray = NdArray::new([1, 2, 3]); // shape is [3]
let broadcasted_array = ndarray.broadcast_to(&[2, 3]);
assert_eq!(broadcasted_array.shape(), &[2, 3]);Source§impl<T: NumericDataType> NdArray<'_, T>
impl<T: NumericDataType> NdArray<'_, T>
pub fn astype<'b, F: NumericDataType>(&self) -> NdArray<'b, F>
Source§impl<'a, T: MatrixOps> NdArray<'a, T>
impl<'a, T: MatrixOps> NdArray<'a, T>
Sourcepub fn matmul<'r>(&self, other: impl AsRef<NdArray<'a, T>>) -> NdArray<'r, T>
pub fn matmul<'r>(&self, other: impl AsRef<NdArray<'a, T>>) -> NdArray<'r, T>
Calculates the matrix product of two ndarrays.
- If both ndarrays are 1D, then their dot product is returned.
- If both ndarrays are 2D, then their matrix product is returned.
- If the first ndarray is 2D and the second ndarray is 1D, then the matrix-vector product is returned.
§Panics
- If the dimensions/shape of the ndarrays are incompatible
§Example
let a = NdArray::new(vec![
[1, 2, 3],
[4, 5, 6],
]);
let b = NdArray::new(vec![
[7, 8],
[9, 10],
[11, 12],
]);
let result = a.matmul(&b);
assert_eq!(result, NdArray::new(vec![
[58, 64],
[139, 154],
]));Sourcepub fn bmm<'r>(&self, other: impl AsRef<NdArray<'a, T>>) -> NdArray<'r, T>
pub fn bmm<'r>(&self, other: impl AsRef<NdArray<'a, T>>) -> NdArray<'r, T>
Performs batch matrix multiplication on 3D ndarrays.
The shape of the resulting array will be [batch_size, self.shape()[1], other.shape()[2]],
where batch_size is the shared first dimension of both input arrays.
§Panics
- If either array is not 3D
- If the arrays do not have dimensions compatible for batch matrix multiplication.
§Example
let arr1 = NdArray::<f32>::rand([3, 2, 4]); // 3 batches of 2x4 matrices
let arr2 = NdArray::<f32>::rand([3, 4, 5]); // 3 batches of 4x5 matrices
let result = arr1.bmm(&arr2);
assert_eq!(result.shape(), [3, 2, 5]); // result is 3 batches of 2x5 matricesSource§impl<'a, T: SumOfProductsType> NdArray<'a, T>
impl<'a, T: SumOfProductsType> NdArray<'a, T>
Sourcepub fn dot<'b, 'r>(&self, other: impl AsRef<NdArray<'b, T>>) -> NdArray<'r, T>
pub fn dot<'b, 'r>(&self, other: impl AsRef<NdArray<'b, T>>) -> NdArray<'r, T>
Calculates the dot product of two 1D arrays.
§Panics
- Panics if either array is not 1D
- Panics if the lengths of the two arrays are not equal
§Examples
let arr1 = NdArray::new([1, 2, 3]);
let arr2 = NdArray::new([4, 5, 6]);
let result = arr1.dot(arr2);
assert_eq!(result.value(), 32); // 1*4 + 2*5 + 3*6 = 32Source§impl<'a, T: NumericDataType> NdArray<'a, T>
impl<'a, T: NumericDataType> NdArray<'a, T>
Sourcepub fn offset_trace<'r>(&self, offset: isize) -> NdArray<'r, T>
pub fn offset_trace<'r>(&self, offset: isize) -> NdArray<'r, T>
Sourcepub fn trace_along<'r>(
&self,
axis1: impl AxisType,
axis2: impl AxisType,
) -> NdArray<'r, T>
pub fn trace_along<'r>( &self, axis1: impl AxisType, axis2: impl AxisType, ) -> NdArray<'r, T>
Returns the trace of an ndarray along the specified axes.
§Panics
- if the ndarray has fewer than 2 dimensions.
- if
axis1andaxis2are the same or are out-of-bounds
§Examples
let ndarray = NdArray::new([
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]);
assert_eq!(ndarray.trace_along(0, 1), NdArray::scalar(1 + 5 + 9));Sourcepub fn offset_trace_along<'r>(
&self,
offset: isize,
axis1: impl AxisType,
axis2: impl AxisType,
) -> NdArray<'r, T>
pub fn offset_trace_along<'r>( &self, offset: isize, axis1: impl AxisType, axis2: impl AxisType, ) -> NdArray<'r, T>
Returns the sum of an offset ndarray diagonal along the specified axes.
§Panics
- if the ndarray has fewer than 2 dimensions.
- if
axis1andaxis2are the same or are out-of-bounds
§Examples
let ndarray = NdArray::new([
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]);
assert_eq!(ndarray.offset_trace_along(1, 0, 1), NdArray::scalar(2 + 6));Source§impl<'a, T: RawDataType> NdArray<'a, T>
impl<'a, T: RawDataType> NdArray<'a, T>
Sourcepub fn offset_diagonal(&'a self, offset: isize) -> NdArray<'a, T>
pub fn offset_diagonal(&'a self, offset: isize) -> NdArray<'a, T>
Sourcepub fn diagonal_along(
&'a self,
axis1: impl AxisType,
axis2: impl AxisType,
) -> NdArray<'a, T>
pub fn diagonal_along( &'a self, axis1: impl AxisType, axis2: impl AxisType, ) -> NdArray<'a, T>
Returns a diagonal view of the ndarray along the specified axes.
§Panics
- if the ndarray has fewer than 2 dimensions.
- if
axis1andaxis2are the same or are out-of-bounds
§Examples
let ndarray = NdArray::new([
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]);
let diagonal = ndarray.diagonal_along(Axis(0), Axis(1)); // or .diagonal_along(0, 1)
assert_eq!(diagonal, NdArray::new([1, 5, 9]));Sourcepub fn offset_diagonal_along(
&'a self,
offset: isize,
axis1: impl AxisType,
axis2: impl AxisType,
) -> NdArray<'a, T>
pub fn offset_diagonal_along( &'a self, offset: isize, axis1: impl AxisType, axis2: impl AxisType, ) -> NdArray<'a, T>
Returns an offset diagonal view of the ndarray along the specified axes.
§Panics
- if the ndarray has fewer than 2 dimensions.
- if
axis1andaxis2are the same or are out-of-bounds
§Examples
let arr = NdArray::new([
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
]);
let diagonal = arr.offset_diagonal_along(-1, Axis(0), Axis(1)); // or .offset_diagonal_along(-1, 0, 1)
assert_eq!(diagonal, NdArray::new([4, 8]));Trait Implementations§
Source§impl<T: RawDataType + BinaryOpAdd> Add<T> for &NdArray<'_, T>
impl<T: RawDataType + BinaryOpAdd> Add<T> for &NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpAdd> Add<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpAdd> Add<T> for NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpAdd> AddAssign<&NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpAdd> AddAssign<&NdArray<'_, T>> for NdArray<'_, T>
Source§fn add_assign(&mut self, rhs: &NdArray<'_, T>)
fn add_assign(&mut self, rhs: &NdArray<'_, T>)
+= operation. Read moreSource§impl<T: RawDataType + BinaryOpAdd> AddAssign<NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpAdd> AddAssign<NdArray<'_, T>> for NdArray<'_, T>
Source§fn add_assign(&mut self, rhs: NdArray<'_, T>)
fn add_assign(&mut self, rhs: NdArray<'_, T>)
+= operation. Read moreSource§impl<T: RawDataType + BinaryOpAdd> AddAssign<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpAdd> AddAssign<T> for NdArray<'_, T>
Source§fn add_assign(&mut self, rhs: T)
fn add_assign(&mut self, rhs: T)
+= operation. Read moreSource§impl<T: RawDataType + BinaryOpBitAnd> BitAnd<T> for &NdArray<'_, T>
impl<T: RawDataType + BinaryOpBitAnd> BitAnd<T> for &NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpBitAnd> BitAnd<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpBitAnd> BitAnd<T> for NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpBitAnd> BitAndAssign<&NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpBitAnd> BitAndAssign<&NdArray<'_, T>> for NdArray<'_, T>
Source§fn bitand_assign(&mut self, rhs: &NdArray<'_, T>)
fn bitand_assign(&mut self, rhs: &NdArray<'_, T>)
&= operation. Read moreSource§impl<T: RawDataType + BinaryOpBitAnd> BitAndAssign<NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpBitAnd> BitAndAssign<NdArray<'_, T>> for NdArray<'_, T>
Source§fn bitand_assign(&mut self, rhs: NdArray<'_, T>)
fn bitand_assign(&mut self, rhs: NdArray<'_, T>)
&= operation. Read moreSource§impl<T: RawDataType + BinaryOpBitAnd> BitAndAssign<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpBitAnd> BitAndAssign<T> for NdArray<'_, T>
Source§fn bitand_assign(&mut self, rhs: T)
fn bitand_assign(&mut self, rhs: T)
&= operation. Read moreSource§impl<T: RawDataType + BinaryOpBitOr> BitOr<T> for &NdArray<'_, T>
impl<T: RawDataType + BinaryOpBitOr> BitOr<T> for &NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpBitOr> BitOr<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpBitOr> BitOr<T> for NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpBitOr> BitOrAssign<&NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpBitOr> BitOrAssign<&NdArray<'_, T>> for NdArray<'_, T>
Source§fn bitor_assign(&mut self, rhs: &NdArray<'_, T>)
fn bitor_assign(&mut self, rhs: &NdArray<'_, T>)
|= operation. Read moreSource§impl<T: RawDataType + BinaryOpBitOr> BitOrAssign<NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpBitOr> BitOrAssign<NdArray<'_, T>> for NdArray<'_, T>
Source§fn bitor_assign(&mut self, rhs: NdArray<'_, T>)
fn bitor_assign(&mut self, rhs: NdArray<'_, T>)
|= operation. Read moreSource§impl<T: RawDataType + BinaryOpBitOr> BitOrAssign<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpBitOr> BitOrAssign<T> for NdArray<'_, T>
Source§fn bitor_assign(&mut self, rhs: T)
fn bitor_assign(&mut self, rhs: T)
|= operation. Read moreSource§impl<'a, T: RawDataType> Constructors<T> for NdArray<'a, T>
impl<'a, T: RawDataType> Constructors<T> for NdArray<'a, T>
Source§unsafe fn from_contiguous_owned_buffer(shape: Vec<usize>, data: Vec<T>) -> Self
unsafe fn from_contiguous_owned_buffer(shape: Vec<usize>, data: Vec<T>) -> Self
Source§fn new<const D: usize>(data: impl Flatten<T> + Shape + Nested<D>) -> Self
fn new<const D: usize>(data: impl Flatten<T> + Shape + Nested<D>) -> Self
NdArray from input data such as a vector or array. Read moreSource§fn full(n: T, shape: impl ToVec<usize>) -> Self
fn full(n: T, shape: impl ToVec<usize>) -> Self
Source§fn zeros(shape: impl ToVec<usize>) -> Self
fn zeros(shape: impl ToVec<usize>) -> Self
Source§fn ones(shape: impl ToVec<usize>) -> Self
fn ones(shape: impl ToVec<usize>) -> Self
Source§fn scalar(n: T) -> Self
fn scalar(n: T) -> Self
Source§fn arange(start: T, stop: T) -> Selfwhere
T: NumericDataType,
fn arange(start: T, stop: T) -> Selfwhere
T: NumericDataType,
Source§fn arange_with_step(start: T, stop: T, step: T) -> Selfwhere
T: NumericDataType,
fn arange_with_step(start: T, stop: T, step: T) -> Selfwhere
T: NumericDataType,
Source§fn linspace(start: T, stop: T, num: usize) -> Selfwhere
T: FloatDataType,
fn linspace(start: T, stop: T, num: usize) -> Selfwhere
T: FloatDataType,
num evenly spaced values between start and stop
(inclusive). Read moreSource§fn linspace_exclusive(start: T, stop: T, num: usize) -> Selfwhere
T: FloatDataType,
fn linspace_exclusive(start: T, stop: T, num: usize) -> Selfwhere
T: FloatDataType,
num evenly spaced values between start and stop
(exclusive). Read moreSource§impl<T: RawDataType> Debug for NdArray<'_, T>
impl<T: RawDataType> Debug for NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpDiv> Div<T> for &NdArray<'_, T>
impl<T: RawDataType + BinaryOpDiv> Div<T> for &NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpDiv> Div<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpDiv> Div<T> for NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpDiv> DivAssign<&NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpDiv> DivAssign<&NdArray<'_, T>> for NdArray<'_, T>
Source§fn div_assign(&mut self, rhs: &NdArray<'_, T>)
fn div_assign(&mut self, rhs: &NdArray<'_, T>)
/= operation. Read moreSource§impl<T: RawDataType + BinaryOpDiv> DivAssign<NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpDiv> DivAssign<NdArray<'_, T>> for NdArray<'_, T>
Source§fn div_assign(&mut self, rhs: NdArray<'_, T>)
fn div_assign(&mut self, rhs: NdArray<'_, T>)
/= operation. Read moreSource§impl<T: RawDataType + BinaryOpDiv> DivAssign<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpDiv> DivAssign<T> for NdArray<'_, T>
Source§fn div_assign(&mut self, rhs: T)
fn div_assign(&mut self, rhs: T)
/= operation. Read moreSource§impl<T: RawDataType> Drop for NdArray<'_, T>
impl<T: RawDataType> Drop for NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpMul> Mul<T> for &NdArray<'_, T>
impl<T: RawDataType + BinaryOpMul> Mul<T> for &NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpMul> Mul<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpMul> Mul<T> for NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpMul> MulAssign<&NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpMul> MulAssign<&NdArray<'_, T>> for NdArray<'_, T>
Source§fn mul_assign(&mut self, rhs: &NdArray<'_, T>)
fn mul_assign(&mut self, rhs: &NdArray<'_, T>)
*= operation. Read moreSource§impl<T: RawDataType + BinaryOpMul> MulAssign<NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpMul> MulAssign<NdArray<'_, T>> for NdArray<'_, T>
Source§fn mul_assign(&mut self, rhs: NdArray<'_, T>)
fn mul_assign(&mut self, rhs: NdArray<'_, T>)
*= operation. Read moreSource§impl<T: RawDataType + BinaryOpMul> MulAssign<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpMul> MulAssign<T> for NdArray<'_, T>
Source§fn mul_assign(&mut self, rhs: T)
fn mul_assign(&mut self, rhs: T)
*= operation. Read moreSource§impl<T: RawDataType + UnaryOps> Neg for &NdArray<'_, T>
impl<T: RawDataType + UnaryOps> Neg for &NdArray<'_, T>
Source§impl<T: RawDataType + UnaryOps> Neg for NdArray<'_, T>
impl<T: RawDataType + UnaryOps> Neg for NdArray<'_, T>
Source§impl<'a, T: RawDataType> RandomConstructors<T> for NdArray<'a, T>
impl<'a, T: RawDataType> RandomConstructors<T> for NdArray<'a, T>
Source§fn randn(shape: impl ToVec<usize>) -> Selfwhere
T: FloatDataType,
fn randn(shape: impl ToVec<usize>) -> Selfwhere
T: FloatDataType,
NdArray with the specified shape
from a standard normal distribution (0 mean, unit standard deviation). Read moreSource§fn rand(shape: impl ToVec<usize>) -> Selfwhere
T: FloatDataType,
fn rand(shape: impl ToVec<usize>) -> Selfwhere
T: FloatDataType,
NdArray with the specified shape
with values uniformly distributed in [0, 1). Read moreSource§impl<T: RawDataType + BinaryOpRem> Rem<T> for &NdArray<'_, T>
impl<T: RawDataType + BinaryOpRem> Rem<T> for &NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpRem> Rem<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpRem> Rem<T> for NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpRem> RemAssign<&NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpRem> RemAssign<&NdArray<'_, T>> for NdArray<'_, T>
Source§fn rem_assign(&mut self, rhs: &NdArray<'_, T>)
fn rem_assign(&mut self, rhs: &NdArray<'_, T>)
%= operation. Read moreSource§impl<T: RawDataType + BinaryOpRem> RemAssign<NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpRem> RemAssign<NdArray<'_, T>> for NdArray<'_, T>
Source§fn rem_assign(&mut self, rhs: NdArray<'_, T>)
fn rem_assign(&mut self, rhs: NdArray<'_, T>)
%= operation. Read moreSource§impl<T: RawDataType + BinaryOpRem> RemAssign<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpRem> RemAssign<T> for NdArray<'_, T>
Source§fn rem_assign(&mut self, rhs: T)
fn rem_assign(&mut self, rhs: T)
%= operation. Read moreSource§impl<'a, T: RawDataType> Reshape<T> for &'a NdArray<'a, T>
impl<'a, T: RawDataType> Reshape<T> for &'a NdArray<'a, T>
type Output = NdArray<'a, T>
Source§unsafe fn reshaped_view(
self,
shape: Vec<usize>,
stride: Vec<usize>,
) -> Self::Output
unsafe fn reshaped_view( self, shape: Vec<usize>, stride: Vec<usize>, ) -> Self::Output
Source§fn view(self) -> Self::Output
fn view(self) -> Self::Output
Source§fn reshape(self, new_shape: impl ToVec<usize>) -> Self::Output
fn reshape(self, new_shape: impl ToVec<usize>) -> Self::Output
Source§fn squeeze(self) -> Self::Output
fn squeeze(self) -> Self::Output
Source§impl<T: RawDataType> Reshape<T> for NdArray<'_, T>
impl<T: RawDataType> Reshape<T> for NdArray<'_, T>
type Output = NdArray<'static, T>
Source§unsafe fn reshaped_view(
self,
shape: Vec<usize>,
stride: Vec<usize>,
) -> Self::Output
unsafe fn reshaped_view( self, shape: Vec<usize>, stride: Vec<usize>, ) -> Self::Output
Source§fn view(self) -> Self::Output
fn view(self) -> Self::Output
Source§fn reshape(self, new_shape: impl ToVec<usize>) -> Self::Output
fn reshape(self, new_shape: impl ToVec<usize>) -> Self::Output
Source§fn squeeze(self) -> Self::Output
fn squeeze(self) -> Self::Output
Source§impl<T: RawDataType + BinaryOpShl> Shl<T> for &NdArray<'_, T>
impl<T: RawDataType + BinaryOpShl> Shl<T> for &NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpShl> Shl<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpShl> Shl<T> for NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpShl> ShlAssign<&NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpShl> ShlAssign<&NdArray<'_, T>> for NdArray<'_, T>
Source§fn shl_assign(&mut self, rhs: &NdArray<'_, T>)
fn shl_assign(&mut self, rhs: &NdArray<'_, T>)
<<= operation. Read moreSource§impl<T: RawDataType + BinaryOpShl> ShlAssign<NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpShl> ShlAssign<NdArray<'_, T>> for NdArray<'_, T>
Source§fn shl_assign(&mut self, rhs: NdArray<'_, T>)
fn shl_assign(&mut self, rhs: NdArray<'_, T>)
<<= operation. Read moreSource§impl<T: RawDataType + BinaryOpShl> ShlAssign<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpShl> ShlAssign<T> for NdArray<'_, T>
Source§fn shl_assign(&mut self, rhs: T)
fn shl_assign(&mut self, rhs: T)
<<= operation. Read moreSource§impl<T: RawDataType + BinaryOpShr> Shr<T> for &NdArray<'_, T>
impl<T: RawDataType + BinaryOpShr> Shr<T> for &NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpShr> Shr<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpShr> Shr<T> for NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpShr> ShrAssign<&NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpShr> ShrAssign<&NdArray<'_, T>> for NdArray<'_, T>
Source§fn shr_assign(&mut self, rhs: &NdArray<'_, T>)
fn shr_assign(&mut self, rhs: &NdArray<'_, T>)
>>= operation. Read moreSource§impl<T: RawDataType + BinaryOpShr> ShrAssign<NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpShr> ShrAssign<NdArray<'_, T>> for NdArray<'_, T>
Source§fn shr_assign(&mut self, rhs: NdArray<'_, T>)
fn shr_assign(&mut self, rhs: NdArray<'_, T>)
>>= operation. Read moreSource§impl<T: RawDataType + BinaryOpShr> ShrAssign<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpShr> ShrAssign<T> for NdArray<'_, T>
Source§fn shr_assign(&mut self, rhs: T)
fn shr_assign(&mut self, rhs: T)
>>= operation. Read moreSource§impl<T: RawDataType> StridedMemory for &NdArray<'_, T>
impl<T: RawDataType> StridedMemory for &NdArray<'_, T>
Source§fn flags(&self) -> NdArrayFlags
fn flags(&self) -> NdArrayFlags
Source§fn len(&self) -> usize
fn len(&self) -> usize
Source§fn is_contiguous(&self) -> bool
fn is_contiguous(&self) -> bool
Source§fn is_uniformly_strided(&self) -> bool
fn is_uniformly_strided(&self) -> bool
Source§impl<T: RawDataType> StridedMemory for NdArray<'_, T>
impl<T: RawDataType> StridedMemory for NdArray<'_, T>
Source§fn flags(&self) -> NdArrayFlags
fn flags(&self) -> NdArrayFlags
Source§fn len(&self) -> usize
fn len(&self) -> usize
Source§fn is_contiguous(&self) -> bool
fn is_contiguous(&self) -> bool
Source§fn is_uniformly_strided(&self) -> bool
fn is_uniformly_strided(&self) -> bool
Source§impl<T: RawDataType + BinaryOpSub> Sub<T> for &NdArray<'_, T>
impl<T: RawDataType + BinaryOpSub> Sub<T> for &NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpSub> Sub<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpSub> Sub<T> for NdArray<'_, T>
Source§impl<T: RawDataType + BinaryOpSub> SubAssign<&NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpSub> SubAssign<&NdArray<'_, T>> for NdArray<'_, T>
Source§fn sub_assign(&mut self, rhs: &NdArray<'_, T>)
fn sub_assign(&mut self, rhs: &NdArray<'_, T>)
-= operation. Read moreSource§impl<T: RawDataType + BinaryOpSub> SubAssign<NdArray<'_, T>> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpSub> SubAssign<NdArray<'_, T>> for NdArray<'_, T>
Source§fn sub_assign(&mut self, rhs: NdArray<'_, T>)
fn sub_assign(&mut self, rhs: NdArray<'_, T>)
-= operation. Read moreSource§impl<T: RawDataType + BinaryOpSub> SubAssign<T> for NdArray<'_, T>
impl<T: RawDataType + BinaryOpSub> SubAssign<T> for NdArray<'_, T>
Source§fn sub_assign(&mut self, rhs: T)
fn sub_assign(&mut self, rhs: T)
-= operation. Read more