Struct ndarray::ArrayBase
[−]
[src]
pub struct ArrayBase<S, D> where S: Data {
// some fields omitted
}
An N-dimensional array.
The array is a general container of elements. It cannot grow or shrink, but can be sliced into subsets of its data. The array supports arithmetic operations by applying them elementwise.
The ArrayBase<S, D>
is parameterized by S
for the data container and
D
for the dimensionality.
Type aliases OwnedArray
, RcArray
, ArrayView
, and ArrayViewMut
refer
to ArrayBase
with different types for the data container.
Contents
- OwnedArray and RcArray
- Indexing and Dimension
- Slicing
- Subviews
- Arithmetic Operations
- Broadcasting
- Methods
- Methods for Array Views
OwnedArray
and RcArray
OwnedArray
owns the underlying array elements directly (just like
a Vec
), while RcArray
is a an array with reference
counted data. RcArray
can act both as an owner or as a view in that regard.
Sharing requires that it uses copy-on-write for mutable operations.
Calling a method for mutating elements on RcArray
, for example
view_mut()
or get_mut()
,
will break sharing and require a clone of the data (if it is not uniquely held).
Note that all ArrayBase
variants can change their view (slicing) of the
data freely, even when their data can’t be mutated.
Indexing and Dimension
Array indexes are represented by the types Ix
and Ixs
(signed).
The dimensionality of the array determines the number of axes, for example a 2D array has two axes. These are listed in “big endian” order, so that the greatest dimension is listed first, the lowest dimension with the most rapidly varying index is the last.
In a 2D array the index of each element is (row, column)
as seen in this 3 × 3 example:
[[ (0, 0), (0, 1), (0, 2)], // row 0 [ (1, 0), (1, 1), (1, 2)], // row 1 [ (2, 0), (2, 1), (2, 2)]] // row 2 // \ \ \ // column 0 \ column 2 // column 1
The number of axes for an array is fixed by the D
parameter: Ix
for
a 1D array, (Ix, Ix)
for a 2D array etc. The D
type is also used
for element indices in .get()
and array[index]
. The dimension type Vec<Ix>
allows a dynamic number of axes.
The default memory order of an array is row major order (a.k.a ”c” order), where each row is contiguous in memory. A column major (a.k.a. “f” or fortran) memory order array has columns (or, in general, the outermost axis) with contiguous elements.
The logical order of any array’s elements is the row major order.
The iterators .iter(), .iter_mut()
always adhere to this order, for example.
Slicing
You can use slicing to create a view of a subset of the data in
the array. Slicing methods include .slice()
, .islice()
,
.slice_mut()
.
The slicing argument can be passed using the macro s![]
,
which will be used in all examples. (The explicit form is a reference
to a fixed size array of Si
; see its docs for more information.)
// import the s![] macro #[macro_use(s)] extern crate ndarray; use ndarray::arr3; fn main() { // 2 submatrices of 2 rows with 3 elements per row, means a shape of `[2, 2, 3]`. let a = arr3(&[[[ 1, 2, 3], // -- 2 rows \_ [ 4, 5, 6]], // -- / [[ 7, 8, 9], // \_ 2 submatrices [10, 11, 12]]]); // / // 3 columns ..../.../.../ assert_eq!(a.shape(), &[2, 2, 3]); // Let’s create a slice with // // - Both of the submatrices of the greatest dimension: `..` // - Only the first row in each submatrix: `0..1` // - Every element in each row: `..` let b = a.slice(s![.., 0..1, ..]); // without the macro, the explicit argument is `&[S, Si(0, Some(1), 1), S]` let c = arr3(&[[[ 1, 2, 3]], [[ 7, 8, 9]]]); assert_eq!(b, c); assert_eq!(b.shape(), &[2, 1, 3]); // Let’s create a slice with // // - Both submatrices of the greatest dimension: `..` // - The last row in each submatrix: `-1..` // - Row elements in reverse order: `..;-1` let d = a.slice(s![.., -1.., ..;-1]); let e = arr3(&[[[ 6, 5, 4]], [[12, 11, 10]]]); assert_eq!(d, e); }
Subviews
Subview methods allow you to restrict the array view while removing
one axis from the array. Subview methods include .subview()
,
.isubview()
, .subview_mut()
.
Subview takes two arguments: axis
and index
.
use ndarray::{arr3, aview2, Axis}; // 2 submatrices of 2 rows with 3 elements per row, means a shape of `[2, 2, 3]`. let a = arr3(&[[[ 1, 2, 3], // \ axis 0, submatrix 0 [ 4, 5, 6]], // / [[ 7, 8, 9], // \ axis 0, submatrix 1 [10, 11, 12]]]); // / // \ // axis 2, column 0 assert_eq!(a.shape(), &[2, 2, 3]); // Let’s take a subview along the greatest dimension (axis 0), // taking submatrix 0, then submatrix 1 let sub_0 = a.subview(Axis(0), 0); let sub_1 = a.subview(Axis(0), 1); assert_eq!(sub_0, aview2(&[[ 1, 2, 3], [ 4, 5, 6]])); assert_eq!(sub_1, aview2(&[[ 7, 8, 9], [10, 11, 12]])); assert_eq!(sub_0.shape(), &[2, 3]); // This is the subview picking only axis 2, column 0 let sub_col = a.subview(Axis(2), 0); assert_eq!(sub_col, aview2(&[[ 1, 4], [ 7, 10]]));
.isubview()
modifies the view in the same way as subview()
, but
since it is in place, it cannot remove the collapsed axis. It becomes
an axis of length 1.
.outer_iter()
is an iterator of every subview along the zeroth (outer)
axis, while .axis_iter()
is an iterator of every subview along a
specific axis.
Arithmetic Operations
Arrays support all arithmetic operations the same way: they apply elementwise.
Since the trait implementations are hard to overview, here is a summary.
Let A
be an array or view of any kind. Let B
be an array
with owned storage (either OwnedArray
or RcArray
).
Let C
be an array with mutable data (either OwnedArray
, RcArray
or ArrayViewMut
).
The following combinations of operands
are supported for an arbitrary binary operator denoted by @
.
&A @ &A
which produces a newOwnedArray
B @ A
which consumesB
, updates it with the result, and returns itB @ &A
which consumesB
, updates it with the result, and returns itC @= &A
which performs an arithmetic operation in place (requires crate feature"assign_ops"
)
The trait ScalarOperand
marks types that can be used in arithmetic
with arrays directly. For a scalar K
the following combinations of operands
are supported (scalar can be on either the left or right side, but
ScalarOperand
docs has the detailed condtions).
&A @ K
orK @ &A
which produces a newOwnedArray
B @ K
orK @ B
which consumesB
, updates it with the result and returns itC @= K
which performs an arithmetic operation in place (requires crate feature"assign_ops"
)
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()
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 );
Methods
impl<S> ArrayBase<S, Ix> where S: DataOwned
[src]
Constructor methods for one-dimensional arrays.
Note that the constructor methods apply to OwnedArray
and RcArray
,
the two array types that have owned storage.
fn from_vec(v: Vec<S::Elem>) -> ArrayBase<S, Ix>
Create a one-dimensional array from a vector (no copying needed).
use ndarray::OwnedArray; let array = OwnedArray::from_vec(vec![1., 2., 3., 4.]);
fn from_iter<I>(iterable: I) -> ArrayBase<S, Ix> where I: IntoIterator<Item=S::Elem>
Create a one-dimensional array from an iterable.
use ndarray::{OwnedArray, arr1}; let array = OwnedArray::from_iter((0..5).map(|x| x * x)); assert!(array == arr1(&[0, 1, 4, 9, 16]))
fn linspace<F>(start: F, end: F, n: usize) -> ArrayBase<S, Ix> where S: Data<Elem=F>, F: Float
Create a one-dimensional array from the inclusive interval
[start, end]
with n
elements. F
must be a floating point type.
use ndarray::{OwnedArray, arr1}; let array = OwnedArray::linspace(0., 1., 5); assert!(array == arr1(&[0.0, 0.25, 0.5, 0.75, 1.0]))
fn range<F>(start: F, end: F, step: F) -> ArrayBase<S, Ix> where S: Data<Elem=F>, F: Float
Create a one-dimensional array from the half-open interval
[start, end)
with elements spaced by step
. F
must be a floating point type.
use ndarray::{OwnedArray, arr1}; let array = OwnedArray::range(0., 5., 1.); assert!(array == arr1(&[0., 1., 2., 3., 4.]))
impl<S, A> ArrayBase<S, (Ix, Ix)> where S: DataOwned<Elem=A>
[src]
Constructor methods for two-dimensional arrays.
fn eye(n: Ix) -> ArrayBase<S, (Ix, Ix)> where S: DataMut, A: Clone + Zero + One
Create an identity matrix of size n
(square 2D array).
Panics if n * n
would overflow usize.
impl<S, A, D> ArrayBase<S, D> where S: DataOwned<Elem=A>, D: Dimension
[src]
Constructor methods for n-dimensional arrays.
fn from_elem(dim: D, elem: A) -> ArrayBase<S, D> where A: Clone
Create an array with copies of elem
, dimension dim
.
Panics if the number of elements in dim
would overflow usize.
use ndarray::OwnedArray; use ndarray::arr3; let a = OwnedArray::from_elem((2, 2, 2), 1.); assert!( a == arr3(&[[[1., 1.], [1., 1.]], [[1., 1.], [1., 1.]]]) ); assert!(a.strides() == &[4, 2, 1]);
fn from_elem_f(dim: D, elem: A) -> ArrayBase<S, D> where A: Clone
Create an array with copies of elem
, dimension dim
and fortran
memory order.
Panics if the number of elements would overflow usize.
use ndarray::OwnedArray; let a = OwnedArray::from_elem_f((2, 2, 2), 1.); assert!(a.strides() == &[1, 2, 4]);
fn zeros(dim: D) -> ArrayBase<S, D> where A: Clone + Zero
Create an array with zeros, dimension dim
.
Panics if the number of elements in dim
would overflow usize.
fn zeros_f(dim: D) -> ArrayBase<S, D> where A: Clone + Zero
Create an array with zeros, dimension dim
and fortran memory order.
Panics if the number of elements in dim
would overflow usize.
fn default(dim: D) -> ArrayBase<S, D> where A: Default
Create an array with default values, dimension dim
.
Panics if the number of elements in dim
would overflow usize.
fn from_vec_dim(dim: D, v: Vec<A>) -> Result<ArrayBase<S, D>, ShapeError>
Create an array from a vector (no copying needed).
Errors if dim
does not correspond to the number of elements in v
.
unsafe fn from_vec_dim_unchecked(dim: D, v: Vec<A>) -> ArrayBase<S, D>
Create an array from a vector (no copying needed).
Unsafe because dimension is unchecked, and must be correct.
unsafe fn from_vec_dim_unchecked_f(dim: D, v: Vec<A>) -> ArrayBase<S, D>
Create an array from a vector (with no copying needed), using fortran memory order to interpret the data.
Unsafe because dimension is unchecked, and must be correct.
fn from_vec_dim_stride(dim: D, strides: D, v: Vec<A>) -> Result<ArrayBase<S, D>, ShapeError>
Create an array from a vector and interpret it according to the provided dimensions and strides. No allocation needed.
Checks whether dim
and strides
are compatible with the vector's
length, returning an Err
if not compatible.
Errors if strides and dimensions can point out of bounds of v
.
Errors if strides allow multiple indices to point to the same element.
unsafe fn from_vec_dim_stride_unchecked(dim: D, strides: D, v: Vec<A>) -> ArrayBase<S, D>
Create an array from a vector and interpret it according to the provided dimensions and strides. No allocation needed.
Unsafe because dimension and strides are unchecked.
impl<A, S, D> ArrayBase<S, D> where S: Data<Elem=A>, D: Dimension
[src]
fn len(&self) -> usize
Return the total number of elements in the array.
fn dim(&self) -> D
Return the shape of the array.
fn shape(&self) -> &[Ix]
Return the shape of the array as a slice.
fn strides(&self) -> &[Ixs]
Return the strides of the array
fn ndim(&self) -> usize
Return the number of dimensions (axes) in the array
fn view(&self) -> ArrayView<A, D>
Return a read-only view of the array
fn view_mut(&mut self) -> ArrayViewMut<A, D> where S: DataMut
Return a read-write view of the array
fn to_owned(&self) -> OwnedArray<A, D> where A: Clone
Return an uniquely owned copy of the array
fn to_shared(&self) -> RcArray<A, D> where A: Clone
Return a shared ownership (copy on write) array.
fn into_shared(self) -> RcArray<A, D> where S: DataOwned
Turn the array into a shared ownership (copy on write) array, without any copying.
fn iter(&self) -> Elements<A, D>
Return an iterator of references to the elements of the array.
Iterator element type is &A
.
fn iter_mut(&mut self) -> ElementsMut<A, D> where S: DataMut
Return an iterator of mutable references to the elements of the array.
Iterator element type is &mut A
.
fn indexed_iter(&self) -> Indexed<A, D>
Return an iterator of indexes and references to the elements of the array.
Iterator element type is (D, &A)
.
fn indexed_iter_mut(&mut self) -> IndexedMut<A, D> where S: DataMut
Return an iterator of indexes and mutable references to the elements of the array.
Iterator element type is (D, &mut A)
.
fn slice(&self, indexes: &D::SliceArg) -> ArrayView<A, D>
Return a sliced array.
See Slicing for full documentation.
See also D::SliceArg
.
Panics if an index is out of bounds or stride is zero.
(Panics if D
is Vec
and indexes
does not match the number of array axes.)
fn slice_mut(&mut self, indexes: &D::SliceArg) -> ArrayViewMut<A, D> where S: DataMut
Return a sliced read-write view of the array.
See also D::SliceArg
.
Panics if an index is out of bounds or stride is zero.
(Panics if D
is Vec
and indexes
does not match the number of array axes.)
fn islice(&mut self, indexes: &D::SliceArg)
Slice the array’s view in place.
See also D::SliceArg
.
Panics if an index is out of bounds or stride is zero.
(Panics if D
is Vec
and indexes
does not match the number of array axes.)
fn get<I>(&self, index: I) -> Option<&A> where I: NdIndex<Dim=D>
Return a reference to the element at index
, or return None
if the index is out of bounds.
Arrays also support indexing syntax: array[index]
.
use ndarray::arr2; let a = arr2(&[[1., 2.], [3., 4.]]); assert!( a.get((0, 1)) == Some(&2.) && a.get((0, 2)) == None && a[(0, 1)] == 2. && a[[0, 1]] == 2. );
fn get_mut<I>(&mut self, index: I) -> Option<&mut A> where S: DataMut, I: NdIndex<Dim=D>
Return a mutable reference to the element at index
, or return None
if the index is out of bounds.
unsafe fn uget(&self, index: D) -> &A
Perform unchecked array indexing.
Return a reference to the element at index
.
Note: only unchecked for non-debug builds of ndarray.
unsafe fn uget_mut(&mut self, index: D) -> &mut A where S: DataMut
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.
fn subview(&self, axis: Axis, index: Ix) -> ArrayView<A, D::Smaller> where D: RemoveAxis
Along axis
, select the subview index
and return a
view with that axis removed.
See Subviews for full documentation.
Panics if axis
or index
is out of bounds.
use ndarray::{arr2, ArrayView, Axis}; let a = arr2(&[[1., 2.], // -- axis 0, row 0 [3., 4.], // -- axis 0, row 1 [5., 6.]]); // -- axis 0, row 2 // \ \ // \ axis 1, column 1 // axis 1, column 0 assert!( a.subview(Axis(0), 1) == ArrayView::from(&[3., 4.]) && a.subview(Axis(1), 1) == ArrayView::from(&[2., 4., 6.]) );
fn subview_mut(&mut self, axis: Axis, index: Ix) -> ArrayViewMut<A, D::Smaller> where S: DataMut, D: RemoveAxis
Along axis
, select the subview index
and return a read-write view
with the axis removed.
Panics if axis
or index
is out of bounds.
use ndarray::{arr2, aview2, Axis}; let mut a = arr2(&[[1., 2.], [3., 4.]]); a.subview_mut(Axis(1), 1).iadd_scalar(&10.); assert!( a == aview2(&[[1., 12.], [3., 14.]]) );
fn isubview(&mut self, axis: Axis, 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.
fn into_subview(self, axis: Axis, index: Ix) -> ArrayBase<S, D::Smaller> where D: RemoveAxis
Along axis
, select the subview index
and return self
with that axis removed.
See .subview()
and Subviews for full documentation.
fn inner_iter(&self) -> InnerIter<A, D>
Return an iterator that traverses over all dimensions but the innermost, and yields each inner row.
For example, in a 2 × 2 × 3 array, the iterator element is a row of 3 elements (and there are 2 × 2 = 4 rows in total).
Iterator element is ArrayView<A, Ix>
(1D array view).
use ndarray::arr3; let a = arr3(&[[[ 0, 1, 2], // -- row 0, 0 [ 3, 4, 5]], // -- row 0, 1 [[ 6, 7, 8], // -- row 1, 0 [ 9, 10, 11]]]); // -- row 1, 1 // `inner_iter` yields the four inner rows of the 3D array. let mut row_sums = a.inner_iter().map(|v| v.scalar_sum()); assert_eq!(row_sums.collect::<Vec<_>>(), vec![3, 12, 21, 30]);
fn inner_iter_mut(&mut self) -> InnerIterMut<A, D> where S: DataMut
Return an iterator that traverses over all dimensions but the innermost, and yields each inner row.
Iterator element is ArrayViewMut<A, Ix>
(1D read-write array view).
fn outer_iter(&self) -> OuterIter<A, D::Smaller> where D: RemoveAxis
Return an iterator that traverses over the outermost dimension and yields each subview.
For example, in a 2 × 2 × 3 array, the iterator element is a 2 × 3 subview (and there are 2 in total).
Iterator element is ArrayView<A, D::Smaller>
(read-only array view).
use ndarray::{arr3, Axis}; let a = arr3(&[[[ 0, 1, 2], // \ axis 0, submatrix 0 [ 3, 4, 5]], // / [[ 6, 7, 8], // \ axis 0, submatrix 1 [ 9, 10, 11]]]); // / // `outer_iter` yields the two submatrices along axis 0. let mut iter = a.outer_iter(); assert_eq!(iter.next().unwrap(), a.subview(Axis(0), 0)); assert_eq!(iter.next().unwrap(), a.subview(Axis(0), 1));
fn outer_iter_mut(&mut self) -> OuterIterMut<A, D::Smaller> where S: DataMut, D: RemoveAxis
Return an iterator that traverses over the outermost dimension and yields each subview.
Iterator element is ArrayViewMut<A, D::Smaller>
(read-write array view).
fn axis_iter(&self, axis: Axis) -> OuterIter<A, D::Smaller> where D: RemoveAxis
Return an iterator that traverses over axis
and yields each subview along it.
For example, in a 2 × 2 × 3 array, with axis
equal to 1,
the iterator element
is a 2 × 3 subview (and there are 2 in total).
Iterator element is ArrayView<A, D::Smaller>
(read-only array view).
See Subviews for full documentation.
Panics if axis
is out of bounds.
fn axis_iter_mut(&mut self, axis: Axis) -> OuterIterMut<A, D::Smaller> where S: DataMut, D: RemoveAxis
Return an iterator that traverses over axis
and yields each mutable subview along it.
Iterator element is ArrayViewMut<A, D::Smaller>
(read-write array view).
Panics if axis
is out of bounds.
fn axis_chunks_iter(&self, axis: Axis, size: usize) -> AxisChunksIter<A, D>
Return an iterator that traverses over axis
by chunks of size
,
yielding non-overlapping views along that axis.
Iterator element is ArrayView<A, D>
The last view may have less elements if size
does not divide
the axis' dimension.
Panics if axis
is out of bounds.
use ndarray::OwnedArray; use ndarray::{arr3, Axis}; let a = OwnedArray::from_iter(0..28).into_shape((2, 7, 2)).unwrap(); let mut iter = a.axis_chunks_iter(Axis(1), 2); // first iteration yields a 2 × 2 × 2 view assert_eq!(iter.next().unwrap(), arr3(&[[[ 0, 1], [ 2, 3]], [[14, 15], [16, 17]]])); // however the last element is a 2 × 1 × 2 view since 7 % 2 == 1 assert_eq!(iter.next_back().unwrap(), arr3(&[[[12, 13]], [[26, 27]]]));
fn axis_chunks_iter_mut(&mut self, axis: Axis, size: usize) -> AxisChunksIterMut<A, D> where S: DataMut
Return an iterator that traverses over axis
by chunks of size
,
yielding non-overlapping read-write views along that axis.
Iterator element is ArrayViewMut<A, D>
Panics if axis
is out of bounds.
fn diag(&self) -> ArrayView<A, Ix>
Return an view of 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.
fn diag_mut(&mut self) -> ArrayViewMut<A, Ix> where S: DataMut
Return a read-write view over the diagonal elements of the array.
fn into_diag(self) -> ArrayBase<S, Ix>
Return the diagonal as a one-dimensional array.
fn is_standard_layout(&self) -> bool
Return true
if the array data is laid out in contiguous “C order” in
memory (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.
fn as_ptr(&self) -> *const A
Return a pointer to the first element in the array.
Raw access to array elements needs to follow the strided indexing scheme: an element at multi-index I in an array with strides S is located at offset
Σ0 ≤ k < d Ik × Sk
where d is self.ndim()
.
fn as_mut_ptr(&mut self) -> *mut A where S: DataMut
Return a mutable pointer to the first element in the array.
fn as_slice(&self) -> Option<&[A]>
Return the array’s data as a slice, if it is contiguous and in standard order.
Return None
otherwise.
If this function returns Some(_)
, then the element order in the slice
corresponds to the logical order of the array’s elements.
fn as_slice_mut(&mut self) -> Option<&mut [A]> where S: DataMut
Return the array’s data as a slice, if it is contiguous and in standard order.
Return None
otherwise.
fn as_slice_memory_order(&self) -> Option<&[A]>
Return the array’s data as a slice if it is contiguous,
return None
otherwise.
If this function returns Some(_)
, then the elements in the slice
have whatever order the elements have in memory.
Implementation notes: Does not yet support negatively strided arrays.
fn as_slice_memory_order_mut(&mut self) -> Option<&mut [A]> where S: DataMut
Return the array’s data as a slice if it is contiguous,
return None
otherwise.
fn reshape<E>(&self, shape: E) -> ArrayBase<S, E> where S: DataShared + DataOwned, A: Clone, E: Dimension
Transform the array into shape
; any shape with the same number of
elements is accepted.
May clone all elements if needed to arrange elements in standard layout (and break sharing).
Panics if shapes are incompatible.
use ndarray::{rcarr1, rcarr2}; assert!( rcarr1(&[1., 2., 3., 4.]).reshape((2, 2)) == rcarr2(&[[1., 2.], [3., 4.]]) );
fn into_shape<E>(self, shape: E) -> Result<ArrayBase<S, E>, ShapeError> where E: Dimension
Transform the array into shape
; any shape with the same number of
elements is accepted, but the source array or view must be
contiguous, otherwise we cannot rearrange the dimension.
Errors if the shapes don't have the same number of elements.
Errors if the input array is not c-contiguous (this will be
slightly improved in the future).
use ndarray::{aview1, aview2}; assert!( aview1(&[1., 2., 3., 4.]).into_shape((2, 2)).unwrap() == aview2(&[[1., 2.], [3., 4.]]) );
fn broadcast<E>(&self, dim: E) -> Option<ArrayView<A, E>> where E: Dimension
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 a view with strides set to zero for the axes that are to be repeated.
The broadcasting documentation for Numpy has more information.
use ndarray::{aview1, aview2}; assert!( aview1(&[1., 0.]).broadcast((10, 2)).unwrap() == aview2(&[[1., 0.]; 10]) );
fn swap_axes(&mut self, ax: usize, bx: usize)
Swap axes ax
and bx
.
This does not move any data, it just adjusts the array’s dimensions and strides.
Panics if the axes are out of bounds.
Compatibility notice: This function will use Axis
arguments
in the next version.
use ndarray::arr2; let mut a = arr2(&[[1., 2., 3.]]); a.swap_axes(0, 1); assert!( a == arr2(&[[1.], [2.], [3.]]) );
fn reversed_axes(self) -> ArrayBase<S, D>
Transpose the array by reversing axes.
Transposition reverses the order of the axes (dimensions and strides) while retaining the same data.
fn t(&self) -> ArrayView<A, D>
Return a transposed view of the array.
This is a shorthand for self.view().reversed_axes()
.
See also the more general methods .reversed_axes()
and .swap_axes()
.
fn raw_data(&self) -> &[A] where S: DataOwned
: Use .as_slice_memory_order() instead
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.
fn raw_data_mut(&mut self) -> &mut [A] where S: DataOwned + DataMut
: Use .as_slice_memory_order_mut() instead
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.
fn assign<E: Dimension, S2>(&mut self, rhs: &ArrayBase<S2, E>) where S: DataMut, A: Clone, S2: Data<Elem=A>
Perform an elementwise assigment to self
from rhs
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
fn assign_scalar(&mut self, x: &A) where S: DataMut, A: Clone
Perform an elementwise assigment to self
from scalar x
.
fn zip_mut_with<B, S2, E, F>(&mut self, rhs: &ArrayBase<S2, E>, f: F) where S: DataMut, S2: Data<Elem=B>, E: Dimension, F: FnMut(&mut A, &B)
Traverse two arrays in unspecified order, in lock step,
calling the closure f
on each element pair.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
fn fold<'a, F, B>(&'a self, init: B, f: F) -> B where F: FnMut(B, &'a A) -> B, A: 'a
Traverse the array elements in order and apply a fold, returning the resulting value.
fn map<'a, B, F>(&'a self, f: F) -> OwnedArray<B, D> where F: FnMut(&'a A) -> B, A: 'a
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(&[[ 0., 1.], [-1., 2.]]); assert!( a.map(|x| *x >= 1.0) == arr2(&[[false, true], [false, true]]) );
impl<A, S, D> ArrayBase<S, D> where S: Data<Elem=A>, D: Dimension
[src]
fn sum(&self, axis: Axis) -> OwnedArray<A, D::Smaller> where A: Clone + Add<Output=A>, D: RemoveAxis
Return sum along axis
.
use ndarray::{aview0, aview1, arr2, Axis}; let a = arr2(&[[1., 2.], [3., 4.]]); assert!( a.sum(Axis(0)) == aview1(&[4., 6.]) && a.sum(Axis(1)) == aview1(&[3., 7.]) && a.sum(Axis(0)).sum(Axis(0)) == aview0(&10.) );
Panics if axis
is out of bounds.
fn scalar_sum(&self) -> A where A: Clone + Add<Output=A> + Zero
Return the sum of all elements in the array.
use ndarray::arr2; let a = arr2(&[[1., 2.], [3., 4.]]); assert_eq!(a.scalar_sum(), 10.);
fn mean(&self, axis: Axis) -> OwnedArray<A, D::Smaller> where A: LinalgScalar, D: RemoveAxis
Return mean along axis
.
Panics if axis
is out of bounds.
use ndarray::{aview1, arr2, Axis}; let a = arr2(&[[1., 2.], [3., 4.]]); assert!( a.mean(Axis(0)) == aview1(&[2.0, 3.0]) && a.mean(Axis(1)) == aview1(&[1.5, 3.5]) );
fn allclose<S2>(&self, rhs: &ArrayBase<S2, D>, tol: A) -> bool where A: Float, S2: Data<Elem=A>
Return true
if the arrays' elementwise differences are all within
the given absolute tolerance.
Return false
otherwise, or if the shapes disagree.
impl<A, S> ArrayBase<S, Ix> where S: Data<Elem=A>
[src]
fn dot<S2>(&self, rhs: &ArrayBase<S2, Ix>) -> A where S2: Data<Elem=A>, A: LinalgScalar
Compute the dot product of one-dimensional arrays.
The dot product is a sum of the elementwise products (no conjugation of complex operands, and thus not their inner product).
Panics if the arrays are not of the same length.
impl<A, S> ArrayBase<S, (Ix, Ix)> where S: Data<Elem=A>
[src]
fn row(&self, index: Ix) -> ArrayView<A, Ix>
Return an array view of row index
.
Panics if index
is out of bounds.
fn row_mut(&mut self, index: Ix) -> ArrayViewMut<A, Ix> where S: DataMut
Return a mutable array view of row index
.
Panics if index
is out of bounds.
fn column(&self, index: Ix) -> ArrayView<A, Ix>
Return an array view of column index
.
Panics if index
is out of bounds.
fn column_mut(&mut self, index: Ix) -> ArrayViewMut<A, Ix> where S: DataMut
Return a mutable array view of column index
.
Panics if index
is out of bounds.
fn mat_mul<S2>(&self, rhs: &ArrayBase<S2, (Ix, Ix)>) -> OwnedArray<A, (Ix, Ix)> where A: LinalgScalar, S2: Data<Elem=A>
Perform matrix multiplication of rectangular arrays self
and rhs
.
The array shapes must agree in the way that
if self
is M × N, then rhs
is N × K.
Return a result array with shape M × K.
Panics if shapes 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.]]) );
fn mat_mul_col<S2>(&self, rhs: &ArrayBase<S2, Ix>) -> OwnedArray<A, Ix> where A: LinalgScalar, S2: Data<Elem=A>
Perform the matrix multiplication of the rectangular array self
and
column vector rhs
.
The array shapes must agree in the way that
if self
is M × N, then rhs
is N.
Return a result array with shape M.
Panics if shapes are incompatible.
impl<A, S, D> ArrayBase<S, D> where S: DataMut<Elem=A>, D: Dimension
[src]
In-place arithmetic operations.
Note: These will be deprecated in favour of overloaded @=
operators
when Rust 1.8 is released.
fn iadd<E: Dimension, S2>(&mut self, rhs: &ArrayBase<S2, E>) where A: Clone + Add<A, Output=A>, S2: Data<Elem=A>
Perform elementwise
addition
between self
and rhs
,
in place.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
fn iadd_scalar(&mut self, x: &A) where A: Clone + Add<A, Output=A>
Perform elementwise
addition
between self
and the scalar x
,
in place.
fn isub<E: Dimension, S2>(&mut self, rhs: &ArrayBase<S2, E>) where A: Clone + Sub<A, Output=A>, S2: Data<Elem=A>
Perform elementwise
subtraction
between self
and rhs
,
in place.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
fn isub_scalar(&mut self, x: &A) where A: Clone + Sub<A, Output=A>
Perform elementwise
subtraction
between self
and the scalar x
,
in place.
fn imul<E: Dimension, S2>(&mut self, rhs: &ArrayBase<S2, E>) where A: Clone + Mul<A, Output=A>, S2: Data<Elem=A>
Perform elementwise
multiplication
between self
and rhs
,
in place.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
fn imul_scalar(&mut self, x: &A) where A: Clone + Mul<A, Output=A>
Perform elementwise
multiplication
between self
and the scalar x
,
in place.
fn idiv<E: Dimension, S2>(&mut self, rhs: &ArrayBase<S2, E>) where A: Clone + Div<A, Output=A>, S2: Data<Elem=A>
Perform elementwise
division
between self
and rhs
,
in place.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
fn idiv_scalar(&mut self, x: &A) where A: Clone + Div<A, Output=A>
Perform elementwise
division
between self
and the scalar x
,
in place.
fn irem<E: Dimension, S2>(&mut self, rhs: &ArrayBase<S2, E>) where A: Clone + Rem<A, Output=A>, S2: Data<Elem=A>
Perform elementwise
remainder
between self
and rhs
,
in place.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
fn irem_scalar(&mut self, x: &A) where A: Clone + Rem<A, Output=A>
Perform elementwise
remainder
between self
and the scalar x
,
in place.
fn ibitand<E: Dimension, S2>(&mut self, rhs: &ArrayBase<S2, E>) where A: Clone + BitAnd<A, Output=A>, S2: Data<Elem=A>
Perform elementwise
bit and
between self
and rhs
,
in place.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
fn ibitand_scalar(&mut self, x: &A) where A: Clone + BitAnd<A, Output=A>
Perform elementwise
bit and
between self
and the scalar x
,
in place.
fn ibitor<E: Dimension, S2>(&mut self, rhs: &ArrayBase<S2, E>) where A: Clone + BitOr<A, Output=A>, S2: Data<Elem=A>
Perform elementwise
bit or
between self
and rhs
,
in place.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
fn ibitor_scalar(&mut self, x: &A) where A: Clone + BitOr<A, Output=A>
Perform elementwise
bit or
between self
and the scalar x
,
in place.
fn ibitxor<E: Dimension, S2>(&mut self, rhs: &ArrayBase<S2, E>) where A: Clone + BitXor<A, Output=A>, S2: Data<Elem=A>
Perform elementwise
bit xor
between self
and rhs
,
in place.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
fn ibitxor_scalar(&mut self, x: &A) where A: Clone + BitXor<A, Output=A>
Perform elementwise
bit xor
between self
and the scalar x
,
in place.
fn ishl<E: Dimension, S2>(&mut self, rhs: &ArrayBase<S2, E>) where A: Clone + Shl<A, Output=A>, S2: Data<Elem=A>
Perform elementwise
left shift
between self
and rhs
,
in place.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
fn ishl_scalar(&mut self, x: &A) where A: Clone + Shl<A, Output=A>
Perform elementwise
left shift
between self
and the scalar x
,
in place.
fn ishr<E: Dimension, S2>(&mut self, rhs: &ArrayBase<S2, E>) where A: Clone + Shr<A, Output=A>, S2: Data<Elem=A>
Perform elementwise
right shift
between self
and rhs
,
in place.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
fn ishr_scalar(&mut self, x: &A) where A: Clone + Shr<A, Output=A>
Perform elementwise
right shift
between self
and the scalar x
,
in place.
fn ineg(&mut self) where A: Clone + Neg<Output=A>
Perform an elementwise negation of self
, in place.
fn inot(&mut self) where A: Clone + Not<Output=A>
Perform an elementwise unary not of self
, in place.
impl<'a, A, D> ArrayBase<ViewRepr<&'a A>, D> where D: Dimension
[src]
Methods for Array Views
Methods for read-only array views ArrayView<'a, A, D>
Note that array views implement traits like From
and IntoIterator
too.
fn from_slice_dim_stride(dim: D, strides: D, xs: &'a [A]) -> Result<Self, ShapeError>
Create a read-only array view borrowing its data from a slice.
Checks whether dim
and strides
are compatible with the slice's
length, returning an Err
if not compatible.
use ndarray::ArrayView; use ndarray::arr3; let s = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; let a = ArrayView::from_slice_dim_stride((2, 3, 2), (1, 4, 2), &s).unwrap(); assert!( a == arr3(&[[[0, 2], [4, 6], [8, 10]], [[1, 3], [5, 7], [9, 11]]]) ); assert!(a.strides() == &[1, 4, 2]);
fn split_at(self, axis: Axis, index: Ix) -> (Self, Self)
Split the array along axis
and return one view strictly before the
split and one view after the split.
Panics if axis
or index
is out of bounds.
Below, an illustration of .split_at(Axis(2), 2)
on
an array with shape 3 × 5 × 5.
impl<'a, A, D> ArrayBase<ViewRepr<&'a mut A>, D> where D: Dimension
[src]
Methods for read-write array views ArrayViewMut<'a, A, D>
Note that array views implement traits like From
and IntoIterator
too.
fn from_slice_dim_stride(dim: D, strides: D, xs: &'a mut [A]) -> Result<Self, ShapeError>
Create a read-write array view borrowing its data from a slice.
Checks whether dim
and strides
are compatible with the slice's
length, returning an Err
if not compatible.
use ndarray::ArrayViewMut; use ndarray::arr3; let mut s = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]; let mut a = ArrayViewMut::from_slice_dim_stride((2, 3, 2), (1, 4, 2), &mut s).unwrap(); a[[0, 0, 0]] = 1; assert!( a == arr3(&[[[1, 2], [4, 6], [8, 10]], [[1, 3], [5, 7], [9, 11]]]) ); assert!(a.strides() == &[1, 4, 2]);
fn split_at(self, axis: Axis, index: Ix) -> (Self, Self)
Split the array along axis
and return one mutable view strictly
before the split and one mutable view after the split.
Panics if axis
or index
is out of bounds.
Trait Implementations
impl<S, D, I> Index<I> for ArrayBase<S, D> where D: Dimension, I: NdIndex<Dim=D>, S: Data
[src]
Access the element at index.
Panics if index is out of bounds.
type Output = S::Elem
The returned type after indexing
fn index(&self, index: I) -> &S::Elem
The method for the indexing (Foo[Bar]
) operation
impl<S, D, I> IndexMut<I> for ArrayBase<S, D> where D: Dimension, I: NdIndex<Dim=D>, S: DataMut
[src]
Access the element at index mutably.
Panics if index is out of bounds.
fn index_mut(&mut self, index: I) -> &mut S::Elem
The method for the indexing (Foo[Bar]
) operation
impl<S, S2, D> PartialEq<ArrayBase<S2, D>> for ArrayBase<S, D> where D: Dimension, S: Data, S2: Data<Elem=S::Elem>, S::Elem: PartialEq
[src]
Return true
if the array shapes and all elements of self
and
rhs
are equal. Return false
otherwise.
fn eq(&self, rhs: &ArrayBase<S2, D>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl<S, D> Eq for ArrayBase<S, D> where D: Dimension, S: Data, S::Elem: Eq
[src]
impl<A, S> FromIterator<A> for ArrayBase<S, Ix> where S: DataOwned<Elem=A>
[src]
fn from_iter<I>(iterable: I) -> ArrayBase<S, Ix> where I: IntoIterator<Item=A>
Creates a value from an iterator. Read more
impl<'a, S, D> IntoIterator for &'a ArrayBase<S, D> where D: Dimension, S: Data
[src]
type Item = &'a S::Elem
The type of the elements being iterated over.
type IntoIter = Elements<'a, S::Elem, D>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<'a, S, D> IntoIterator for &'a mut ArrayBase<S, D> where D: Dimension, S: DataMut
[src]
type Item = &'a mut S::Elem
The type of the elements being iterated over.
type IntoIter = ElementsMut<'a, S::Elem, D>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
Creates an iterator from a value. Read more
impl<'a, S, D> Hash for ArrayBase<S, D> where D: Dimension, S: Data, S::Elem: Hash
[src]
fn hash<H: Hasher>(&self, state: &mut H)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.
impl<S, D> Sync for ArrayBase<S, D> where S: Sync + Data, D: Sync
[src]
ArrayBase
is Sync
when the storage type is.
impl<S, D> Send for ArrayBase<S, D> where S: Send + Data, D: Send
[src]
ArrayBase
is Send
when the storage type is.
impl<'a, A, Slice: ?Sized> From<&'a Slice> for ArrayBase<ViewRepr<&'a A>, Ix> where Slice: AsRef<[A]>
[src]
Implementation of ArrayView::from(&S)
where S
is a slice or slicable.
Create a one-dimensional read-only array view of the data in slice
.
fn from(slice: &'a Slice) -> Self
Performs the conversion.
impl<'a, A, S, D> From<&'a ArrayBase<S, D>> for ArrayBase<ViewRepr<&'a A>, D> where S: Data<Elem=A>, D: Dimension
[src]
Implementation of ArrayView::from(&A)
where A
is an array.
Create a read-only array view of the array.
impl<'a, A, Slice: ?Sized> From<&'a mut Slice> for ArrayBase<ViewRepr<&'a mut A>, Ix> where Slice: AsMut<[A]>
[src]
Implementation of ArrayViewMut::from(&mut S)
where S
is a slice or slicable.
Create a one-dimensional read-write array view of the data in slice
.
fn from(slice: &'a mut Slice) -> Self
Performs the conversion.
impl<'a, A, S, D> From<&'a mut ArrayBase<S, D>> for ArrayBase<ViewRepr<&'a mut A>, D> where S: DataMut<Elem=A>, D: Dimension
[src]
Implementation of ArrayViewMut::from(&mut A)
where A
is an array.
Create a read-write array view of the array.
impl<'a, A: Display, S, D: Dimension> Display for ArrayBase<S, D> where S: Data<Elem=A>
[src]
Format the array using Display
and apply the formatting parameters used
to each element.
The array is shown in multiline style, unless the alternate form
is used, {:#}
.
impl<'a, A: Debug, S, D: Dimension> Debug for ArrayBase<S, D> where S: Data<Elem=A>
[src]
Format the array using Debug
and apply the formatting parameters used
to each element.
The array is shown in multiline style, unless the alternate form
is used, {:#?}
.
impl<'a, A: LowerExp, S, D: Dimension> LowerExp for ArrayBase<S, D> where S: Data<Elem=A>
[src]
Format the array using LowerExp
and apply the formatting parameters used
to each element.
The array is shown in multiline style, unless the alternate form
is used, {:#e}
.
impl<'a, A: UpperExp, S, D: Dimension> UpperExp for ArrayBase<S, D> where S: Data<Elem=A>
[src]
Format the array using UpperExp
and apply the formatting parameters used
to each element.
The array is shown in multiline style, unless the alternate form
is used, {:#E}
.
impl<'a, A: LowerHex, S, D: Dimension> LowerHex for ArrayBase<S, D> where S: Data<Elem=A>
[src]
Format the array using LowerHex
and apply the formatting parameters used
to each element.
The array is shown in multiline style, unless the alternate form
is used, {:#x}
.
impl<S: DataClone, D: Clone> Clone for ArrayBase<S, D>
[src]
fn clone(&self) -> ArrayBase<S, D>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<S: DataClone + Copy, D: Copy> Copy for ArrayBase<S, D>
[src]
impl<A, S, S2, D, E> Add<ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + Add<A, Output=A>, S: DataOwned<Elem=A> + DataMut, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
addition
between self
and rhs
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the +
operator
fn add(self, rhs: ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the +
operator
impl<'a, A, S, S2, D, E> Add<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + Add<A, Output=A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
addition
between self
and reference rhs
,
and return the result (based on self
).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the +
operator
fn add(self, rhs: &ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the +
operator
impl<'a, 'b, A, S, S2, D, E> Add<&'a ArrayBase<S2, E>> for &'b ArrayBase<S, D> where A: Clone + Add<A, Output=A>, S: Data<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
addition
between references self
and rhs
,
and return the result as a new OwnedArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = OwnedArray<A, D>
The resulting type after applying the +
operator
fn add(self, rhs: &'a ArrayBase<S2, E>) -> OwnedArray<A, D>
The method for the +
operator
impl<A, S, D, B> Add<B> for ArrayBase<S, D> where A: Clone + Add<B, Output=A>, S: DataOwned<Elem=A> + DataMut, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
addition
between self
and the scalar x
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
type Output = ArrayBase<S, D>
The resulting type after applying the +
operator
fn add(self, x: B) -> ArrayBase<S, D>
The method for the +
operator
impl<'a, A, S, D, B> Add<B> for &'a ArrayBase<S, D> where A: Clone + Add<B, Output=A>, S: Data<Elem=A>, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
addition
between the reference self
and the scalar x
,
and return the result as a new OwnedArray
.
type Output = OwnedArray<A, D>
The resulting type after applying the +
operator
fn add(self, x: B) -> OwnedArray<A, D>
The method for the +
operator
impl<A, S, S2, D, E> Sub<ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + Sub<A, Output=A>, S: DataOwned<Elem=A> + DataMut, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
subtraction
between self
and rhs
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the -
operator
fn sub(self, rhs: ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the -
operator
impl<'a, A, S, S2, D, E> Sub<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + Sub<A, Output=A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
subtraction
between self
and reference rhs
,
and return the result (based on self
).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the -
operator
fn sub(self, rhs: &ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the -
operator
impl<'a, 'b, A, S, S2, D, E> Sub<&'a ArrayBase<S2, E>> for &'b ArrayBase<S, D> where A: Clone + Sub<A, Output=A>, S: Data<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
subtraction
between references self
and rhs
,
and return the result as a new OwnedArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = OwnedArray<A, D>
The resulting type after applying the -
operator
fn sub(self, rhs: &'a ArrayBase<S2, E>) -> OwnedArray<A, D>
The method for the -
operator
impl<A, S, D, B> Sub<B> for ArrayBase<S, D> where A: Clone + Sub<B, Output=A>, S: DataOwned<Elem=A> + DataMut, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
subtraction
between self
and the scalar x
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
type Output = ArrayBase<S, D>
The resulting type after applying the -
operator
fn sub(self, x: B) -> ArrayBase<S, D>
The method for the -
operator
impl<'a, A, S, D, B> Sub<B> for &'a ArrayBase<S, D> where A: Clone + Sub<B, Output=A>, S: Data<Elem=A>, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
subtraction
between the reference self
and the scalar x
,
and return the result as a new OwnedArray
.
type Output = OwnedArray<A, D>
The resulting type after applying the -
operator
fn sub(self, x: B) -> OwnedArray<A, D>
The method for the -
operator
impl<A, S, S2, D, E> Mul<ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + Mul<A, Output=A>, S: DataOwned<Elem=A> + DataMut, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
multiplication
between self
and rhs
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the *
operator
fn mul(self, rhs: ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the *
operator
impl<'a, A, S, S2, D, E> Mul<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + Mul<A, Output=A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
multiplication
between self
and reference rhs
,
and return the result (based on self
).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the *
operator
fn mul(self, rhs: &ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the *
operator
impl<'a, 'b, A, S, S2, D, E> Mul<&'a ArrayBase<S2, E>> for &'b ArrayBase<S, D> where A: Clone + Mul<A, Output=A>, S: Data<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
multiplication
between references self
and rhs
,
and return the result as a new OwnedArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = OwnedArray<A, D>
The resulting type after applying the *
operator
fn mul(self, rhs: &'a ArrayBase<S2, E>) -> OwnedArray<A, D>
The method for the *
operator
impl<A, S, D, B> Mul<B> for ArrayBase<S, D> where A: Clone + Mul<B, Output=A>, S: DataOwned<Elem=A> + DataMut, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
multiplication
between self
and the scalar x
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
type Output = ArrayBase<S, D>
The resulting type after applying the *
operator
fn mul(self, x: B) -> ArrayBase<S, D>
The method for the *
operator
impl<'a, A, S, D, B> Mul<B> for &'a ArrayBase<S, D> where A: Clone + Mul<B, Output=A>, S: Data<Elem=A>, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
multiplication
between the reference self
and the scalar x
,
and return the result as a new OwnedArray
.
type Output = OwnedArray<A, D>
The resulting type after applying the *
operator
fn mul(self, x: B) -> OwnedArray<A, D>
The method for the *
operator
impl<A, S, S2, D, E> Div<ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + Div<A, Output=A>, S: DataOwned<Elem=A> + DataMut, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
division
between self
and rhs
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the /
operator
fn div(self, rhs: ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the /
operator
impl<'a, A, S, S2, D, E> Div<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + Div<A, Output=A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
division
between self
and reference rhs
,
and return the result (based on self
).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the /
operator
fn div(self, rhs: &ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the /
operator
impl<'a, 'b, A, S, S2, D, E> Div<&'a ArrayBase<S2, E>> for &'b ArrayBase<S, D> where A: Clone + Div<A, Output=A>, S: Data<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
division
between references self
and rhs
,
and return the result as a new OwnedArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = OwnedArray<A, D>
The resulting type after applying the /
operator
fn div(self, rhs: &'a ArrayBase<S2, E>) -> OwnedArray<A, D>
The method for the /
operator
impl<A, S, D, B> Div<B> for ArrayBase<S, D> where A: Clone + Div<B, Output=A>, S: DataOwned<Elem=A> + DataMut, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
division
between self
and the scalar x
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
type Output = ArrayBase<S, D>
The resulting type after applying the /
operator
fn div(self, x: B) -> ArrayBase<S, D>
The method for the /
operator
impl<'a, A, S, D, B> Div<B> for &'a ArrayBase<S, D> where A: Clone + Div<B, Output=A>, S: Data<Elem=A>, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
division
between the reference self
and the scalar x
,
and return the result as a new OwnedArray
.
type Output = OwnedArray<A, D>
The resulting type after applying the /
operator
fn div(self, x: B) -> OwnedArray<A, D>
The method for the /
operator
impl<A, S, S2, D, E> Rem<ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + Rem<A, Output=A>, S: DataOwned<Elem=A> + DataMut, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
remainder
between self
and rhs
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the %
operator
fn rem(self, rhs: ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the %
operator
impl<'a, A, S, S2, D, E> Rem<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + Rem<A, Output=A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
remainder
between self
and reference rhs
,
and return the result (based on self
).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the %
operator
fn rem(self, rhs: &ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the %
operator
impl<'a, 'b, A, S, S2, D, E> Rem<&'a ArrayBase<S2, E>> for &'b ArrayBase<S, D> where A: Clone + Rem<A, Output=A>, S: Data<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
remainder
between references self
and rhs
,
and return the result as a new OwnedArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = OwnedArray<A, D>
The resulting type after applying the %
operator
fn rem(self, rhs: &'a ArrayBase<S2, E>) -> OwnedArray<A, D>
The method for the %
operator
impl<A, S, D, B> Rem<B> for ArrayBase<S, D> where A: Clone + Rem<B, Output=A>, S: DataOwned<Elem=A> + DataMut, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
remainder
between self
and the scalar x
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
type Output = ArrayBase<S, D>
The resulting type after applying the %
operator
fn rem(self, x: B) -> ArrayBase<S, D>
The method for the %
operator
impl<'a, A, S, D, B> Rem<B> for &'a ArrayBase<S, D> where A: Clone + Rem<B, Output=A>, S: Data<Elem=A>, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
remainder
between the reference self
and the scalar x
,
and return the result as a new OwnedArray
.
type Output = OwnedArray<A, D>
The resulting type after applying the %
operator
fn rem(self, x: B) -> OwnedArray<A, D>
The method for the %
operator
impl<A, S, S2, D, E> BitAnd<ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + BitAnd<A, Output=A>, S: DataOwned<Elem=A> + DataMut, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
bit and
between self
and rhs
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the &
operator
fn bitand(self, rhs: ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the &
operator
impl<'a, A, S, S2, D, E> BitAnd<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + BitAnd<A, Output=A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
bit and
between self
and reference rhs
,
and return the result (based on self
).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the &
operator
fn bitand(self, rhs: &ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the &
operator
impl<'a, 'b, A, S, S2, D, E> BitAnd<&'a ArrayBase<S2, E>> for &'b ArrayBase<S, D> where A: Clone + BitAnd<A, Output=A>, S: Data<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
bit and
between references self
and rhs
,
and return the result as a new OwnedArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = OwnedArray<A, D>
The resulting type after applying the &
operator
fn bitand(self, rhs: &'a ArrayBase<S2, E>) -> OwnedArray<A, D>
The method for the &
operator
impl<A, S, D, B> BitAnd<B> for ArrayBase<S, D> where A: Clone + BitAnd<B, Output=A>, S: DataOwned<Elem=A> + DataMut, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
bit and
between self
and the scalar x
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
type Output = ArrayBase<S, D>
The resulting type after applying the &
operator
fn bitand(self, x: B) -> ArrayBase<S, D>
The method for the &
operator
impl<'a, A, S, D, B> BitAnd<B> for &'a ArrayBase<S, D> where A: Clone + BitAnd<B, Output=A>, S: Data<Elem=A>, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
bit and
between the reference self
and the scalar x
,
and return the result as a new OwnedArray
.
type Output = OwnedArray<A, D>
The resulting type after applying the &
operator
fn bitand(self, x: B) -> OwnedArray<A, D>
The method for the &
operator
impl<A, S, S2, D, E> BitOr<ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + BitOr<A, Output=A>, S: DataOwned<Elem=A> + DataMut, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
bit or
between self
and rhs
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the |
operator
fn bitor(self, rhs: ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the |
operator
impl<'a, A, S, S2, D, E> BitOr<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + BitOr<A, Output=A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
bit or
between self
and reference rhs
,
and return the result (based on self
).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the |
operator
fn bitor(self, rhs: &ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the |
operator
impl<'a, 'b, A, S, S2, D, E> BitOr<&'a ArrayBase<S2, E>> for &'b ArrayBase<S, D> where A: Clone + BitOr<A, Output=A>, S: Data<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
bit or
between references self
and rhs
,
and return the result as a new OwnedArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = OwnedArray<A, D>
The resulting type after applying the |
operator
fn bitor(self, rhs: &'a ArrayBase<S2, E>) -> OwnedArray<A, D>
The method for the |
operator
impl<A, S, D, B> BitOr<B> for ArrayBase<S, D> where A: Clone + BitOr<B, Output=A>, S: DataOwned<Elem=A> + DataMut, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
bit or
between self
and the scalar x
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
type Output = ArrayBase<S, D>
The resulting type after applying the |
operator
fn bitor(self, x: B) -> ArrayBase<S, D>
The method for the |
operator
impl<'a, A, S, D, B> BitOr<B> for &'a ArrayBase<S, D> where A: Clone + BitOr<B, Output=A>, S: Data<Elem=A>, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
bit or
between the reference self
and the scalar x
,
and return the result as a new OwnedArray
.
type Output = OwnedArray<A, D>
The resulting type after applying the |
operator
fn bitor(self, x: B) -> OwnedArray<A, D>
The method for the |
operator
impl<A, S, S2, D, E> BitXor<ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + BitXor<A, Output=A>, S: DataOwned<Elem=A> + DataMut, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
bit xor
between self
and rhs
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the ^
operator
fn bitxor(self, rhs: ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the ^
operator
impl<'a, A, S, S2, D, E> BitXor<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + BitXor<A, Output=A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
bit xor
between self
and reference rhs
,
and return the result (based on self
).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the ^
operator
fn bitxor(self, rhs: &ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the ^
operator
impl<'a, 'b, A, S, S2, D, E> BitXor<&'a ArrayBase<S2, E>> for &'b ArrayBase<S, D> where A: Clone + BitXor<A, Output=A>, S: Data<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
bit xor
between references self
and rhs
,
and return the result as a new OwnedArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = OwnedArray<A, D>
The resulting type after applying the ^
operator
fn bitxor(self, rhs: &'a ArrayBase<S2, E>) -> OwnedArray<A, D>
The method for the ^
operator
impl<A, S, D, B> BitXor<B> for ArrayBase<S, D> where A: Clone + BitXor<B, Output=A>, S: DataOwned<Elem=A> + DataMut, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
bit xor
between self
and the scalar x
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
type Output = ArrayBase<S, D>
The resulting type after applying the ^
operator
fn bitxor(self, x: B) -> ArrayBase<S, D>
The method for the ^
operator
impl<'a, A, S, D, B> BitXor<B> for &'a ArrayBase<S, D> where A: Clone + BitXor<B, Output=A>, S: Data<Elem=A>, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
bit xor
between the reference self
and the scalar x
,
and return the result as a new OwnedArray
.
type Output = OwnedArray<A, D>
The resulting type after applying the ^
operator
fn bitxor(self, x: B) -> OwnedArray<A, D>
The method for the ^
operator
impl<A, S, S2, D, E> Shl<ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + Shl<A, Output=A>, S: DataOwned<Elem=A> + DataMut, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
left shift
between self
and rhs
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the <<
operator
fn shl(self, rhs: ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the <<
operator
impl<'a, A, S, S2, D, E> Shl<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + Shl<A, Output=A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
left shift
between self
and reference rhs
,
and return the result (based on self
).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the <<
operator
fn shl(self, rhs: &ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the <<
operator
impl<'a, 'b, A, S, S2, D, E> Shl<&'a ArrayBase<S2, E>> for &'b ArrayBase<S, D> where A: Clone + Shl<A, Output=A>, S: Data<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
left shift
between references self
and rhs
,
and return the result as a new OwnedArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = OwnedArray<A, D>
The resulting type after applying the <<
operator
fn shl(self, rhs: &'a ArrayBase<S2, E>) -> OwnedArray<A, D>
The method for the <<
operator
impl<A, S, D, B> Shl<B> for ArrayBase<S, D> where A: Clone + Shl<B, Output=A>, S: DataOwned<Elem=A> + DataMut, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
left shift
between self
and the scalar x
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
type Output = ArrayBase<S, D>
The resulting type after applying the <<
operator
fn shl(self, x: B) -> ArrayBase<S, D>
The method for the <<
operator
impl<'a, A, S, D, B> Shl<B> for &'a ArrayBase<S, D> where A: Clone + Shl<B, Output=A>, S: Data<Elem=A>, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
left shift
between the reference self
and the scalar x
,
and return the result as a new OwnedArray
.
type Output = OwnedArray<A, D>
The resulting type after applying the <<
operator
fn shl(self, x: B) -> OwnedArray<A, D>
The method for the <<
operator
impl<A, S, S2, D, E> Shr<ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + Shr<A, Output=A>, S: DataOwned<Elem=A> + DataMut, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
right shift
between self
and rhs
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the >>
operator
fn shr(self, rhs: ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the >>
operator
impl<'a, A, S, S2, D, E> Shr<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + Shr<A, Output=A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
right shift
between self
and reference rhs
,
and return the result (based on self
).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = ArrayBase<S, D>
The resulting type after applying the >>
operator
fn shr(self, rhs: &ArrayBase<S2, E>) -> ArrayBase<S, D>
The method for the >>
operator
impl<'a, 'b, A, S, S2, D, E> Shr<&'a ArrayBase<S2, E>> for &'b ArrayBase<S, D> where A: Clone + Shr<A, Output=A>, S: Data<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform elementwise
right shift
between references self
and rhs
,
and return the result as a new OwnedArray
.
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
type Output = OwnedArray<A, D>
The resulting type after applying the >>
operator
fn shr(self, rhs: &'a ArrayBase<S2, E>) -> OwnedArray<A, D>
The method for the >>
operator
impl<A, S, D, B> Shr<B> for ArrayBase<S, D> where A: Clone + Shr<B, Output=A>, S: DataOwned<Elem=A> + DataMut, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
right shift
between self
and the scalar x
,
and return the result (based on self
).
self
must be an OwnedArray
or RcArray
.
type Output = ArrayBase<S, D>
The resulting type after applying the >>
operator
fn shr(self, x: B) -> ArrayBase<S, D>
The method for the >>
operator
impl<'a, A, S, D, B> Shr<B> for &'a ArrayBase<S, D> where A: Clone + Shr<B, Output=A>, S: Data<Elem=A>, D: Dimension, B: ScalarOperand
[src]
Perform elementwise
right shift
between the reference self
and the scalar x
,
and return the result as a new OwnedArray
.
type Output = OwnedArray<A, D>
The resulting type after applying the >>
operator
fn shr(self, x: B) -> OwnedArray<A, D>
The method for the >>
operator
impl<A, S, D> Neg for ArrayBase<S, D> where A: Clone + Neg<Output=A>, S: DataMut<Elem=A>, D: Dimension
[src]
type Output = Self
The resulting type after applying the -
operator
fn neg(self) -> Self
Perform an elementwise negation of self
and return the result.
impl<A, S, D> Not for ArrayBase<S, D> where A: Clone + Not<Output=A>, S: DataMut<Elem=A>, D: Dimension
[src]
type Output = Self
The resulting type after applying the !
operator
fn not(self) -> Self
Perform an elementwise unary not of self
and return the result.
impl<'a, A, S, S2, D, E> AddAssign<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + AddAssign<A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform self += rhs
as elementwise addition (in place).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
Requires crate feature "assign_ops"
fn add_assign(&mut self, rhs: &ArrayBase<S2, E>)
The method for the +=
operator
impl<A, S, D> AddAssign<A> for ArrayBase<S, D> where A: ScalarOperand + AddAssign<A>, S: DataMut<Elem=A>, D: Dimension
[src]
Perform self += rhs
as elementwise addition (in place).
Requires crate feature "assign_ops"
fn add_assign(&mut self, rhs: A)
The method for the +=
operator
impl<'a, A, S, S2, D, E> SubAssign<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + SubAssign<A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform self -= rhs
as elementwise subtraction (in place).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
Requires crate feature "assign_ops"
fn sub_assign(&mut self, rhs: &ArrayBase<S2, E>)
The method for the -=
operator
impl<A, S, D> SubAssign<A> for ArrayBase<S, D> where A: ScalarOperand + SubAssign<A>, S: DataMut<Elem=A>, D: Dimension
[src]
Perform self -= rhs
as elementwise subtraction (in place).
Requires crate feature "assign_ops"
fn sub_assign(&mut self, rhs: A)
The method for the -=
operator
impl<'a, A, S, S2, D, E> MulAssign<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + MulAssign<A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform self *= rhs
as elementwise multiplication (in place).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
Requires crate feature "assign_ops"
fn mul_assign(&mut self, rhs: &ArrayBase<S2, E>)
The method for the *=
operator
impl<A, S, D> MulAssign<A> for ArrayBase<S, D> where A: ScalarOperand + MulAssign<A>, S: DataMut<Elem=A>, D: Dimension
[src]
Perform self *= rhs
as elementwise multiplication (in place).
Requires crate feature "assign_ops"
fn mul_assign(&mut self, rhs: A)
The method for the *=
operator
impl<'a, A, S, S2, D, E> DivAssign<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + DivAssign<A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform self /= rhs
as elementwise division (in place).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
Requires crate feature "assign_ops"
fn div_assign(&mut self, rhs: &ArrayBase<S2, E>)
The method for the /=
operator
impl<A, S, D> DivAssign<A> for ArrayBase<S, D> where A: ScalarOperand + DivAssign<A>, S: DataMut<Elem=A>, D: Dimension
[src]
Perform self /= rhs
as elementwise division (in place).
Requires crate feature "assign_ops"
fn div_assign(&mut self, rhs: A)
The method for the /=
operator
impl<'a, A, S, S2, D, E> RemAssign<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + RemAssign<A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform self %= rhs
as elementwise remainder (in place).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
Requires crate feature "assign_ops"
fn rem_assign(&mut self, rhs: &ArrayBase<S2, E>)
The method for the %=
operator
impl<A, S, D> RemAssign<A> for ArrayBase<S, D> where A: ScalarOperand + RemAssign<A>, S: DataMut<Elem=A>, D: Dimension
[src]
Perform self %= rhs
as elementwise remainder (in place).
Requires crate feature "assign_ops"
fn rem_assign(&mut self, rhs: A)
The method for the %=
operator
impl<'a, A, S, S2, D, E> BitAndAssign<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + BitAndAssign<A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform self &= rhs
as elementwise bit and (in place).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
Requires crate feature "assign_ops"
fn bitand_assign(&mut self, rhs: &ArrayBase<S2, E>)
The method for the &
operator
impl<A, S, D> BitAndAssign<A> for ArrayBase<S, D> where A: ScalarOperand + BitAndAssign<A>, S: DataMut<Elem=A>, D: Dimension
[src]
Perform self &= rhs
as elementwise bit and (in place).
Requires crate feature "assign_ops"
fn bitand_assign(&mut self, rhs: A)
The method for the &
operator
impl<'a, A, S, S2, D, E> BitOrAssign<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + BitOrAssign<A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform self |= rhs
as elementwise bit or (in place).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
Requires crate feature "assign_ops"
fn bitor_assign(&mut self, rhs: &ArrayBase<S2, E>)
The method for the |=
operator
impl<A, S, D> BitOrAssign<A> for ArrayBase<S, D> where A: ScalarOperand + BitOrAssign<A>, S: DataMut<Elem=A>, D: Dimension
[src]
Perform self |= rhs
as elementwise bit or (in place).
Requires crate feature "assign_ops"
fn bitor_assign(&mut self, rhs: A)
The method for the |=
operator
impl<'a, A, S, S2, D, E> BitXorAssign<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + BitXorAssign<A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform self ^= rhs
as elementwise bit xor (in place).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
Requires crate feature "assign_ops"
fn bitxor_assign(&mut self, rhs: &ArrayBase<S2, E>)
The method for the ^=
operator
impl<A, S, D> BitXorAssign<A> for ArrayBase<S, D> where A: ScalarOperand + BitXorAssign<A>, S: DataMut<Elem=A>, D: Dimension
[src]
Perform self ^= rhs
as elementwise bit xor (in place).
Requires crate feature "assign_ops"
fn bitxor_assign(&mut self, rhs: A)
The method for the ^=
operator
impl<'a, A, S, S2, D, E> ShlAssign<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + ShlAssign<A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform self <<= rhs
as elementwise left shift (in place).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
Requires crate feature "assign_ops"
fn shl_assign(&mut self, rhs: &ArrayBase<S2, E>)
The method for the <<=
operator
impl<A, S, D> ShlAssign<A> for ArrayBase<S, D> where A: ScalarOperand + ShlAssign<A>, S: DataMut<Elem=A>, D: Dimension
[src]
Perform self <<= rhs
as elementwise left shift (in place).
Requires crate feature "assign_ops"
fn shl_assign(&mut self, rhs: A)
The method for the <<=
operator
impl<'a, A, S, S2, D, E> ShrAssign<&'a ArrayBase<S2, E>> for ArrayBase<S, D> where A: Clone + ShrAssign<A>, S: DataMut<Elem=A>, S2: Data<Elem=A>, D: Dimension, E: Dimension
[src]
Perform self >>= rhs
as elementwise right shift (in place).
If their shapes disagree, rhs
is broadcast to the shape of self
.
Panics if broadcasting isn’t possible.
Requires crate feature "assign_ops"
fn shr_assign(&mut self, rhs: &ArrayBase<S2, E>)
The method for the >>=
operator
impl<A, S, D> ShrAssign<A> for ArrayBase<S, D> where A: ScalarOperand + ShrAssign<A>, S: DataMut<Elem=A>, D: Dimension
[src]
Perform self >>= rhs
as elementwise right shift (in place).
Requires crate feature "assign_ops"
fn shr_assign(&mut self, rhs: A)
The method for the >>=
operator