pub struct Array<A, D> { /* private fields */ }
Expand description
The Array type is an N-dimensional array.
A reference counted array with copy-on-write mutability.
The array can be a container of numerical use, supporting all mathematical operators by applying them elementwise – but it can store any kind of value. It cannot grow or shrink, but can be sliced into views of parts of its data.
The array is both a view and a shared owner of its data. Some methods, for example slice(), merely change the view of the data, while methods like iadd() allow mutating the element values.
Calling a method for mutating elements, for example at_mut(), iadd() or iter_mut() will break sharing and require a clone of the data (if it is not uniquely held).
§Method Conventions
Methods mutating the view or array elements in place use an i prefix, for example slice vs. islice and add vs iadd.
§Indexing
Arrays use u32 for indexing, represented by the types Ix and Ixs (signed).
§Broadcasting
Arrays support limited broadcasting, where arithmetic operations with array operands of different sizes can be carried out by repeating the elements of the smaller dimension array. See .broadcast_iter() for a more detailed description.
use ndarray::arr2;
let a = arr2(&[[1., 1.],
[1., 2.]]);
let b = arr2(&[[0., 1.]]);
let c = arr2(&[[1., 2.],
[1., 3.]]);
// We can add because the shapes are compatible even if not equal.
assert!(
c == a + b
);
Implementations§
source§impl<A, D> Array<A, D>where
D: Dimension,
impl<A, D> Array<A, D>where
D: Dimension,
sourcepub fn default(dim: D) -> Array<A, D>where
A: Default,
pub fn default(dim: D) -> Array<A, D>where
A: Default,
Construct an Array with default values, dimension dim
.
sourcepub fn from_elem(dim: D, elem: A) -> Array<A, D>where
A: Clone,
pub fn from_elem(dim: D, elem: A) -> Array<A, D>where
A: Clone,
Construct an Array with copies of elem.
use ndarray::Array;
use ndarray::arr3;
let a = Array::from_elem((2, 2, 2), 1.);
assert!(
a == arr3(&[[[1., 1.],
[1., 1.]],
[[1., 1.],
[1., 1.]]])
);
sourcepub unsafe fn from_vec_dim(dim: D, v: Vec<A>) -> Array<A, D>
pub unsafe fn from_vec_dim(dim: D, v: Vec<A>) -> Array<A, D>
Create an array from a vector (with no allocation needed).
Unsafe because dimension is unchecked, and must be correct.
sourcepub fn is_standard_layout(&self) -> bool
pub fn is_standard_layout(&self) -> bool
Return true if the array data is laid out in contiguous “C order” where the last index is the most rapidly varying.
Return false otherwise, i.e the array is possibly not contiguous in memory, it has custom strides, etc.
sourcepub fn raw_data<'a>(&'a self) -> &'a [A]
pub fn raw_data<'a>(&'a self) -> &'a [A]
Return a slice of the array’s backing data in memory order.
Note: Data memory order may not correspond to the index order of the array. Neither is the raw data slice is restricted to just the Array’s view.
sourcepub fn slice(&self, indexes: &[Si]) -> Array<A, D>
pub fn slice(&self, indexes: &[Si]) -> Array<A, D>
Return a sliced array.
Panics if indexes does not match the number of array axes.
sourcepub fn islice(&mut self, indexes: &[Si])
pub fn islice(&mut self, indexes: &[Si])
Slice the array’s view in place.
Panics if indexes does not match the number of array axes.
sourcepub fn slice_iter<'a>(&'a self, indexes: &[Si]) -> Elements<'a, A, D> ⓘ
pub fn slice_iter<'a>(&'a self, indexes: &[Si]) -> Elements<'a, A, D> ⓘ
Return an iterator over a sliced view.
Panics if indexes does not match the number of array axes.
sourcepub fn at<'a>(&'a self, index: D) -> Option<&'a A>
pub fn at<'a>(&'a self, index: D) -> Option<&'a A>
Return a reference to the element at index, or return None if the index is out of bounds.
sourcepub unsafe fn uchk_at<'a>(&'a self, index: D) -> &'a A
pub unsafe fn uchk_at<'a>(&'a self, index: D) -> &'a A
Perform unchecked array indexing.
Return a reference to the element at index.
Note: only unchecked for non-debug builds of ndarray.
sourcepub unsafe fn uchk_at_mut(&mut self, index: D) -> &mut A
pub unsafe fn uchk_at_mut(&mut self, index: D) -> &mut A
Perform unchecked array indexing.
Return a mutable reference to the element at index.
Note: Only unchecked for non-debug builds of ndarray.
Note: The array must be uniquely held when mutating it.
sourcepub fn iter<'a>(&'a self) -> Elements<'a, A, D> ⓘ
pub fn iter<'a>(&'a self) -> Elements<'a, A, D> ⓘ
Return an iterator of references to the elements of the array.
Iterator element type is &’a A.
sourcepub fn indexed_iter<'a>(&'a self) -> Indexed<Elements<'a, A, D>> ⓘ
pub fn indexed_iter<'a>(&'a self) -> Indexed<Elements<'a, A, D>> ⓘ
Return an iterator of references to the elements of the array.
Iterator element type is (D, &’a A).
sourcepub fn isubview(&mut self, axis: usize, index: Ix)
pub fn isubview(&mut self, axis: usize, index: Ix)
Collapse dimension axis into length one, and select the subview of index along that axis.
Panics if index is past the length of the axis.
sourcepub fn broadcast_iter<'a, E: Dimension>(
&'a self,
dim: E,
) -> Option<Elements<'a, A, E>>
pub fn broadcast_iter<'a, E: Dimension>( &'a self, dim: E, ) -> Option<Elements<'a, A, E>>
Act like a larger size and/or shape array by broadcasting into a larger shape, if possible.
Return None if shapes can not be broadcast together.
§Background
- Two axes are compatible if they are equal, or one of them is 1.
- In this instance, only the axes of the smaller side (self) can be 1.
Compare axes beginning with the last axis of each shape.
For example (1, 2, 4) can be broadcast into (7, 6, 2, 4) because its axes are either equal or 1 (or missing); while (2, 2) can not be broadcast into (2, 4).
The implementation creates an iterator with strides set to 0 for the axes that are to be repeated.
See broadcasting documentation for Numpy for more information.
use ndarray::arr1;
assert!(
arr1(&[1., 0.]).broadcast_iter((10, 2)).unwrap().count()
== 20
);
sourcepub fn swap_axes(&mut self, ax: usize, bx: usize)
pub fn swap_axes(&mut self, ax: usize, bx: usize)
Swap axes ax and bx.
Panics if the axes are out of bounds.
use ndarray::arr2;
let mut a = arr2(&[[1., 2., 3.]]);
a.swap_axes(0, 1);
assert!(
a == arr2(&[[1.], [2.], [3.]])
);
sourcepub fn diag_iter<'a>(&'a self) -> Elements<'a, A, Ix> ⓘ
pub fn diag_iter<'a>(&'a self) -> Elements<'a, A, Ix> ⓘ
Return an iterator over the diagonal elements of the array.
The diagonal is simply the sequence indexed by (0, 0, .., 0), (1, 1, …, 1) etc as long as all axes have elements.
sourcepub fn map<'a, B, F>(&'a self, f: F) -> Array<B, D>
pub fn map<'a, B, F>(&'a self, f: F) -> Array<B, D>
Apply f elementwise and return a new array with the results.
Return an array with the same shape as self.
use ndarray::arr2;
let a = arr2(&[[1., 2.],
[3., 4.]]);
assert!(
a.map(|&x| (x / 2.) as i32)
== arr2(&[[0, 1], [1, 2]])
);
sourcepub fn subview(
&self,
axis: usize,
index: Ix,
) -> Array<A, <D as RemoveAxis>::Smaller>where
D: RemoveAxis,
pub fn subview(
&self,
axis: usize,
index: Ix,
) -> Array<A, <D as RemoveAxis>::Smaller>where
D: RemoveAxis,
Select the subview index along axis and return an array with that axis removed.
Panics if index is past the length of the axis.
use ndarray::{arr1, arr2};
let a = arr2(&[[1., 2.],
[3., 4.]]);
assert!(
a.subview(0, 0) == arr1(&[1., 2.]) &&
a.subview(1, 1) == arr1(&[2., 4.])
);
sourcepub fn ensure_unique(&mut self)where
A: Clone,
pub fn ensure_unique(&mut self)where
A: Clone,
Make the array unshared.
This method is mostly only useful with unsafe code.
sourcepub fn at_mut<'a>(&'a mut self, index: D) -> Option<&'a mut A>where
A: Clone,
pub fn at_mut<'a>(&'a mut self, index: D) -> Option<&'a mut A>where
A: Clone,
Return a mutable reference to the element at index, or return None if the index is out of bounds.
sourcepub fn iter_mut<'a>(&'a mut self) -> ElementsMut<'a, A, D> ⓘwhere
A: Clone,
pub fn iter_mut<'a>(&'a mut self) -> ElementsMut<'a, A, D> ⓘwhere
A: Clone,
Return an iterator of mutable references to the elements of the array.
Iterator element type is &’a mut A.
sourcepub fn indexed_iter_mut<'a>(&'a mut self) -> Indexed<ElementsMut<'a, A, D>> ⓘwhere
A: Clone,
pub fn indexed_iter_mut<'a>(&'a mut self) -> Indexed<ElementsMut<'a, A, D>> ⓘwhere
A: Clone,
Return an iterator of indexes and mutable references to the elements of the array.
Iterator element type is (D, &’a mut A).
sourcepub fn slice_iter_mut<'a>(&'a mut self, indexes: &[Si]) -> ElementsMut<'a, A, D> ⓘwhere
A: Clone,
pub fn slice_iter_mut<'a>(&'a mut self, indexes: &[Si]) -> ElementsMut<'a, A, D> ⓘwhere
A: Clone,
Return an iterator of mutable references into the sliced view of the array.
Iterator element type is &’a mut A.
Panics if indexes does not match the number of array axes.
sourcepub fn sub_iter_mut<'a>(
&'a mut self,
axis: usize,
index: Ix,
) -> ElementsMut<'a, A, D> ⓘwhere
A: Clone,
pub fn sub_iter_mut<'a>(
&'a mut self,
axis: usize,
index: Ix,
) -> ElementsMut<'a, A, D> ⓘwhere
A: Clone,
Select the subview index along axis and return an iterator of the subview.
Iterator element type is &’a mut A.
Panics if axis or index is out of bounds.
sourcepub fn diag_iter_mut<'a>(&'a mut self) -> ElementsMut<'a, A, Ix> ⓘwhere
A: Clone,
pub fn diag_iter_mut<'a>(&'a mut self) -> ElementsMut<'a, A, Ix> ⓘwhere
A: Clone,
Return an iterator over the diagonal elements of the array.
sourcepub fn raw_data_mut<'a>(&'a mut self) -> &'a mut [A]where
A: Clone,
pub fn raw_data_mut<'a>(&'a mut self) -> &'a mut [A]where
A: Clone,
Return a mutable slice of the array’s backing data in memory order.
Note: Data memory order may not correspond to the index order of the array. Neither is the raw data slice is restricted to just the array’s view.
Note: The data is uniquely held and nonaliased while it is mutably borrowed.
sourcepub fn reshape<E: Dimension>(&self, shape: E) -> Array<A, E>where
A: Clone,
pub fn reshape<E: Dimension>(&self, shape: E) -> Array<A, E>where
A: Clone,
Transform the array into shape; any other shape with the same number of elements is accepted.
Panics if sizes are incompatible.
use ndarray::{arr1, arr2};
assert!(
arr1(&[1., 2., 3., 4.]).reshape((2, 2))
== arr2(&[[1., 2.],
[3., 4.]])
);
sourcepub fn assign<E: Dimension>(&mut self, other: &Array<A, E>)where
A: Clone,
pub fn assign<E: Dimension>(&mut self, other: &Array<A, E>)where
A: Clone,
Perform an elementwise assigment to self from other.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
sourcepub fn assign_scalar(&mut self, x: &A)where
A: Clone,
pub fn assign_scalar(&mut self, x: &A)where
A: Clone,
Perform an elementwise assigment to self from scalar x.
source§impl<A, D> Array<A, D>
impl<A, D> Array<A, D>
sourcepub fn sum(&self, axis: usize) -> Array<A, <D as RemoveAxis>::Smaller>
pub fn sum(&self, axis: usize) -> Array<A, <D as RemoveAxis>::Smaller>
Return sum along axis.
use ndarray::{arr0, arr1, arr2};
let a = arr2(&[[1., 2.],
[3., 4.]]);
assert!(
a.sum(0) == arr1(&[4., 6.]) &&
a.sum(1) == arr1(&[3., 7.]) &&
a.sum(0).sum(0) == arr0(10.)
);
Panics if axis is out of bounds.
source§impl<A> Array<A, (Ix, Ix)>
impl<A> Array<A, (Ix, Ix)>
source§impl<'a, A: Copy + Ring> Array<A, (Ix, Ix)>
impl<'a, A: Copy + Ring> Array<A, (Ix, Ix)>
sourcepub fn mat_mul(&self, other: &Array<A, (Ix, Ix)>) -> Array<A, (Ix, Ix)>
pub fn mat_mul(&self, other: &Array<A, (Ix, Ix)>) -> Array<A, (Ix, Ix)>
Perform matrix multiplication of rectangular arrays self and other.
The array sizes must agree in the way that if self is M × N, then other is N × K.
Return a result array with shape M × K.
Panics if sizes are incompatible.
use ndarray::arr2;
let a = arr2(&[[1., 2.],
[0., 1.]]);
let b = arr2(&[[1., 2.],
[2., 3.]]);
assert!(
a.mat_mul(&b) == arr2(&[[5., 8.],
[2., 3.]])
);
sourcepub fn mat_mul_col(&self, other: &Array<A, Ix>) -> Array<A, Ix>
pub fn mat_mul_col(&self, other: &Array<A, Ix>) -> Array<A, Ix>
Perform the matrix multiplication of the rectangular array self and column vector other.
The array sizes must agree in the way that if self is M × N, then other is N.
Return a result array with shape M.
Panics if sizes are incompatible.
source§impl<A, D> Array<A, D>
impl<A, D> Array<A, D>
sourcepub fn iadd<E: Dimension>(&mut self, other: &Array<A, E>)
pub fn iadd<E: Dimension>(&mut self, other: &Array<A, E>)
Perform an elementwise arithmetic operation between self and other, in place.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
sourcepub fn iadd_scalar(&mut self, x: &A)
pub fn iadd_scalar(&mut self, x: &A)
Perform an elementwise arithmetic operation between self and the scalar x, in place.
source§impl<A, D> Array<A, D>
impl<A, D> Array<A, D>
sourcepub fn isub<E: Dimension>(&mut self, other: &Array<A, E>)
pub fn isub<E: Dimension>(&mut self, other: &Array<A, E>)
Perform an elementwise arithmetic operation between self and other, in place.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
sourcepub fn isub_scalar(&mut self, x: &A)
pub fn isub_scalar(&mut self, x: &A)
Perform an elementwise arithmetic operation between self and the scalar x, in place.
source§impl<A, D> Array<A, D>
impl<A, D> Array<A, D>
sourcepub fn imul<E: Dimension>(&mut self, other: &Array<A, E>)
pub fn imul<E: Dimension>(&mut self, other: &Array<A, E>)
Perform an elementwise arithmetic operation between self and other, in place.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
sourcepub fn imul_scalar(&mut self, x: &A)
pub fn imul_scalar(&mut self, x: &A)
Perform an elementwise arithmetic operation between self and the scalar x, in place.
source§impl<A, D> Array<A, D>
impl<A, D> Array<A, D>
sourcepub fn idiv<E: Dimension>(&mut self, other: &Array<A, E>)
pub fn idiv<E: Dimension>(&mut self, other: &Array<A, E>)
Perform an elementwise arithmetic operation between self and other, in place.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
sourcepub fn idiv_scalar(&mut self, x: &A)
pub fn idiv_scalar(&mut self, x: &A)
Perform an elementwise arithmetic operation between self and the scalar x, in place.
source§impl<A, D> Array<A, D>
impl<A, D> Array<A, D>
sourcepub fn irem<E: Dimension>(&mut self, other: &Array<A, E>)
pub fn irem<E: Dimension>(&mut self, other: &Array<A, E>)
Perform an elementwise arithmetic operation between self and other, in place.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
sourcepub fn irem_scalar(&mut self, x: &A)
pub fn irem_scalar(&mut self, x: &A)
Perform an elementwise arithmetic operation between self and the scalar x, in place.
source§impl<A, D> Array<A, D>
impl<A, D> Array<A, D>
sourcepub fn ibitand<E: Dimension>(&mut self, other: &Array<A, E>)
pub fn ibitand<E: Dimension>(&mut self, other: &Array<A, E>)
Perform an elementwise arithmetic operation between self and other, in place.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
sourcepub fn ibitand_scalar(&mut self, x: &A)
pub fn ibitand_scalar(&mut self, x: &A)
Perform an elementwise arithmetic operation between self and the scalar x, in place.
source§impl<A, D> Array<A, D>
impl<A, D> Array<A, D>
sourcepub fn ibitor<E: Dimension>(&mut self, other: &Array<A, E>)
pub fn ibitor<E: Dimension>(&mut self, other: &Array<A, E>)
Perform an elementwise arithmetic operation between self and other, in place.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
sourcepub fn ibitor_scalar(&mut self, x: &A)
pub fn ibitor_scalar(&mut self, x: &A)
Perform an elementwise arithmetic operation between self and the scalar x, in place.
source§impl<A, D> Array<A, D>
impl<A, D> Array<A, D>
sourcepub fn ibitxor<E: Dimension>(&mut self, other: &Array<A, E>)
pub fn ibitxor<E: Dimension>(&mut self, other: &Array<A, E>)
Perform an elementwise arithmetic operation between self and other, in place.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
sourcepub fn ibitxor_scalar(&mut self, x: &A)
pub fn ibitxor_scalar(&mut self, x: &A)
Perform an elementwise arithmetic operation between self and the scalar x, in place.
source§impl<A, D> Array<A, D>
impl<A, D> Array<A, D>
sourcepub fn ishl<E: Dimension>(&mut self, other: &Array<A, E>)
pub fn ishl<E: Dimension>(&mut self, other: &Array<A, E>)
Perform an elementwise arithmetic operation between self and other, in place.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
sourcepub fn ishl_scalar(&mut self, x: &A)
pub fn ishl_scalar(&mut self, x: &A)
Perform an elementwise arithmetic operation between self and the scalar x, in place.
source§impl<A, D> Array<A, D>
impl<A, D> Array<A, D>
sourcepub fn ishr<E: Dimension>(&mut self, other: &Array<A, E>)
pub fn ishr<E: Dimension>(&mut self, other: &Array<A, E>)
Perform an elementwise arithmetic operation between self and other, in place.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
sourcepub fn ishr_scalar(&mut self, x: &A)
pub fn ishr_scalar(&mut self, x: &A)
Perform an elementwise arithmetic operation between self and the scalar x, in place.
Trait Implementations§
source§impl<'a, A, D, E> Add<&'a Array<A, E>> for &'a Array<A, D>
impl<'a, A, D, E> Add<&'a Array<A, E>> for &'a Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<'a, A, D, E> Add<Array<A, E>> for Array<A, D>
impl<'a, A, D, E> Add<Array<A, E>> for Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<'a, A, D, E> BitAnd<&'a Array<A, E>> for &'a Array<A, D>
impl<'a, A, D, E> BitAnd<&'a Array<A, E>> for &'a Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<'a, A, D, E> BitAnd<Array<A, E>> for Array<A, D>
impl<'a, A, D, E> BitAnd<Array<A, E>> for Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<'a, A, D, E> BitOr<&'a Array<A, E>> for &'a Array<A, D>
impl<'a, A, D, E> BitOr<&'a Array<A, E>> for &'a Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<'a, A, D, E> BitOr<Array<A, E>> for Array<A, D>
impl<'a, A, D, E> BitOr<Array<A, E>> for Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<'a, A, D, E> BitXor<&'a Array<A, E>> for &'a Array<A, D>
impl<'a, A, D, E> BitXor<&'a Array<A, E>> for &'a Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<'a, A, D, E> BitXor<Array<A, E>> for Array<A, D>
impl<'a, A, D, E> BitXor<Array<A, E>> for Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<'a, A, D, E> Div<&'a Array<A, E>> for &'a Array<A, D>
impl<'a, A, D, E> Div<&'a Array<A, E>> for &'a Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<'a, A, D, E> Div<Array<A, E>> for Array<A, D>
impl<'a, A, D, E> Div<Array<A, E>> for Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<A> FromIterator<A> for Array<A, Ix>
impl<A> FromIterator<A> for Array<A, Ix>
source§impl<'a, A, D> IntoIterator for &'a Array<A, D>where
D: Dimension,
impl<'a, A, D> IntoIterator for &'a Array<A, D>where
D: Dimension,
source§impl<'a, A, D> IntoIterator for &'a mut Array<A, D>
impl<'a, A, D> IntoIterator for &'a mut Array<A, D>
source§impl<'a, A, D, E> Mul<&'a Array<A, E>> for &'a Array<A, D>
impl<'a, A, D, E> Mul<&'a Array<A, E>> for &'a Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<'a, A, D, E> Mul<Array<A, E>> for Array<A, D>
impl<'a, A, D, E> Mul<Array<A, E>> for Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<A: PartialEq, D: Dimension> PartialEq for Array<A, D>
impl<A: PartialEq, D: Dimension> PartialEq for Array<A, D>
source§impl<'a, A, D, E> Rem<&'a Array<A, E>> for &'a Array<A, D>
impl<'a, A, D, E> Rem<&'a Array<A, E>> for &'a Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<'a, A, D, E> Rem<Array<A, E>> for Array<A, D>
impl<'a, A, D, E> Rem<Array<A, E>> for Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<'a, A, D, E> Shl<&'a Array<A, E>> for &'a Array<A, D>
impl<'a, A, D, E> Shl<&'a Array<A, E>> for &'a Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<'a, A, D, E> Shl<Array<A, E>> for Array<A, D>
impl<'a, A, D, E> Shl<Array<A, E>> for Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<'a, A, D, E> Shr<&'a Array<A, E>> for &'a Array<A, D>
impl<'a, A, D, E> Shr<&'a Array<A, E>> for &'a Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<'a, A, D, E> Shr<Array<A, E>> for Array<A, D>
impl<'a, A, D, E> Shr<Array<A, E>> for Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<'a, A, D, E> Sub<&'a Array<A, E>> for &'a Array<A, D>
impl<'a, A, D, E> Sub<&'a Array<A, E>> for &'a Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
source§impl<'a, A, D, E> Sub<Array<A, E>> for Array<A, D>
impl<'a, A, D, E> Sub<Array<A, E>> for Array<A, D>
Perform an elementwise arithmetic operation between self and other, and return the result.
If their shapes disagree, other is broadcast to the shape of self.
Panics if broadcasting isn’t possible.
impl<A: Eq, D: Dimension> Eq for Array<A, D>
Auto Trait Implementations§
impl<A, D> Freeze for Array<A, D>where
D: Freeze,
impl<A, D> RefUnwindSafe for Array<A, D>where
D: RefUnwindSafe,
A: RefUnwindSafe,
impl<A, D> !Send for Array<A, D>
impl<A, D> !Sync for Array<A, D>
impl<A, D> Unpin for Array<A, D>where
D: Unpin,
impl<A, D> UnwindSafe for Array<A, D>where
D: UnwindSafe,
A: RefUnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)