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.

Cast the values of this ArrayExt into a destination type D.

Get the values specified by the given af::Indexer.

Get the value at the given index.

Deconstruct this ArrayExt<T> into its underlying af::Array.

Return a slice of this ArrayExt.

Panics: if end is out of bounds

Split this ArrayExt<T> into two new instances at the given pivot.

Return true if the elements of this ArrayExt are in sorted order.

Sort this ArrayExt.

Compute the indices needed to sort this ArrayExt.

Return a sorted copy of this ArrayExt.

Return only the unique values from this ArrayExt.

Pass true for sorted if this ArrayExt is known to be in sorted order.

Construct a new ArrayExt with a random normal distribution.

Construct a new ArrayExt with a uniform random distribution.

Logical not.

Logical and.

Logical or.

Logical xor.

Get the real component of this array.

Get the imaginary component of this array.

Get the real component of this array.

Get the imaginary component of this array.

Construct a new ArrayExt<u64> with elements start..end.

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.

Returns the number of elements in the Array

Returns the Array data type

Returns the dimensions of the Array

Returns the strides of the Array

Returns the number of dimensions of the Array

Returns the offset to the pointer from where data begins

Returns the native FFI handle for Rust object Array

Set the native FFI handle for Rust object Array

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 empty

Check if Array is scalar

Check if Array is a row

Check if Array is a column

Check if Array is a vector

Check if Array is of real (not complex) type

Check if Array is of complex type

Check if Array’s numerical type is of double precision

Check if Array’s numerical type is of single precision

Check if Array’s numerical type is of half precision

Check if Array is of integral type

Check if Array is of boolean 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 is a sparse matrix

Check if Array’s memory is owned by it and not a view of another Array

Cast the Array data type to target_type

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

The resulting type after applying the + operator.

Performs the + operation. Read more

The resulting type after applying the + operator.

Performs the + operation. Read more

Cast this instance into an af::Array with type T.

How many elements are in this ArrayInstance.

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.

Copy the data in this af::Array into a new Vec.

Calculate the element-wise absolute value.

Calculate the element-wise absolute value.

Calculate the element-wise absolute value.

Calculate the element-wise absolute value.

Calculate the element-wise absolute value.

Calculate the element-wise absolute value.

Calculate the element-wise absolute value.

Returns true if all elements are nonzero.

Returns true if any element is nonzero.

Returns true if all elements are nonzero.

Returns true if any element is nonzero.

Returns true if all elements are nonzero.

Returns true if any element is nonzero.

Returns true if all elements are nonzero.

Returns true if any element is nonzero.

Returns true if all elements are nonzero.

Returns true if any element is nonzero.

Returns true if all elements are nonzero.

Returns true if any element is nonzero.

Returns true if all elements are nonzero.

Returns true if any element is nonzero.

Returns true if all elements are nonzero.

Returns true if any element is nonzero.

Returns true if all elements are nonzero.

Returns true if any element is nonzero.

Returns true if all elements are nonzero.

Returns true if any element is nonzero.

Returns true if all elements are nonzero.

Returns true if any element is nonzero.

Returns true if all elements are nonzero.

Returns true if any element is nonzero.

Element-wise equality.

Element-wise greater-than comparison.

Element-wise greater-or-equal comparison

Element-wise less-than comparison.

Element-wise less-or-equal comparison.

Element-wise inequality.

Calculate the element-wise logarithm.

Find the maximum element.

Find the minimum element.

Find the maximum element.

Find the minimum element.

Find the maximum element.

Find the minimum element.

Find the maximum element.

Find the minimum element.

Find the maximum element.

Find the minimum element.

Find the maximum element.

Find the minimum element.

Find the maximum element.

Find the minimum element.

Find the maximum element.

Find the minimum element.

Find the maximum element.

Find the minimum element.

Find the maximum element.

Find the minimum element.

Find the maximum element.

Find the minimum element.

Find the maximum element.

Find the minimum element.

Calculate the element-wise natural logarithm.

Calculate the element-wise exponentiation.

Calculate the cumulative product.

The NumberType of the product of this array.

Calculate the cumulative product.

The NumberType of the product of this array.

Calculate the cumulative product.

The NumberType of the product of this array.

Calculate the cumulative product.

The NumberType of the product of this array.

Calculate the cumulative product.

The NumberType of the product of this array.

Calculate the cumulative product.

The NumberType of the product of this array.

Calculate the cumulative product.

The NumberType of the product of this array.

Calculate the cumulative product.

The NumberType of the product of this array.

Calculate the cumulative product.

The NumberType of the product of this array.

Calculate the cumulative product.

The NumberType of the product of this array.

Calculate the cumulative product.

The NumberType of the product of this array.

Calculate the cumulative product.

The NumberType of the product of this array.

Round to the nearest integer, element-wise.

Calculate the cumulative sum.

The NumberType of the sum of this array.

Calculate the cumulative sum.

The NumberType of the sum of this array.

Calculate the cumulative sum.

The NumberType of the sum of this array.

Calculate the cumulative sum.

The NumberType of the sum of this array.

Calculate the cumulative sum.

The NumberType of the sum of this array.

Calculate the cumulative sum.

The NumberType of the sum of this array.

Calculate the cumulative sum.

The NumberType of the sum of this array.

Calculate the cumulative sum.

The NumberType of the sum of this array.

Calculate the cumulative sum.

The NumberType of the sum of this array.

Calculate the cumulative sum.

The NumberType of the sum of this array.

Calculate the cumulative sum.

The NumberType of the sum of this array.

Calculate the cumulative sum.

The NumberType of the sum of this array.

Element-wise check for infinite values.

Element-wise check for non-numeric (NaN) values.

Cast an instance of T into an instance of Self.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

Performs the /= operation. Read more

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

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

Parse this value using the given Decoder.

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

Parse this value using the given Decoder.

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

Parse this value using the given Decoder.

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

Parse this value using the given Decoder.

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

Parse this value using the given Decoder.

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

Parse this value using the given Decoder.

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

Parse this value using the given Decoder.

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

Parse this value using the given Decoder.

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

Parse this value using the given Decoder.

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

Parse this value using the given Decoder.

Take ownership of this value and serialize it into the given encoder.

Take ownership of this value and serialize it into the given encoder.

Take ownership of this value and serialize it into the given encoder.

Take ownership of this value and serialize it into the given encoder.

Take ownership of this value and serialize it into the given encoder.

Take ownership of this value and serialize it into the given encoder.

Take ownership of this value and serialize it into the given encoder.

Take ownership of this value and serialize it into the given encoder.

Take ownership of this value and serialize it into the given encoder.

Take ownership of this value and serialize it into the given encoder.

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

The resulting type after applying the % operator.

Performs the % operation. Read more

Serialize this value into the given Serde serializer. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

The resulting type after applying the - operator.

Performs the - operation. Read more

Performs the -= operation. Read more

Serialize this value into the given encoder.

Serialize this value into the given encoder.

Serialize this value into the given encoder.

Serialize this value into the given encoder.

Serialize this value into the given encoder.

Serialize this value into the given encoder.

Serialize this value into the given encoder.

Serialize this value into the given encoder.

Serialize this value into the given encoder.

Serialize this value into the given encoder.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Cast an instance of T into an instance of Self.

Cast an instance of Self into an instance of T.

Returns the argument unchanged.

Calls U::from(self).

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

Returns true if self can be cast into the target type T.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. Read more

Test if value can be cast into Self.

Returns Some(Self) if the source value can be cast into Self, otherwise None.

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.

Returns Ok(T) if self can be cast into T, otherwise calls on_err.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.