@@ -49,6 +49,16 @@ extern {
4949
5050macro_rules! dim_reduce_func_def {
5151 ( $fn_name: ident, $ffi_name: ident) => (
52+ /// Reduction operation along specific dimension
53+ ///
54+ /// # Parameters
55+ ///
56+ /// - `input` - Input Array
57+ /// - `dim` - Dimension along which the input Array will be reduced
58+ ///
59+ /// # Return Values
60+ ///
61+ /// Reduced Array
5262 #[ allow( unused_mut) ]
5363 pub fn $fn_name( input: & Array , dim: i32 ) -> Result <Array , AfError > {
5464 unsafe {
@@ -95,6 +105,16 @@ dim_reduce_func_def!(diff2, af_diff2);
95105
96106macro_rules! all_reduce_func_def {
97107 ( $fn_name: ident, $ffi_name: ident) => (
108+ /// Reduction operation of all values
109+ ///
110+ /// # Parameters
111+ ///
112+ /// `input` - Input Array
113+ ///
114+ /// # Return Values
115+ ///
116+ /// A tuple of reduction result. For non-complex data type Arrays, second value of tuple is
117+ /// zero.
98118 #[ allow( unused_mut) ]
99119 pub fn $fn_name( input: & Array ) -> Result <( f64 , f64 ) , AfError > {
100120 unsafe {
@@ -141,6 +161,18 @@ all_reduce_func_def!(count_all, af_count_all);
141161
142162macro_rules! dim_ireduce_func_def {
143163 ( $fn_name: ident, $ffi_name: ident) => (
164+ /// Reduction operation along specific dimension
165+ ///
166+ /// # Parameters
167+ ///
168+ /// - `input` - Input Array
169+ /// - `dim` - Dimension along which the input Array will be reduced
170+ ///
171+ /// # Return Values
172+ ///
173+ /// A tuple of Arrays: Reduced Array and Indices Array.
174+ ///
175+ /// The indices Array has the index of the result element along the reduction dimension.
144176 #[ allow( unused_mut) ]
145177 pub fn $fn_name( input: & Array , dim: i32 ) -> Result <( Array , Array ) , AfError > {
146178 unsafe {
@@ -162,6 +194,19 @@ dim_ireduce_func_def!(imax, af_imax);
162194
163195macro_rules! all_ireduce_func_def {
164196 ( $fn_name: ident, $ffi_name: ident) => (
197+ /// Reduction operation of all values
198+ ///
199+ /// # Parameters
200+ ///
201+ /// `input` - Input Array
202+ ///
203+ /// # Return Values
204+ ///
205+ /// A triplet of reduction result.
206+ ///
207+ /// The second value of the tuple is zero for non-complex data type Arrays.
208+ ///
209+ /// The third value of triplet is the index of result element from reduction operation.
165210 #[ allow( unused_mut) ]
166211 pub fn $fn_name( input: & Array ) -> Result <( f64 , f64 , u32 ) , AfError > {
167212 unsafe {
@@ -182,6 +227,17 @@ macro_rules! all_ireduce_func_def {
182227all_ireduce_func_def ! ( imin_all, af_imin_all) ;
183228all_ireduce_func_def ! ( imax_all, af_imax_all) ;
184229
230+ /// Locate the indices of non-zero elements.
231+ ///
232+ /// The locations are provided by flattening the input into a linear array.
233+ ///
234+ /// # Parameters
235+ ///
236+ /// - `input` - Input Array
237+ ///
238+ /// # Return Values
239+ ///
240+ /// Array of indices where the input Array has non-zero values.
185241#[ allow( unused_mut) ]
186242pub fn locate ( input : & Array ) -> Result < Array , AfError > {
187243 unsafe {
@@ -194,6 +250,19 @@ pub fn locate(input: &Array) -> Result<Array, AfError> {
194250 }
195251}
196252
253+ /// Sort the values in input Arrays
254+ ///
255+ /// Sort an multidimensional Array along a given dimension
256+ ///
257+ /// # Parameters
258+ ///
259+ /// - `input` - Input Array
260+ /// - `dim` - Dimension along which to sort
261+ /// - `ascending` - Sorted output will have ascending values if ```True``` and descending order otherwise.
262+ ///
263+ /// # Return Values
264+ ///
265+ /// Sorted Array.
197266#[ allow( unused_mut) ]
198267pub fn sort ( input : & Array , dim : u32 , ascending : bool ) -> Result < Array , AfError > {
199268 unsafe {
@@ -207,6 +276,21 @@ pub fn sort(input: &Array, dim: u32, ascending: bool) -> Result<Array, AfError>
207276 }
208277}
209278
279+ /// Sort the values in input Arrays
280+ ///
281+ /// # Parameters
282+ ///
283+ /// - `input` - Input Array
284+ /// - `dim` - Dimension along which to sort
285+ /// - `ascending` - Sorted output will have ascending values if ```True``` and descending order otherwise.
286+ ///
287+ /// # Return Values
288+ ///
289+ /// A tuple of Arrays.
290+ ///
291+ /// The first Array contains the keys based on sorted values.
292+ ///
293+ /// The second Array contains the original indices of the sorted values.
210294#[ allow( unused_mut) ]
211295pub fn sort_index ( input : & Array , dim : u32 , ascending : bool ) -> Result < ( Array , Array ) , AfError > {
212296 unsafe {
@@ -222,6 +306,24 @@ pub fn sort_index(input: &Array, dim: u32, ascending: bool) -> Result<(Array, Ar
222306 }
223307}
224308
309+ /// Sort the values in input Arrays
310+ ///
311+ /// Sort an multidimensional Array based on keys
312+ ///
313+ /// # Parameters
314+ ///
315+ /// - `keys` - Array with key values
316+ /// - `vals` - Array with input values
317+ /// - `dim` - Dimension along which to sort
318+ /// - `ascending` - Sorted output will have ascending values if ```True``` and descending order otherwise.
319+ ///
320+ /// # Return Values
321+ ///
322+ /// A tuple of Arrays.
323+ ///
324+ /// The first Array contains the keys based on sorted values.
325+ ///
326+ /// The second Array contains the sorted values.
225327#[ allow( unused_mut) ]
226328pub fn sort_by_key ( keys : & Array , vals : & Array , dim : u32 ,
227329 ascending : bool ) -> Result < ( Array , Array ) , AfError > {
@@ -238,6 +340,16 @@ pub fn sort_by_key(keys: &Array, vals: &Array, dim: u32,
238340 }
239341}
240342
343+ /// Find unique values from a Set
344+ ///
345+ /// # Parameters
346+ ///
347+ /// - `input` - Input Array
348+ /// - `is_sorted` - is a boolean variable. If ```True`` indicates, the `input` Array is sorted.
349+ ///
350+ /// # Return Values
351+ ///
352+ /// An Array of unique values from the input Array.
241353#[ allow( unused_mut) ]
242354pub fn set_unique ( input : & Array , is_sorted : bool ) -> Result < Array , AfError > {
243355 unsafe {
@@ -251,6 +363,17 @@ pub fn set_unique(input: &Array, is_sorted: bool) -> Result<Array, AfError> {
251363 }
252364}
253365
366+ /// Find union of two sets
367+ ///
368+ /// # Parameters
369+ ///
370+ /// - `first` is one of the input sets
371+ /// - `second` is the other of the input sets
372+ /// - `is_unique` is a boolean value indicates if the input sets are unique
373+ ///
374+ /// # Return Values
375+ ///
376+ /// An Array with union of the input sets
254377#[ allow( unused_mut) ]
255378pub fn set_union ( first : & Array , second : & Array , is_unique : bool ) -> Result < Array , AfError > {
256379 unsafe {
@@ -264,6 +387,17 @@ pub fn set_union(first: &Array, second: &Array, is_unique: bool) -> Result<Array
264387 }
265388}
266389
390+ /// Find intersection of two sets
391+ ///
392+ /// # Parameters
393+ ///
394+ /// - `first` is one of the input sets
395+ /// - `second` is the other of the input sets
396+ /// - `is_unique` is a boolean value indicates if the input sets are unique
397+ ///
398+ /// # Return Values
399+ ///
400+ /// An Array with intersection of the input sets
267401#[ allow( unused_mut) ]
268402pub fn set_intersect ( first : & Array , second : & Array , is_unique : bool ) -> Result < Array , AfError > {
269403 unsafe {
0 commit comments