pub struct ArrayExt<T: HasAfEnum>(_);
Expand description
A wrapper around af::Array
which defines common operations.
Implementations
Construct a new ArrayExt with the given value and length.
Concatenate two instances of ArrayExt<T>
.
Raise e
to the power of self
.
Return true
if the elements of this ArrayExt
are in sorted order.
Cast the values of this ArrayExt
into a destination type D
.
Get the values specified by the given af::Indexer
.
Deconstruct this ArrayExt<T>
into its underlying af::Array
.
Return a slice of this ArrayExt
.
Panics: if end
is out of bounds
Sort this ArrayExt
.
Return a sorted copy of this ArrayExt
.
Split this ArrayExt<T>
into two new instances at the given pivot.
Return only the unique values from this ArrayExt
.
Pass true
for sorted
if this ArrayExt
is known to be in sorted order.
Methods from Deref<Target = Array<T>>
Returns the backend of the Array
Return Values
Returns an value of type Backend
which indicates which backend
was active when Array was created.
Returns the device identifier(integer) on which the Array was created
Return Values
Return the device id on which Array was created.
Copies the data from the Array to the mutable slice data
Examples
Basic case
let a:Vec<u8> = vec![0,1,2,3,4,5,6,7,8];
let b = Array::<u8>::new(&a,Dim4::new(&[3,3,1,1]));
let mut c = vec!(u8::default();b.elements());
b.host(&mut c);
assert_eq!(c,a);
Generic case
fn to_vec<T:HasAfEnum+Default+Clone>(array:&Array<T>) -> Vec<T> {
let mut vec = vec!(T::default();array.elements());
array.host(&mut vec);
return vec;
}
let a = Array::<u8>::new(&[0,1,2,3,4,5,6,7,8],Dim4::new(&[3,3,1,1]));
let b:Vec<u8> = vec![0,1,2,3,4,5,6,7,8];
assert_eq!(to_vec(&a),b);
Evaluates any pending lazy expressions that represent the data in the Array object
Makes an copy of the Array
This does a deep copy of the data into a new Array
Check if Array is of complex type
Check if Array is of integral type
Check if Array is floating point real(not complex) data type
Check if Array is floating point type, either real or complex data
Check if Array’s memory layout is continuous and one dimensional
Check if Array’s memory is owned by it and not a view of another Array
Lock the device buffer in the memory manager
Locked buffers are not freed by memory manager until unlock is called.
Unlock the device buffer in the memory manager
This function will give back the control over the device pointer to the memory manager.
Get the device pointer and lock the buffer in memory manager
The device pointer is not freed by memory manager until unlock is called.
Get the size of physical allocated bytes.
This function will return the size of the parent/owner if the current Array object is an indexed Array.
Trait Implementations
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Add<&'_ ArrayExt<T>> for &ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Add<&'_ ArrayExt<T>> for &ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
The resulting type after applying the +
operator.
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Add<ArrayExt<T>> for ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Add<ArrayExt<T>> for ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
The resulting type after applying the +
operator.
type DType = T
Get the values specified by the given af::Indexer
.
Set the values specified by the given af::Indexer
to the corresponding values in T
.
Set the value at the specified index to value
.
impl<T, U> ArrayInstanceCompare<U> for ArrayExt<T> where
T: Clone + HasAfEnum + Convertable<OutType = T>,
U: Convertable<OutType = T>,
<T as Convertable>::OutType: ImplicitPromote<<U as Convertable>::OutType>,
<U as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
impl<T, U> ArrayInstanceCompare<U> for ArrayExt<T> where
T: Clone + HasAfEnum + Convertable<OutType = T>,
U: Convertable<OutType = T>,
<T as Convertable>::OutType: ImplicitPromote<<U as Convertable>::OutType>,
<U as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
impl<T, U> ArrayInstanceLog<T, U> for ArrayExt<T> where
T: HasAfEnum,
U: HasAfEnum,
Self: ArrayInstanceNaturalLog<T>,
ArrayExt<U>: ArrayInstanceNaturalLog<U>,
ArrayExt<T::UnaryOutType>: Div<ArrayExt<U::UnaryOutType>>,
impl<T, U> ArrayInstanceLog<T, U> for ArrayExt<T> where
T: HasAfEnum,
U: HasAfEnum,
Self: ArrayInstanceNaturalLog<T>,
ArrayExt<U>: ArrayInstanceNaturalLog<U>,
ArrayExt<T::UnaryOutType>: Div<ArrayExt<U::UnaryOutType>>,
fn log(
&self,
base: &ArrayExt<U>
) -> <ArrayExt<T::UnaryOutType> as Div<ArrayExt<U::UnaryOutType>>>::Output
fn log(
&self,
base: &ArrayExt<U>
) -> <ArrayExt<T::UnaryOutType> as Div<ArrayExt<U::UnaryOutType>>>::Output
Calculate the element-wise logarithm.
Calculate the element-wise natural logarithm.
impl<T, U> ArrayInstancePow<U> for ArrayExt<T> where
T: HasAfEnum + Convertable<OutType = T>,
U: Convertable<OutType = T>,
<T as Convertable>::OutType: ImplicitPromote<T> + ImplicitPromote<<U as Convertable>::OutType>,
<U as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<U as Convertable>::OutType>>::Output: HasAfEnum,
impl<T, U> ArrayInstancePow<U> for ArrayExt<T> where
T: HasAfEnum + Convertable<OutType = T>,
U: Convertable<OutType = T>,
<T as Convertable>::OutType: ImplicitPromote<T> + ImplicitPromote<<U as Convertable>::OutType>,
<U as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<U as Convertable>::OutType>>::Output: HasAfEnum,
type Pow = <<T as Convertable>::OutType as ImplicitPromote<<U as Convertable>::OutType>>::Output
The NumberType
of the product of this array.
The NumberType
of the sum of this array.
The NumberType
of the product of this array.
The NumberType
of the sum of this array.
type Product = <bool as HasAfEnum>::ProductOutType
type Sum = <bool as HasAfEnum>::AggregateOutType
The NumberType
of the product of this array.
The NumberType
of the sum of this array.
type Product = <f32 as HasAfEnum>::ProductOutType
type Sum = <f32 as HasAfEnum>::AggregateOutType
The NumberType
of the product of this array.
The NumberType
of the sum of this array.
type Product = <f64 as HasAfEnum>::ProductOutType
type Sum = <f64 as HasAfEnum>::AggregateOutType
The NumberType
of the product of this array.
The NumberType
of the sum of this array.
type Product = <i16 as HasAfEnum>::ProductOutType
type Sum = <i16 as HasAfEnum>::AggregateOutType
The NumberType
of the product of this array.
The NumberType
of the sum of this array.
type Product = <i32 as HasAfEnum>::ProductOutType
type Sum = <i32 as HasAfEnum>::AggregateOutType
The NumberType
of the product of this array.
The NumberType
of the sum of this array.
type Product = <i64 as HasAfEnum>::ProductOutType
type Sum = <i64 as HasAfEnum>::AggregateOutType
The NumberType
of the product of this array.
The NumberType
of the sum of this array.
type Product = <u16 as HasAfEnum>::ProductOutType
type Sum = <u16 as HasAfEnum>::AggregateOutType
The NumberType
of the product of this array.
The NumberType
of the sum of this array.
type Product = <u32 as HasAfEnum>::ProductOutType
type Sum = <u32 as HasAfEnum>::AggregateOutType
The NumberType
of the product of this array.
The NumberType
of the sum of this array.
type Product = <u64 as HasAfEnum>::ProductOutType
type Sum = <u64 as HasAfEnum>::AggregateOutType
The NumberType
of the product of this array.
The NumberType
of the sum of this array.
type Product = <u8 as HasAfEnum>::ProductOutType
type Sum = <u8 as HasAfEnum>::AggregateOutType
The NumberType
of the product of this array.
The NumberType
of the sum of this array.
impl<'de, T: HasAfEnum + Deserialize<'de> + 'de> Deserialize<'de> for ArrayExt<T> where
ArrayExt<T>: From<Vec<T>>,
impl<'de, T: HasAfEnum + Deserialize<'de> + 'de> Deserialize<'de> for ArrayExt<T> where
ArrayExt<T>: From<Vec<T>>,
Deserialize this value from the given Serde deserializer. Read more
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Div<&'_ ArrayExt<T>> for &ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Div<&'_ ArrayExt<T>> for &ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
The resulting type after applying the /
operator.
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Div<ArrayExt<T>> for ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Div<ArrayExt<T>> for ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
The resulting type after applying the /
operator.
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> DivAssign<ArrayExt<T>> for ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> DivAssign<ArrayExt<T>> for ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
Performs the /=
operation. Read more
Creates a value from an iterator. Read more
The decoding context of this type, useful in situations where the stream to be decoded may be too large to hold in main memory. Read more
The decoding context of this type, useful in situations where the stream to be decoded may be too large to hold in main memory. Read more
The decoding context of this type, useful in situations where the stream to be decoded may be too large to hold in main memory. Read more
The decoding context of this type, useful in situations where the stream to be decoded may be too large to hold in main memory. Read more
The decoding context of this type, useful in situations where the stream to be decoded may be too large to hold in main memory. Read more
The decoding context of this type, useful in situations where the stream to be decoded may be too large to hold in main memory. Read more
The decoding context of this type, useful in situations where the stream to be decoded may be too large to hold in main memory. Read more
The decoding context of this type, useful in situations where the stream to be decoded may be too large to hold in main memory. Read more
The decoding context of this type, useful in situations where the stream to be decoded may be too large to hold in main memory. Read more
The decoding context of this type, useful in situations where the stream to be decoded may be too large to hold in main memory. Read more
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Mul<&'_ ArrayExt<T>> for &ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Mul<&'_ ArrayExt<T>> for &ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
The resulting type after applying the *
operator.
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Mul<ArrayExt<T>> for ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Mul<ArrayExt<T>> for ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
The resulting type after applying the *
operator.
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Rem<&'_ ArrayExt<T>> for &ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Rem<&'_ ArrayExt<T>> for &ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
The resulting type after applying the %
operator.
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Rem<ArrayExt<T>> for ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Rem<ArrayExt<T>> for ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
The resulting type after applying the %
operator.
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Sub<&'_ ArrayExt<T>> for &ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Sub<&'_ ArrayExt<T>> for &ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
The resulting type after applying the -
operator.
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Sub<ArrayExt<T>> for ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> Sub<ArrayExt<T>> for ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
type Output = ArrayExt<<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output>
The resulting type after applying the -
operator.
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> SubAssign<ArrayExt<T>> for ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
impl<T: HasAfEnum + ImplicitPromote<T> + Convertable<OutType = T>> SubAssign<ArrayExt<T>> for ArrayExt<T> where
<T as ImplicitPromote<T>>::Output: HasAfEnum + Default,
<T as Convertable>::OutType: ImplicitPromote<<T as Convertable>::OutType>,
<<T as Convertable>::OutType as ImplicitPromote<<T as Convertable>::OutType>>::Output: HasAfEnum,
Performs the -=
operation. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for ArrayExt<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for ArrayExt<T> where
T: UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
Returns true
if self
can be cast into the target type T
.
Test if value
can be cast into Self
.
Returns Some(Self)
if the source value can be cast into Self
, otherwise None
.
fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
fn try_cast_from<Err, OnErr>(value: T, on_err: OnErr) -> Result<Self, Err> where
OnErr: FnOnce(&T) -> Err,
Returns Ok(Self)
if the source value can be cast into Self
, otherwise calls on_err
.
Test if self
can be cast into T
.
Returns Some(T)
if self
can be cast into T
, otherwise None
.
fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err> where
OnErr: FnOnce(&Self) -> Err,
fn try_cast_into<Err, OnErr>(self, on_err: OnErr) -> Result<T, Err> where
OnErr: FnOnce(&Self) -> Err,
Returns Ok(T)
if self
can be cast into T
, otherwise calls on_err
.