[−][src]Function arrayfire::max_ragged
pub fn max_ragged<T>(
input: &Array<T>,
ragged_len: &Array<u32>,
dim: i32
) -> (Array<T::InType>, Array<u32>) where
T: HasAfEnum,
T::InType: HasAfEnum,
Max reduction along given axis as per ragged lengths provided
Parameters
input
contains the input values to be reducedragged_len
array containing number of elements to use when reducing alongdim
dim
is the dimension along which the max operation occurs
Return Values
Tuple of Arrays:
- First element: An Array containing the maximum ragged values in
input
alongdim
according toragged_len
- Second Element: An Array containing the locations of the maximum ragged values in
input
alongdim
according toragged_len
Examples
use arrayfire::{Array, dim4, print, randu, max_ragged}; let vals: [f32; 6] = [1.0f32, 2.0, 3.0, 4.0, 5.0, 6.0]; let rlens: [u32; 2] = [9, 2]; let varr = Array::new(&vals, dim4![3, 2]); let rarr = Array::new(&rlens, dim4![1, 2]); print(&varr); // 1 4 // 2 5 // 3 6 print(&rarr); // numbers of elements to participate in reduction along given axis // 9 2 let (out, idx) = max_ragged(&varr, &rarr, 0); print(&out); // 3 5 print(&idx); // 2 1 //Since 3 is max element for given length 9 along first column //Since 5 is max element for given length 2 along second column