Tensor

Struct Tensor 

Source
pub struct Tensor<T, S = DynRank, A = Global>
where S: Shape, A: Allocator,
{ /* private fields */ }
Expand description

Dense multidimensional array.

Implementations§

Source§

impl<T, S, A> Tensor<T, S, A>
where S: Shape, A: Allocator,

Source

pub fn append(&mut self, other: &mut Tensor<T, S, A>)

Moves all elements from another array into the array along the first dimension.

If the array is empty, it is reshaped to match the shape of the other array.

§Panics

Panics if the inner dimensions do not match, if the rank is not the same and at least 1, or if the first dimension is not dynamically-sized.

Source

pub fn capacity(&self) -> usize

Returns the number of elements the array can hold without reallocating.

Source

pub fn clear(&mut self)

Clears the array, removing all values.

If the array type has dynamic rank, the rank is set to 1.

Note that this method has no effect on the allocated capacity of the array.

§Panics

Panics if the default array length for the layout mapping is not zero.

Source

pub fn drain<R>(&mut self, range: R) -> IntoExpr<Drain<'_, T, S, A>>
where R: RangeBounds<usize>,

Removes the specified range from the array along the first dimension, and returns the removed range as an expression.

§Panics

Panics if the rank is not at least 1, or if the first dimension is not dynamically-sized.

Source

pub fn expand<I>(&mut self, expr: I)

Appends an expression to the array along the first dimension with broadcasting, cloning elements if needed.

If the array is empty, it is reshaped to match the shape of the expression.

§Panics

Panics if the inner dimensions do not match, if the rank is not the same and at least 1, or if the first dimension is not dynamically-sized.

Source

pub fn into_dyn(self) -> Tensor<T, DynRank, A>

Converts the array into an array with dynamic rank.

Source

pub fn into_flat(self) -> Tensor<T, (usize,), A>

Converts the array into a one-dimensional array.

Source

pub fn into_mapping<R>(self) -> Tensor<T, R, A>
where R: Shape,

Converts the array into a remapped array.

§Panics

Panics if the shape is not matching static rank or constant-sized dimensions.

Source

pub fn into_scalar(self) -> T

Converts an array with a single element into the contained value.

§Panics

Panics if the array length is not equal to one.

Source

pub fn into_shape<I>( self, shape: I, ) -> Tensor<T, <I as IntoShape>::IntoShape, A>
where I: IntoShape,

Converts the array into a reshaped array, which must have the same length.

At most one dimension can have dynamic size usize::MAX, and is then inferred from the other dimensions and the array length.

§Examples
use mdarray::{tensor, view};

let t = tensor![[1, 2, 3], [4, 5, 6]];

assert_eq!(t.into_shape([!0, 2]), view![[1, 2], [3, 4], [5, 6]]);
§Panics

Panics if the array length is changed.

Source

pub fn into_vec(self) -> Vec<T>

Converts the array into a vector.

Source

pub fn map<F>(self, f: F) -> Tensor<T, S, A>
where F: FnMut(T) -> T,

Returns the array with the given closure applied to each element.

Source

pub fn reserve(&mut self, additional: usize)

Reserves capacity for at least the additional number of elements in the array.

Source

pub fn reserve_exact(&mut self, additional: usize)

Reserves the minimum capacity for the additional number of elements in the array.

Source

pub fn resize(&mut self, new_dims: &[usize], value: T)
where T: Clone, A: Clone,

Resizes the array to the new shape, creating new elements with the given value.

Source

pub fn resize_with<F>(&mut self, new_dims: &[usize], f: F)
where F: FnMut() -> T, A: Clone,

Resizes the array to the new shape, creating new elements from the given closure.

Source

pub unsafe fn set_mapping(&mut self, new_mapping: DenseMapping<S>)

Forces the array layout mapping to the new mapping.

§Safety

All elements within the array length must be initialized.

Source

pub fn shrink_to(&mut self, min_capacity: usize)

Shrinks the capacity of the array with a lower bound.

Source

pub fn shrink_to_fit(&mut self)

Shrinks the capacity of the array as much as possible.

Source

pub fn spare_capacity_mut(&mut self) -> &mut [MaybeUninit<T>]

Returns the remaining spare capacity of the array as a slice of MaybeUninit<T>.

The returned slice can be used to fill the array with data, before marking the data as initialized using the set_shape method.

Source

pub fn truncate(&mut self, size: usize)

Shortens the array along the first dimension, keeping the first size indices.

If size is greater or equal to the current dimension size, this has no effect.

Note that this method has no effect on the allocated capacity of the array.

§Panics

Panics if the rank is not at least 1, or if the first dimension is not dynamically-sized.

Source

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>

Tries to reserve capacity for at least the additional number of elements in the array.

§Errors

If the capacity overflows, or the allocator reports a failure, then an error is returned.

Source

pub fn try_reserve_exact( &mut self, additional: usize, ) -> Result<(), TryReserveError>

Tries to reserve the minimum capacity for the additional number of elements in the array.

§Errors

If the capacity overflows, or the allocator reports a failure, then an error is returned.

Source§

impl<T, S> Tensor<T, S>
where S: Shape,

Source

pub fn from_elem<I>(shape: I, elem: T) -> Tensor<T, S>
where I: IntoShape<IntoShape = S>, T: Clone,

Creates an array from the given element.

Source

pub fn from_fn<I, F>(shape: I, f: F) -> Tensor<T, S>
where I: IntoShape<IntoShape = S>, F: FnMut(&[usize]) -> T,

Creates an array with the results from the given function.

Source

pub unsafe fn from_raw_parts( ptr: *mut T, mapping: DenseMapping<S>, capacity: usize, ) -> Tensor<T, S>

Creates an array from raw components of another array.

§Safety

The pointer must be a valid allocation given the shape and capacity.

Source

pub fn into_raw_parts(self) -> (*mut T, DenseMapping<S>, usize)

Decomposes an array into its raw components.

Source

pub fn new() -> Tensor<T, S>

Creates a new, empty array.

§Panics

Panics if the default array length for the layout mapping is not zero.

Source

pub fn uninit<I>(shape: I) -> Tensor<MaybeUninit<T>, S>
where I: IntoShape<IntoShape = S>,

Creates an array with uninitialized elements.

Source

pub fn with_capacity(capacity: usize) -> Tensor<T, S>

Creates a new, empty array with the specified capacity.

§Panics

Panics if the default array length for the layout mapping is not zero.

Source

pub fn zeros<I>(shape: I) -> Tensor<T, S>
where I: IntoShape<IntoShape = S>, T: Default,

Creates an array with elements set to zero.

Zero elements are created using Default::default().

Source§

impl<T, S, A> Tensor<MaybeUninit<T>, S, A>
where S: Shape, A: Allocator,

Source

pub unsafe fn assume_init(self) -> Tensor<T, S, A>

Converts the array element type from MaybeUninit<T> to T.

§Safety

All elements in the array must be initialized, or the behavior is undefined.

Methods from Deref<Target = Slice<T, S>>§

Source

pub fn as_mut_ptr(&mut self) -> *mut T

Returns a mutable pointer to the array buffer.

Source

pub fn as_ptr(&self) -> *const T

Returns a raw pointer to the array buffer.

Source

pub fn assign<I>(&mut self, expr: I)

Assigns an expression to the array slice with broadcasting, cloning elements if needed.

§Panics

Panics if the expression cannot be broadcast to the shape of the array slice.

Source

pub fn at(&self, index: usize) -> View<'_, T, <S as Shape>::Tail, L>

Returns an array view after indexing the first dimension.

§Panics

Panics if the index is out of bounds, or if the rank is not at least 1.

Source

pub fn at_mut(&mut self, index: usize) -> ViewMut<'_, T, <S as Shape>::Tail, L>

Returns a mutable array view after indexing the first dimension.

§Panics

Panics if the index is out of bounds, or if the rank is not at least 1.

Source

pub fn axis_at<A>( &self, axis: A, index: usize, ) -> View<'_, T, <A as Axis>::Remove<S>, <<A as Axis>::Init<S> as Shape>::Layout<L>>
where A: Axis,

Returns an array view after indexing the specified dimension.

If the dimension to be indexed is know at compile time, the resulting array shape will maintain constant-sized dimensions. Furthermore, if it is the first dimension the resulting array view has the same layout as the input.

§Panics

Panics if the dimension or the index is out of bounds.

Source

pub fn axis_at_mut<A>( &mut self, axis: A, index: usize, ) -> ViewMut<'_, T, <A as Axis>::Remove<S>, <<A as Axis>::Init<S> as Shape>::Layout<L>>
where A: Axis,

Returns a mutable array view after indexing the specified dimension.

If the dimension to be indexed is know at compile time, the resulting array shape will maintain constant-sized dimensions. Furthermore, if it is the first dimension the resulting array view has the same layout as the input.

§Panics

Panics if the dimension or the index is out of bounds.

Source

pub fn axis_expr<A>(&self, axis: A) -> AxisExpr<'_, T, S, L, A>
where A: Axis,

Returns an expression that gives array views iterating over the specified dimension.

If the dimension to be iterated over is know at compile time, the resulting array shape will maintain constant-sized dimensions. Furthermore, if it is the first dimension the resulting array views have the same layout as the input.

§Panics

Panics if the dimension is out of bounds.

Source

pub fn axis_expr_mut<A>(&mut self, axis: A) -> AxisExprMut<'_, T, S, L, A>
where A: Axis,

Returns a mutable expression that gives array views iterating over the specified dimension.

If the dimension to be iterated over is know at compile time, the resulting array shape will maintain constant-sized dimensions. Furthermore, if it is the first dimension the resulting array views have the same layout as the input.

§Panics

Panics if the dimension is out of bounds.

Source

pub fn col(&self, index: usize) -> View<'_, T, (<S as Shape>::Head,), Strided>

Returns an array view for the specified column.

§Panics

Panics if the rank is not equal to 2, or if the index is out of bounds.

Source

pub fn col_mut( &mut self, index: usize, ) -> ViewMut<'_, T, (<S as Shape>::Head,), Strided>

Returns a mutable array view for the specified column.

§Panics

Panics if the rank is not equal to 2, or if the index is out of bounds.

Source

pub fn cols(&self) -> Lanes<'_, T, S, L, Cols>

Returns an expression that gives column views iterating over the other dimensions.

§Panics

Panics if the rank is not at least 2.

Source

pub fn cols_mut(&mut self) -> LanesMut<'_, T, S, L, Cols>

Returns a mutable expression that gives column views iterating over the other dimensions.

§Panics

Panics if the rank is not at least 2.

Source

pub fn contains(&self, x: &T) -> bool
where T: PartialEq,

Returns true if the array slice contains an element with the given value.

Source

pub fn diag(&self, index: isize) -> View<'_, T, (usize,), Strided>

Returns an array view for the given diagonal of the array slice, where index > 0 is above and index < 0 is below the main diagonal.

§Panics

Panics if the rank is not equal to 2, or if the absolute index is larger than the number of columns or rows.

Source

pub fn diag_mut(&mut self, index: isize) -> ViewMut<'_, T, (usize,), Strided>

Returns a mutable array view for the given diagonal of the array slice, where index > 0 is above and index < 0 is below the main diagonal.

§Panics

Panics if the rank is not equal to 2, or if the absolute index is larger than the number of columns or rows.

Source

pub fn dim(&self, index: usize) -> usize

Returns the number of elements in the specified dimension.

§Panics

Panics if the dimension is out of bounds.

Source

pub fn expr(&self) -> View<'_, T, S, L>

Returns an expression over the array slice.

Source

pub fn expr_mut(&mut self) -> ViewMut<'_, T, S, L>

Returns a mutable expression over the array slice.

Source

pub fn fill(&mut self, value: T)
where T: Clone,

Fills the array slice with elements by cloning value.

Source

pub fn fill_with<F>(&mut self, f: F)
where F: FnMut() -> T,

Fills the array slice with elements returned by calling a closure repeatedly.

Source

pub fn flatten(&self) -> View<'_, T, (usize,), L>

Returns a one-dimensional array view of the array slice.

§Panics

Panics if the array layout is not uniformly strided.

Source

pub fn flatten_mut(&mut self) -> ViewMut<'_, T, (usize,), L>

Returns a mutable one-dimensional array view over the array slice.

§Panics

Panics if the array layout is not uniformly strided.

Source

pub unsafe fn get_unchecked<I>( &self, index: I, ) -> &<I as SliceIndex<T, S, L>>::Output
where I: SliceIndex<T, S, L>,

Returns a reference to an element or a subslice, without doing bounds checking.

§Safety

The index must be within bounds of the array slice.

Source

pub unsafe fn get_unchecked_mut<I>( &mut self, index: I, ) -> &mut <I as SliceIndex<T, S, L>>::Output
where I: SliceIndex<T, S, L>,

Returns a mutable reference to an element or a subslice, without doing bounds checking.

§Safety

The index must be within bounds of the array slice.

Source

pub fn is_contiguous(&self) -> bool

Returns true if the array strides are consistent with contiguous memory layout.

Source

pub fn is_empty(&self) -> bool

Returns true if the array contains no elements.

Source

pub fn iter(&self) -> Iter<View<'_, T, S, L>>

Returns an iterator over the array slice.

Source

pub fn iter_mut(&mut self) -> Iter<ViewMut<'_, T, S, L>>

Returns a mutable iterator over the array slice.

Source

pub fn lanes<A>(&self, axis: A) -> Lanes<'_, T, S, L, A>
where A: Axis,

Returns an expression that gives array views over the specified dimension, iterating over the other dimensions.

If the dimension to give array views over is know at compile time, the resulting shape will maintain a constant-sized dimension. Furthermore, if it is the last dimension the resulting array views have the same layout as the input.

§Panics

Panics if the dimension is out of bounds.

Source

pub fn lanes_mut<A>(&mut self, axis: A) -> LanesMut<'_, T, S, L, A>
where A: Axis,

Returns a mutable expression that gives array views over the specified dimension, iterating over the other dimensions.

If the dimension to give array views over is know at compile time, the resulting shape will maintain a constant-sized dimension. Furthermore, if it is the last dimension the resulting array views have the same layout as the input.

§Panics

Panics if the dimension is out of bounds.

Source

pub fn len(&self) -> usize

Returns the number of elements in the array.

Source

pub fn mapping(&self) -> &<L as Layout>::Mapping<S>

Returns the array layout mapping.

Source

pub fn outer_expr(&self) -> AxisExpr<'_, T, S, L, Const<0>>

Returns an expression that gives array views iterating over the first dimension.

Iterating over the first dimension results in array views with the same layout as the input.

§Panics

Panics if the rank is not at least 1.

Source

pub fn outer_expr_mut(&mut self) -> AxisExprMut<'_, T, S, L, Const<0>>

Returns a mutable expression that gives array views iterating over the first dimension.

Iterating over the first dimension results in array views with the same layout as the input.

§Panics

Panics if the rank is not at least 1.

Source

pub fn permute<I>( &self, perm: I, ) -> View<'_, T, <<I as IntoShape>::IntoShape as Permutation>::Shape<S>, <<I as IntoShape>::IntoShape as Permutation>::Layout<L>>

Returns an array view with the dimensions permuted.

If the permutation is an identity permutation and known at compile time, the resulting array view has the same layout as the input. For example, permuting with (Const::<0>, Const::<1>) will maintain the layout while permuting with [0, 1] gives strided layout.

§Panics

Panics if the permutation is not valid.

Source

pub fn permute_mut<I>( &mut self, perm: I, ) -> ViewMut<'_, T, <<I as IntoShape>::IntoShape as Permutation>::Shape<S>, <<I as IntoShape>::IntoShape as Permutation>::Layout<L>>

Returns a mutable array view with the dimensions permuted.

If the permutation is an identity permutation and known at compile time, the resulting array view has the same layout as the input. For example, permuting with (Const::<0>, Const::<1>) will maintain the layout while permuting with [0, 1] gives strided layout.

§Panics

Panics if the permutation is not valid.

Source

pub fn rank(&self) -> usize

Returns the array rank, i.e. the number of dimensions.

Source

pub fn remap<R, K>(&self) -> View<'_, T, R, K>
where R: Shape, K: Layout,

Returns a remapped array view of the array slice.

§Panics

Panics if the memory layout is not compatible with the new array layout.

Source

pub fn remap_mut<R, K>(&mut self) -> ViewMut<'_, T, R, K>
where R: Shape, K: Layout,

Returns a mutable remapped array view of the array slice.

§Panics

Panics if the memory layout is not compatible with the new array layout.

Source

pub fn reorder( &self, ) -> View<'_, T, <S as Shape>::Reverse, <<S as Shape>::Tail as Shape>::Layout<L>>

👎Deprecated

Returns a reordered array view of the array slice.

This method is deprecated, use transpose instead.

Source

pub fn reorder_mut( &mut self, ) -> ViewMut<'_, T, <S as Shape>::Reverse, <<S as Shape>::Tail as Shape>::Layout<L>>

👎Deprecated

Returns a mutable reordered array view of the array slice.

This method is deprecated, use transpose_mut instead.

Source

pub fn reshape<I>( &self, shape: I, ) -> View<'_, T, <I as IntoShape>::IntoShape, L>
where I: IntoShape,

Returns a reshaped array view of the array slice.

At most one dimension can have dynamic size usize::MAX, and is then inferred from the other dimensions and the array length.

§Examples
use mdarray::view;

let v = view![[1, 2, 3], [4, 5, 6]];

assert_eq!(v.reshape([!0, 2]), view![[1, 2], [3, 4], [5, 6]]);
§Panics

Panics if the array length is changed, or if the memory layout is not compatible.

Source

pub fn reshape_mut<I>( &mut self, shape: I, ) -> ViewMut<'_, T, <I as IntoShape>::IntoShape, L>
where I: IntoShape,

Returns a mutable reshaped array view of the array slice.

At most one dimension can have dynamic size usize::MAX, and is then inferred from the other dimensions and the array length.

See the reshape method above for examples.

§Panics

Panics if the array length is changed, or if the memory layout is not compatible.

Source

pub fn row( &self, index: usize, ) -> View<'_, T, (<<S as Shape>::Tail as Shape>::Head,), L>

Returns an array view for the specified row.

§Panics

Panics if the rank is not equal to 2, or if the index is out of bounds.

Source

pub fn row_mut( &mut self, index: usize, ) -> ViewMut<'_, T, (<<S as Shape>::Tail as Shape>::Head,), L>

Returns a mutable array view for the specified row.

§Panics

Panics if the rank is not equal to 2, or if the index is out of bounds.

Source

pub fn rows(&self) -> Lanes<'_, T, S, L, Rows>

Returns an expression that gives row views iterating over the other dimensions.

§Panics

Panics if the rank is not at least 1.

Source

pub fn rows_mut(&mut self) -> LanesMut<'_, T, S, L, Rows>

Returns a mutable expression that gives row views iterating over the other dimensions.

§Panics

Panics if the rank is not at least 1.

Source

pub fn shape(&self) -> &S

Returns the array shape.

Source

pub fn split_at( &self, mid: usize, ) -> (View<'_, T, <Const<0> as Axis>::Insert<usize, <Const<0> as Axis>::Remove<S>>, L>, View<'_, T, <Const<0> as Axis>::Insert<usize, <Const<0> as Axis>::Remove<S>>, L>)

Divides an array slice into two at an index along the first dimension.

§Panics

Panics if the split point is larger than the number of elements in that dimension, or if the rank is not at least 1.

Source

pub fn split_at_mut( &mut self, mid: usize, ) -> (ViewMut<'_, T, <Const<0> as Axis>::Insert<usize, <Const<0> as Axis>::Remove<S>>, L>, ViewMut<'_, T, <Const<0> as Axis>::Insert<usize, <Const<0> as Axis>::Remove<S>>, L>)

Divides a mutable array slice into two at an index along the first dimension.

§Panics

Panics if the split point is larger than the number of elements in that dimension, or if the rank is not at least 1.

Source

pub fn split_axis_at<A>( &self, axis: A, mid: usize, ) -> (View<'_, T, <A as Axis>::Insert<usize, <A as Axis>::Remove<S>>, <<A as Axis>::Init<S> as Shape>::Layout<L>>, View<'_, T, <A as Axis>::Insert<usize, <A as Axis>::Remove<S>>, <<A as Axis>::Init<S> as Shape>::Layout<L>>)
where A: Axis,

Divides an array slice into two at an index along the specified dimension.

If the dimension to be divided is know at compile time, the resulting array shape will maintain constant-sized dimensions. Furthermore, if it is the first dimension the resulting array views have the same layout as the input.

§Panics

Panics if the split point is larger than the number of elements in that dimension, or if the dimension is out of bounds.

Source

pub fn split_axis_at_mut<A>( &mut self, axis: A, mid: usize, ) -> (ViewMut<'_, T, <A as Axis>::Insert<usize, <A as Axis>::Remove<S>>, <<A as Axis>::Init<S> as Shape>::Layout<L>>, ViewMut<'_, T, <A as Axis>::Insert<usize, <A as Axis>::Remove<S>>, <<A as Axis>::Init<S> as Shape>::Layout<L>>)
where A: Axis,

Divides a mutable array slice into two at an index along the specified dimension.

If the dimension to be divided is know at compile time, the resulting array shape will maintain constant-sized dimensions. Furthermore, if it is the first dimension the resulting array views have the same layout as the input.

§Panics

Panics if the split point is larger than the number of elements in that dimension, or if the dimension is out of bounds.

Source

pub fn stride(&self, index: usize) -> isize

Returns the distance between elements in the specified dimension.

§Panics

Panics if the dimension is out of bounds.

Source

pub fn swap<I, J>(&mut self, a: I, b: J)
where I: SliceIndex<T, S, L, Output = T>, J: SliceIndex<T, S, L, Output = T>,

Swaps two elements in the array slice.

§Panics

Panics if a or b are out of bounds.

Source

pub fn swap_axis<A>(&mut self, axis: A, a: usize, b: usize)
where A: Axis,

Swaps the elements in two subarrays after indexing the specified dimension.

§Panics

Panics if a or b are out of bounds.

Source

pub fn to_array(&self) -> Array<T, S>
where T: Clone, S: ConstShape,

Copies the array slice into a new array.

Source

pub fn to_tensor(&self) -> Tensor<T, S>
where T: Clone,

Copies the array slice into a new array.

Source

pub fn to_vec(&self) -> Vec<T>
where T: Clone,

Copies the array slice into a new vector.

Source

pub fn transpose( &self, ) -> View<'_, T, <S as Shape>::Reverse, <<S as Shape>::Tail as Shape>::Layout<L>>

Returns a transposed array view of the array slice, where the dimensions are reversed.

Source

pub fn transpose_mut( &mut self, ) -> ViewMut<'_, T, <S as Shape>::Reverse, <<S as Shape>::Tail as Shape>::Layout<L>>

Returns a mutable transposed array view of the array slice, where the dimensions are reversed.

Source

pub fn strides(&self) -> &[isize]

Returns the distance between elements in each dimension.

Trait Implementations§

Source§

impl<'a, T, U, S, A, I> Add<I> for &'a Tensor<T, S, A>
where S: Shape, A: Allocator, I: Apply<U>, &'a T: Add<<I as IntoIterator>::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a Tensor<T, S, A>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: I) -> <&'a Tensor<T, S, A> as Add<I>>::Output

Performs the + operation. Read more
Source§

impl<T, S, A, I> Add<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: Add<<I as IntoIterator>::Item, Output = T>,

Source§

type Output = Tensor<T, S, A>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: I) -> Tensor<T, S, A>

Performs the + operation. Read more
Source§

impl<T, S, A, I> AddAssign<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: AddAssign<<I as IntoIterator>::Item>,

Source§

fn add_assign(&mut self, rhs: I)

Performs the += operation. Read more
Source§

impl<T, S, A> Apply<T> for Tensor<T, S, A>
where S: Shape, A: Allocator,

Source§

type Output<F: FnMut(T) -> T> = Tensor<T, S, A>

The resulting type after applying a closure.
Source§

type ZippedWith<I: IntoExpression, F: FnMut((T, <I as IntoIterator>::Item)) -> T> = Tensor<T, S, A>

The resulting type after zipping elements and applying a closure.
Source§

fn apply<F>(self, f: F) -> Tensor<T, S, A>
where F: FnMut(T) -> T,

Returns the array or an expression with the given closure applied to each element.
Source§

fn zip_with<I, F>(self, expr: I, f: F) -> Tensor<T, S, A>
where I: IntoExpression, F: FnMut((T, <I as IntoIterator>::Item)) -> T,

Returns the array or an expression with the given closure applied to zipped element pairs.
Source§

impl<'a, T, U, S, A> Apply<U> for &'a Tensor<T, S, A>
where S: Shape, A: Allocator,

Source§

type Output<F: FnMut(&'a T) -> U> = Map<<&'a Tensor<T, S, A> as IntoExpression>::IntoExpr, F>

The resulting type after applying a closure.
Source§

type ZippedWith<I: IntoExpression, F: FnMut((&'a T, <I as IntoIterator>::Item)) -> U> = Map<Zip<<&'a Tensor<T, S, A> as IntoExpression>::IntoExpr, <I as IntoExpression>::IntoExpr>, F>

The resulting type after zipping elements and applying a closure.
Source§

fn apply<F>(self, f: F) -> <&'a Tensor<T, S, A> as Apply<U>>::Output<F>
where F: FnMut(&'a T) -> U,

Returns the array or an expression with the given closure applied to each element.
Source§

fn zip_with<I, F>( self, expr: I, f: F, ) -> <&'a Tensor<T, S, A> as Apply<U>>::ZippedWith<I, F>
where I: IntoExpression, F: FnMut((&'a T, <I as IntoIterator>::Item)) -> U,

Returns the array or an expression with the given closure applied to zipped element pairs.
Source§

impl<'a, T, U, S, A> Apply<U> for &'a mut Tensor<T, S, A>
where S: Shape, A: Allocator,

Source§

type Output<F: FnMut(&'a mut T) -> U> = Map<<&'a mut Tensor<T, S, A> as IntoExpression>::IntoExpr, F>

The resulting type after applying a closure.
Source§

type ZippedWith<I: IntoExpression, F: FnMut((&'a mut T, <I as IntoIterator>::Item)) -> U> = Map<Zip<<&'a mut Tensor<T, S, A> as IntoExpression>::IntoExpr, <I as IntoExpression>::IntoExpr>, F>

The resulting type after zipping elements and applying a closure.
Source§

fn apply<F>(self, f: F) -> <&'a mut Tensor<T, S, A> as Apply<U>>::Output<F>
where F: FnMut(&'a mut T) -> U,

Returns the array or an expression with the given closure applied to each element.
Source§

fn zip_with<I, F>( self, expr: I, f: F, ) -> <&'a mut Tensor<T, S, A> as Apply<U>>::ZippedWith<I, F>
where I: IntoExpression, F: FnMut((&'a mut T, <I as IntoIterator>::Item)) -> U,

Returns the array or an expression with the given closure applied to zipped element pairs.
Source§

impl<T, U, S, A> AsMut<U> for Tensor<T, S, A>
where S: Shape, A: Allocator, Slice<T, S>: AsMut<U>, U: ?Sized,

Source§

fn as_mut(&mut self) -> &mut U

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T, U, S, A> AsRef<U> for Tensor<T, S, A>
where S: Shape, A: Allocator, Slice<T, S>: AsRef<U>, U: ?Sized,

Source§

fn as_ref(&self) -> &U

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<'a, T, U, S, A, I> BitAnd<I> for &'a Tensor<T, S, A>
where S: Shape, A: Allocator, I: Apply<U>, &'a T: BitAnd<<I as IntoIterator>::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a Tensor<T, S, A>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: I) -> <&'a Tensor<T, S, A> as BitAnd<I>>::Output

Performs the & operation. Read more
Source§

impl<T, S, A, I> BitAnd<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: BitAnd<<I as IntoIterator>::Item, Output = T>,

Source§

type Output = Tensor<T, S, A>

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: I) -> Tensor<T, S, A>

Performs the & operation. Read more
Source§

impl<T, S, A, I> BitAndAssign<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: BitAndAssign<<I as IntoIterator>::Item>,

Source§

fn bitand_assign(&mut self, rhs: I)

Performs the &= operation. Read more
Source§

impl<'a, T, U, S, A, I> BitOr<I> for &'a Tensor<T, S, A>
where S: Shape, A: Allocator, I: Apply<U>, &'a T: BitOr<<I as IntoIterator>::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a Tensor<T, S, A>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: I) -> <&'a Tensor<T, S, A> as BitOr<I>>::Output

Performs the | operation. Read more
Source§

impl<T, S, A, I> BitOr<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: BitOr<<I as IntoIterator>::Item, Output = T>,

Source§

type Output = Tensor<T, S, A>

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: I) -> Tensor<T, S, A>

Performs the | operation. Read more
Source§

impl<T, S, A, I> BitOrAssign<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: BitOrAssign<<I as IntoIterator>::Item>,

Source§

fn bitor_assign(&mut self, rhs: I)

Performs the |= operation. Read more
Source§

impl<'a, T, U, S, A, I> BitXor<I> for &'a Tensor<T, S, A>
where S: Shape, A: Allocator, I: Apply<U>, &'a T: BitXor<<I as IntoIterator>::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a Tensor<T, S, A>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: I) -> <&'a Tensor<T, S, A> as BitXor<I>>::Output

Performs the ^ operation. Read more
Source§

impl<T, S, A, I> BitXor<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: BitXor<<I as IntoIterator>::Item, Output = T>,

Source§

type Output = Tensor<T, S, A>

The resulting type after applying the ^ operator.
Source§

fn bitxor(self, rhs: I) -> Tensor<T, S, A>

Performs the ^ operation. Read more
Source§

impl<T, S, A, I> BitXorAssign<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: BitXorAssign<<I as IntoIterator>::Item>,

Source§

fn bitxor_assign(&mut self, rhs: I)

Performs the ^= operation. Read more
Source§

impl<T, S, A> Borrow<Slice<T, S>> for Tensor<T, S, A>
where S: Shape, A: Allocator,

Source§

fn borrow(&self) -> &Slice<T, S>

Immutably borrows from an owned value. Read more
Source§

impl<T, S, A> BorrowMut<Slice<T, S>> for Tensor<T, S, A>
where S: Shape, A: Allocator,

Source§

fn borrow_mut(&mut self) -> &mut Slice<T, S>

Mutably borrows from an owned value. Read more
Source§

impl<T, S, A> Buffer for Tensor<ManuallyDrop<T>, S, A>
where S: Shape, A: Allocator,

Source§

type Item = T

Array element type.
Source§

type Shape = S

Array shape type.
Source§

impl<T, S, A> Clone for Tensor<T, S, A>
where T: Clone, S: Shape, A: Allocator + Clone,

Source§

fn clone(&self) -> Tensor<T, S, A>

Returns a duplicate of the value. Read more
Source§

fn clone_from(&mut self, source: &Tensor<T, S, A>)

Performs copy-assignment from source. Read more
Source§

impl<T, S, A> Debug for Tensor<T, S, A>
where T: Debug, S: Shape, A: Allocator,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<T, S> Default for Tensor<T, S>
where T: Default, S: Shape,

Source§

fn default() -> Tensor<T, S>

Returns the “default value” for a type. Read more
Source§

impl<T, S, A> Deref for Tensor<T, S, A>
where S: Shape, A: Allocator,

Source§

type Target = Slice<T, S>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<Tensor<T, S, A> as Deref>::Target

Dereferences the value.
Source§

impl<T, S, A> DerefMut for Tensor<T, S, A>
where S: Shape, A: Allocator,

Source§

fn deref_mut(&mut self) -> &mut <Tensor<T, S, A> as Deref>::Target

Mutably dereferences the value.
Source§

impl<'a, T, U, S, A, I> Div<I> for &'a Tensor<T, S, A>
where S: Shape, A: Allocator, I: Apply<U>, &'a T: Div<<I as IntoIterator>::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a Tensor<T, S, A>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: I) -> <&'a Tensor<T, S, A> as Div<I>>::Output

Performs the / operation. Read more
Source§

impl<T, S, A, I> Div<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: Div<<I as IntoIterator>::Item, Output = T>,

Source§

type Output = Tensor<T, S, A>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: I) -> Tensor<T, S, A>

Performs the / operation. Read more
Source§

impl<T, S, A, I> DivAssign<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: DivAssign<<I as IntoIterator>::Item>,

Source§

fn div_assign(&mut self, rhs: I)

Performs the /= operation. Read more
Source§

impl<'a, T, A> Extend<&'a T> for Tensor<T, (usize,), A>
where T: Copy, A: Allocator,

Source§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = &'a T>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T, A> Extend<T> for Tensor<T, (usize,), A>
where A: Allocator,

Source§

fn extend<I>(&mut self, iter: I)
where I: IntoIterator<Item = T>,

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T, X, Y, Z, W, U, V, const A: usize, const B: usize, const C: usize, const D: usize, const E: usize, const F: usize> From<&[[[[[[T; F]; E]; D]; C]; B]; A]> for Tensor<T, (X, Y, Z, W, U, V)>
where T: Clone, X: Dim + From<Const<A>>, Y: Dim + From<Const<B>>, Z: Dim + From<Const<C>>, W: Dim + From<Const<D>>, U: Dim + From<Const<E>>, V: Dim + From<Const<F>>,

Source§

fn from( value: &[[[[[[T; F]; E]; D]; C]; B]; A], ) -> Tensor<T, (X, Y, Z, W, U, V)>

Converts to this type from the input type.
Source§

impl<T, X, Y, Z, W, U, const A: usize, const B: usize, const C: usize, const D: usize, const E: usize> From<&[[[[[T; E]; D]; C]; B]; A]> for Tensor<T, (X, Y, Z, W, U)>
where T: Clone, X: Dim + From<Const<A>>, Y: Dim + From<Const<B>>, Z: Dim + From<Const<C>>, W: Dim + From<Const<D>>, U: Dim + From<Const<E>>,

Source§

fn from(value: &[[[[[T; E]; D]; C]; B]; A]) -> Tensor<T, (X, Y, Z, W, U)>

Converts to this type from the input type.
Source§

impl<T, X, Y, Z, W, const A: usize, const B: usize, const C: usize, const D: usize> From<&[[[[T; D]; C]; B]; A]> for Tensor<T, (X, Y, Z, W)>
where T: Clone, X: Dim + From<Const<A>>, Y: Dim + From<Const<B>>, Z: Dim + From<Const<C>>, W: Dim + From<Const<D>>,

Source§

fn from(value: &[[[[T; D]; C]; B]; A]) -> Tensor<T, (X, Y, Z, W)>

Converts to this type from the input type.
Source§

impl<T, X, Y, Z, const A: usize, const B: usize, const C: usize> From<&[[[T; C]; B]; A]> for Tensor<T, (X, Y, Z)>
where T: Clone, X: Dim + From<Const<A>>, Y: Dim + From<Const<B>>, Z: Dim + From<Const<C>>,

Source§

fn from(value: &[[[T; C]; B]; A]) -> Tensor<T, (X, Y, Z)>

Converts to this type from the input type.
Source§

impl<T, X, Y, const A: usize, const B: usize> From<&[[T; B]; A]> for Tensor<T, (X, Y)>
where T: Clone, X: Dim + From<Const<A>>, Y: Dim + From<Const<B>>,

Source§

fn from(value: &[[T; B]; A]) -> Tensor<T, (X, Y)>

Converts to this type from the input type.
Source§

impl<T> From<&[T]> for Tensor<T, (usize,)>
where T: Clone,

Source§

fn from(value: &[T]) -> Tensor<T, (usize,)>

Converts to this type from the input type.
Source§

impl<T, X, const A: usize> From<&[T; A]> for Tensor<T, (X,)>
where T: Clone, X: Dim + From<Const<A>>,

Source§

fn from(value: &[T; A]) -> Tensor<T, (X,)>

Converts to this type from the input type.
Source§

impl<T, X, Y, Z, W, U, V, const A: usize, const B: usize, const C: usize, const D: usize, const E: usize, const F: usize> From<[[[[[[T; F]; E]; D]; C]; B]; A]> for Tensor<T, (X, Y, Z, W, U, V)>
where X: Dim + From<Const<A>>, Y: Dim + From<Const<B>>, Z: Dim + From<Const<C>>, W: Dim + From<Const<D>>, U: Dim + From<Const<E>>, V: Dim + From<Const<F>>,

Source§

fn from(value: [[[[[[T; F]; E]; D]; C]; B]; A]) -> Tensor<T, (X, Y, Z, W, U, V)>

Converts to this type from the input type.
Source§

impl<T, X, Y, Z, W, U, const A: usize, const B: usize, const C: usize, const D: usize, const E: usize> From<[[[[[T; E]; D]; C]; B]; A]> for Tensor<T, (X, Y, Z, W, U)>
where X: Dim + From<Const<A>>, Y: Dim + From<Const<B>>, Z: Dim + From<Const<C>>, W: Dim + From<Const<D>>, U: Dim + From<Const<E>>,

Source§

fn from(value: [[[[[T; E]; D]; C]; B]; A]) -> Tensor<T, (X, Y, Z, W, U)>

Converts to this type from the input type.
Source§

impl<T, X, Y, Z, W, const A: usize, const B: usize, const C: usize, const D: usize> From<[[[[T; D]; C]; B]; A]> for Tensor<T, (X, Y, Z, W)>
where X: Dim + From<Const<A>>, Y: Dim + From<Const<B>>, Z: Dim + From<Const<C>>, W: Dim + From<Const<D>>,

Source§

fn from(value: [[[[T; D]; C]; B]; A]) -> Tensor<T, (X, Y, Z, W)>

Converts to this type from the input type.
Source§

impl<T, X, Y, Z, const A: usize, const B: usize, const C: usize> From<[[[T; C]; B]; A]> for Tensor<T, (X, Y, Z)>
where X: Dim + From<Const<A>>, Y: Dim + From<Const<B>>, Z: Dim + From<Const<C>>,

Source§

fn from(value: [[[T; C]; B]; A]) -> Tensor<T, (X, Y, Z)>

Converts to this type from the input type.
Source§

impl<T, X, Y, const A: usize, const B: usize> From<[[T; B]; A]> for Tensor<T, (X, Y)>
where X: Dim + From<Const<A>>, Y: Dim + From<Const<B>>,

Source§

fn from(value: [[T; B]; A]) -> Tensor<T, (X, Y)>

Converts to this type from the input type.
Source§

impl<T, X, const A: usize> From<[T; A]> for Tensor<T, (X,)>
where X: Dim + From<Const<A>>,

Source§

fn from(value: [T; A]) -> Tensor<T, (X,)>

Converts to this type from the input type.
Source§

impl<T, S> From<Array<T, S>> for Tensor<T, S>
where S: ConstShape,

Source§

fn from(value: Array<T, S>) -> Tensor<T, S>

Converts to this type from the input type.
Source§

impl<'a, T, S, L, I> From<I> for Tensor<T, S>
where T: 'a + Clone, S: Shape, L: Layout, I: IntoExpression<IntoExpr = View<'a, T, S, L>>,

Source§

fn from(value: I) -> Tensor<T, S>

Converts to this type from the input type.
Source§

impl<T, D, A> From<Tensor<T, (D,), A>> for Vec<T>
where D: Dim, A: Allocator,

Source§

fn from(value: Tensor<T, (D,), A>) -> Vec<T>

Converts to this type from the input type.
Source§

impl<T, A> From<Vec<T>> for Tensor<T, (usize,), A>
where A: Allocator,

Source§

fn from(value: Vec<T>) -> Tensor<T, (usize,), A>

Converts to this type from the input type.
Source§

impl<T, S> FromExpression<T, S> for Tensor<T, S>
where S: Shape,

Source§

fn from_expr<I>(expr: I) -> Tensor<T, S>
where I: IntoExpression<Item = T, Shape = S>,

Creates an array from an expression.
Source§

impl<T> FromIterator<T> for Tensor<T, (usize,)>

Source§

fn from_iter<I>(iter: I) -> Tensor<T, (usize,)>
where I: IntoIterator<Item = T>,

Creates a value from an iterator. Read more
Source§

impl<T, S, A> Hash for Tensor<T, S, A>
where T: Hash, S: Shape, A: Allocator,

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T, S, A, I> Index<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: SliceIndex<T, S, Dense>,

Source§

type Output = <I as SliceIndex<T, S, Dense>>::Output

The returned type after indexing.
Source§

fn index(&self, index: I) -> &<I as SliceIndex<T, S, Dense>>::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T, S, A, I> IndexMut<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: SliceIndex<T, S, Dense>,

Source§

fn index_mut(&mut self, index: I) -> &mut <I as SliceIndex<T, S, Dense>>::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<'a, T, S, A> IntoExpression for &'a Tensor<T, S, A>
where S: Shape, A: Allocator,

Source§

type Shape = S

Array shape type.
Source§

type IntoExpr = View<'a, T, S>

Which kind of expression are we turning this into?
Source§

fn into_expr(self) -> <&'a Tensor<T, S, A> as IntoExpression>::IntoExpr

Creates an expression from a value.
Source§

impl<'a, T, S, A> IntoExpression for &'a mut Tensor<T, S, A>
where S: Shape, A: Allocator,

Source§

type Shape = S

Array shape type.
Source§

type IntoExpr = ViewMut<'a, T, S>

Which kind of expression are we turning this into?
Source§

fn into_expr(self) -> <&'a mut Tensor<T, S, A> as IntoExpression>::IntoExpr

Creates an expression from a value.
Source§

impl<T, S, A> IntoExpression for Tensor<T, S, A>
where S: Shape, A: Allocator,

Source§

type Shape = S

Array shape type.
Source§

type IntoExpr = IntoExpr<Tensor<ManuallyDrop<T>, S, A>>

Which kind of expression are we turning this into?
Source§

fn into_expr(self) -> <Tensor<T, S, A> as IntoExpression>::IntoExpr

Creates an expression from a value.
Source§

impl<'a, T, S, A> IntoIterator for &'a Tensor<T, S, A>
where S: Shape, A: Allocator,

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<View<'a, T, S>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <&'a Tensor<T, S, A> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T, S, A> IntoIterator for &'a mut Tensor<T, S, A>
where S: Shape, A: Allocator,

Source§

type Item = &'a mut T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<ViewMut<'a, T, S>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <&'a mut Tensor<T, S, A> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T, S, A> IntoIterator for Tensor<T, S, A>
where S: Shape, A: Allocator,

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<IntoExpr<Tensor<ManuallyDrop<T>, S, A>>>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> <Tensor<T, S, A> as IntoIterator>::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T, U, S, A, I> Mul<I> for &'a Tensor<T, S, A>
where S: Shape, A: Allocator, I: Apply<U>, &'a T: Mul<<I as IntoIterator>::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a Tensor<T, S, A>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: I) -> <&'a Tensor<T, S, A> as Mul<I>>::Output

Performs the * operation. Read more
Source§

impl<T, S, A, I> Mul<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: Mul<<I as IntoIterator>::Item, Output = T>,

Source§

type Output = Tensor<T, S, A>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: I) -> Tensor<T, S, A>

Performs the * operation. Read more
Source§

impl<T, S, A, I> MulAssign<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: MulAssign<<I as IntoIterator>::Item>,

Source§

fn mul_assign(&mut self, rhs: I)

Performs the *= operation. Read more
Source§

impl<'a, T, U, S, A> Neg for &'a Tensor<T, S, A>
where S: Shape, A: Allocator, &'a T: Neg<Output = U>,

Source§

type Output = <&'a Tensor<T, S, A> as Apply<U>>::Output<fn(&'a T) -> U>

The resulting type after applying the - operator.
Source§

fn neg(self) -> <&'a Tensor<T, S, A> as Neg>::Output

Performs the unary - operation. Read more
Source§

impl<T, S, A> Neg for Tensor<T, S, A>
where S: Shape, A: Allocator, T: Neg<Output = T>,

Source§

type Output = Tensor<T, S, A>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Tensor<T, S, A>

Performs the unary - operation. Read more
Source§

impl<'a, T, U, S, A> Not for &'a Tensor<T, S, A>
where S: Shape, A: Allocator, &'a T: Not<Output = U>,

Source§

type Output = <&'a Tensor<T, S, A> as Apply<U>>::Output<fn(&'a T) -> U>

The resulting type after applying the ! operator.
Source§

fn not(self) -> <&'a Tensor<T, S, A> as Not>::Output

Performs the unary ! operation. Read more
Source§

impl<T, S, A> Not for Tensor<T, S, A>
where S: Shape, A: Allocator, T: Not<Output = T>,

Source§

type Output = Tensor<T, S, A>

The resulting type after applying the ! operator.
Source§

fn not(self) -> Tensor<T, S, A>

Performs the unary ! operation. Read more
Source§

impl<T, U, S, R, L, A, I> PartialEq<I> for Tensor<T, S, A>
where S: Shape, R: Shape, L: Layout, A: Allocator, &'a I: for<'a> IntoExpression<IntoExpr = View<'a, U, R, L>>, T: PartialEq<U>, I: ?Sized,

Source§

fn eq(&self, other: &I) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, T, U, S, A, I> Rem<I> for &'a Tensor<T, S, A>
where S: Shape, A: Allocator, I: Apply<U>, &'a T: Rem<<I as IntoIterator>::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a Tensor<T, S, A>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: I) -> <&'a Tensor<T, S, A> as Rem<I>>::Output

Performs the % operation. Read more
Source§

impl<T, S, A, I> Rem<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: Rem<<I as IntoIterator>::Item, Output = T>,

Source§

type Output = Tensor<T, S, A>

The resulting type after applying the % operator.
Source§

fn rem(self, rhs: I) -> Tensor<T, S, A>

Performs the % operation. Read more
Source§

impl<T, S, A, I> RemAssign<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: RemAssign<<I as IntoIterator>::Item>,

Source§

fn rem_assign(&mut self, rhs: I)

Performs the %= operation. Read more
Source§

impl<'a, T, U, S, A, I> Shl<I> for &'a Tensor<T, S, A>
where S: Shape, A: Allocator, I: Apply<U>, &'a T: Shl<<I as IntoIterator>::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a Tensor<T, S, A>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: I) -> <&'a Tensor<T, S, A> as Shl<I>>::Output

Performs the << operation. Read more
Source§

impl<T, S, A, I> Shl<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: Shl<<I as IntoIterator>::Item, Output = T>,

Source§

type Output = Tensor<T, S, A>

The resulting type after applying the << operator.
Source§

fn shl(self, rhs: I) -> Tensor<T, S, A>

Performs the << operation. Read more
Source§

impl<T, S, A, I> ShlAssign<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: ShlAssign<<I as IntoIterator>::Item>,

Source§

fn shl_assign(&mut self, rhs: I)

Performs the <<= operation. Read more
Source§

impl<'a, T, U, S, A, I> Shr<I> for &'a Tensor<T, S, A>
where S: Shape, A: Allocator, I: Apply<U>, &'a T: Shr<<I as IntoIterator>::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a Tensor<T, S, A>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: I) -> <&'a Tensor<T, S, A> as Shr<I>>::Output

Performs the >> operation. Read more
Source§

impl<T, S, A, I> Shr<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: Shr<<I as IntoIterator>::Item, Output = T>,

Source§

type Output = Tensor<T, S, A>

The resulting type after applying the >> operator.
Source§

fn shr(self, rhs: I) -> Tensor<T, S, A>

Performs the >> operation. Read more
Source§

impl<T, S, A, I> ShrAssign<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: ShrAssign<<I as IntoIterator>::Item>,

Source§

fn shr_assign(&mut self, rhs: I)

Performs the >>= operation. Read more
Source§

impl<'a, T, U, S, A, I> Sub<I> for &'a Tensor<T, S, A>
where S: Shape, A: Allocator, I: Apply<U>, &'a T: Sub<<I as IntoIterator>::Item, Output = U>,

Source§

type Output = <I as Apply<U>>::ZippedWith<&'a Tensor<T, S, A>, fn((<I as IntoIterator>::Item, &'a T)) -> U>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: I) -> <&'a Tensor<T, S, A> as Sub<I>>::Output

Performs the - operation. Read more
Source§

impl<T, S, A, I> Sub<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: Sub<<I as IntoIterator>::Item, Output = T>,

Source§

type Output = Tensor<T, S, A>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: I) -> Tensor<T, S, A>

Performs the - operation. Read more
Source§

impl<T, S, A, I> SubAssign<I> for Tensor<T, S, A>
where S: Shape, A: Allocator, I: IntoExpression, T: SubAssign<<I as IntoIterator>::Item>,

Source§

fn sub_assign(&mut self, rhs: I)

Performs the -= operation. Read more
Source§

impl<T, X, const A: usize> TryFrom<Tensor<T, (X,)>> for [T; A]
where X: Dim,

Source§

type Error = Tensor<T, (X,)>

The type returned in the event of a conversion error.
Source§

fn try_from( value: Tensor<T, (X,)>, ) -> Result<[T; A], <[T; A] as TryFrom<Tensor<T, (X,)>>>::Error>

Performs the conversion.
Source§

impl<T, X, Y, const A: usize, const B: usize> TryFrom<Tensor<T, (X, Y)>> for [[T; B]; A]
where X: Dim, Y: Dim,

Source§

type Error = Tensor<T, (X, Y)>

The type returned in the event of a conversion error.
Source§

fn try_from( value: Tensor<T, (X, Y)>, ) -> Result<[[T; B]; A], <[[T; B]; A] as TryFrom<Tensor<T, (X, Y)>>>::Error>

Performs the conversion.
Source§

impl<T, X, Y, Z, const A: usize, const B: usize, const C: usize> TryFrom<Tensor<T, (X, Y, Z)>> for [[[T; C]; B]; A]
where X: Dim, Y: Dim, Z: Dim,

Source§

type Error = Tensor<T, (X, Y, Z)>

The type returned in the event of a conversion error.
Source§

fn try_from( value: Tensor<T, (X, Y, Z)>, ) -> Result<[[[T; C]; B]; A], <[[[T; C]; B]; A] as TryFrom<Tensor<T, (X, Y, Z)>>>::Error>

Performs the conversion.
Source§

impl<T, X, Y, Z, W, const A: usize, const B: usize, const C: usize, const D: usize> TryFrom<Tensor<T, (X, Y, Z, W)>> for [[[[T; D]; C]; B]; A]
where X: Dim, Y: Dim, Z: Dim, W: Dim,

Source§

type Error = Tensor<T, (X, Y, Z, W)>

The type returned in the event of a conversion error.
Source§

fn try_from( value: Tensor<T, (X, Y, Z, W)>, ) -> Result<[[[[T; D]; C]; B]; A], <[[[[T; D]; C]; B]; A] as TryFrom<Tensor<T, (X, Y, Z, W)>>>::Error>

Performs the conversion.
Source§

impl<T, X, Y, Z, W, U, const A: usize, const B: usize, const C: usize, const D: usize, const E: usize> TryFrom<Tensor<T, (X, Y, Z, W, U)>> for [[[[[T; E]; D]; C]; B]; A]
where X: Dim, Y: Dim, Z: Dim, W: Dim, U: Dim,

Source§

type Error = Tensor<T, (X, Y, Z, W, U)>

The type returned in the event of a conversion error.
Source§

fn try_from( value: Tensor<T, (X, Y, Z, W, U)>, ) -> Result<[[[[[T; E]; D]; C]; B]; A], <[[[[[T; E]; D]; C]; B]; A] as TryFrom<Tensor<T, (X, Y, Z, W, U)>>>::Error>

Performs the conversion.
Source§

impl<T, X, Y, Z, W, U, V, const A: usize, const B: usize, const C: usize, const D: usize, const E: usize, const F: usize> TryFrom<Tensor<T, (X, Y, Z, W, U, V)>> for [[[[[[T; F]; E]; D]; C]; B]; A]
where X: Dim, Y: Dim, Z: Dim, W: Dim, U: Dim, V: Dim,

Source§

type Error = Tensor<T, (X, Y, Z, W, U, V)>

The type returned in the event of a conversion error.
Source§

fn try_from( value: Tensor<T, (X, Y, Z, W, U, V)>, ) -> Result<[[[[[[T; F]; E]; D]; C]; B]; A], <[[[[[[T; F]; E]; D]; C]; B]; A] as TryFrom<Tensor<T, (X, Y, Z, W, U, V)>>>::Error>

Performs the conversion.
Source§

impl<T, S, A> Eq for Tensor<T, S, A>
where T: Eq, S: Shape, A: Allocator,

Source§

impl<T, S> Owned<T, S> for Tensor<T, S>
where S: Shape,

Auto Trait Implementations§

§

impl<T, S, A> Freeze for Tensor<T, S, A>
where S: Freeze,

§

impl<T, S, A> RefUnwindSafe for Tensor<T, S, A>

§

impl<T, S, A> Send for Tensor<T, S, A>
where T: Send, A: Send,

§

impl<T, S, A> Sync for Tensor<T, S, A>
where T: Sync, A: Sync,

§

impl<T, S, A> Unpin for Tensor<T, S, A>
where A: Unpin, S: Unpin,

§

impl<T, S, A> UnwindSafe for Tensor<T, S, A>

Blanket Implementations§

Source§

impl<Rhs, Lhs, Output> AddByRef<Rhs> for Lhs
where &'a Lhs: for<'a> Add<&'a Rhs, Output = Output>,

Source§

type Output = Output

Source§

fn add_by_ref(&self, rhs: &Rhs) -> <Lhs as AddByRef<Rhs>>::Output

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'short, T, Target> AsGeneralizedMut<'short, &'short mut Target> for T
where T: AsMut<Target> + ?Sized, Target: ?Sized,

Source§

impl<'short, T, Target> AsGeneralizedRef<'short, &'short Target> for T
where T: AsRef<Target> + ?Sized, Target: ?Sized,

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DistributionExt for T
where T: ?Sized,

Source§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<Rhs, Lhs, Output> DivByRef<Rhs> for Lhs
where &'a Lhs: for<'a> Div<&'a Rhs, Output = Output>,

Source§

type Output = Output

Source§

fn div_by_ref(&self, rhs: &Rhs) -> <Lhs as DivByRef<Rhs>>::Output

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoCloned<T> for T

Source§

fn clone_to(self, target: &mut T)

Moves an existing object or clones from a reference to the target object.
Source§

fn into_cloned(self) -> T

Returns an existing object or a new clone from a reference.
Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Rhs, Lhs, Output> MulByRef<Rhs> for Lhs
where &'a Lhs: for<'a> Mul<&'a Rhs, Output = Output>,

Source§

type Output = Output

Source§

fn mul_by_ref(&self, rhs: &Rhs) -> <Lhs as MulByRef<Rhs>>::Output

Source§

impl<T, Output> NegByRef for T
where &'a T: for<'a> Neg<Output = Output>,

Source§

type Output = Output

Source§

fn neg_by_ref(&self) -> <T as NegByRef>::Output

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<Rhs, Lhs, Output> SubByRef<Rhs> for Lhs
where &'a Lhs: for<'a> Sub<&'a Rhs, Output = Output>,

Source§

type Output = Output

Source§

fn sub_by_ref(&self, rhs: &Rhs) -> <Lhs as SubByRef<Rhs>>::Output

Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T, Right> ClosedAdd<Right> for T
where T: Add<Right, Output = T> + AddAssign<Right>,

Source§

impl<T, Right> ClosedAddAssign<Right> for T
where T: ClosedAdd<Right> + AddAssign<Right>,

Source§

impl<T, Right> ClosedDiv<Right> for T
where T: Div<Right, Output = T> + DivAssign<Right>,

Source§

impl<T, Right> ClosedDivAssign<Right> for T
where T: ClosedDiv<Right> + DivAssign<Right>,

Source§

impl<T, Right> ClosedMul<Right> for T
where T: Mul<Right, Output = T> + MulAssign<Right>,

Source§

impl<T, Right> ClosedMulAssign<Right> for T
where T: ClosedMul<Right> + MulAssign<Right>,

Source§

impl<T> ClosedNeg for T
where T: Neg<Output = T>,

Source§

impl<T, Right> ClosedSub<Right> for T
where T: Sub<Right, Output = T> + SubAssign<Right>,

Source§

impl<T, Right> ClosedSubAssign<Right> for T
where T: ClosedSub<Right> + SubAssign<Right>,

Source§

impl<T, Rhs> NumAssignOps<Rhs> for T
where T: AddAssign<Rhs> + SubAssign<Rhs> + MulAssign<Rhs> + DivAssign<Rhs> + RemAssign<Rhs>,

Source§

impl<T, Rhs, Output> NumOps<Rhs, Output> for T
where T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>,

Source§

impl<T, Base> RefNum<Base> for T
where T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>,

Source§

impl<T> Scalar for T
where T: 'static + Clone + PartialEq + Debug,