Skip to content

Commit 2e7ffe9

Browse files
committed
DOCS: Adding documentation for constant
1 parent 0af0fb5 commit 2e7ffe9

2 files changed

Lines changed: 100 additions & 6 deletions

File tree

docs/details/data.dox

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
\addtogroup arrayfire_func
33
@{
44

5+
\defgroup data_func_constant constant
6+
7+
\brief Create a array from a scalar input value
8+
9+
The array created has the same value at all locations
10+
11+
\ingroup data_mat
12+
\ingroup arrayfire_func
13+
14+
=======================================================================
15+
516
\defgroup data_func_randu randu
617

718
\brief Create a random array sampled from uniform distribution
@@ -295,4 +306,3 @@ Mirrors the array along the specified dimensions.
295306

296307
@}
297308
*/
298-

include/af/data.h

Lines changed: 89 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,71 @@ namespace af
1717
{
1818
class array;
1919

20+
/**
21+
\param[in] val is the value of each element of the array be genrated
22+
\param[in] dims is the dimensions of the array to be generated
23+
\param[in] ty is the type of the array
24+
25+
\return array of size \p dims
26+
27+
\ingroup data_func_constant
28+
*/
29+
2030
template<typename T>
2131
array constant(T val, const dim4 &dims, const dtype ty=(af_dtype)dtype_traits<T>::ctype);
2232

33+
/**
34+
\param[in] val is the value of each element of the array to be generated
35+
\param[in] d0 is the size of the array to be generated
36+
\param[in] ty is the type of the array
37+
38+
\return array of size \p d0
39+
40+
\ingroup data_func_constant
41+
*/
42+
2343
template<typename T>
2444
array constant(T val, const dim_t d0, const af_dtype ty=(af_dtype)dtype_traits<T>::ctype);
2545

46+
/**
47+
\param[in] val is the value of each element of the array to be generated
48+
\param[in] d0 is the number of rows of the array to be generated
49+
\param[in] d1 is the number of columns of the array to be generated
50+
\param[in] ty is the type of the array
51+
52+
\return array of size \p d0 x d1
53+
54+
\ingroup data_func_constant
55+
*/
2656
template<typename T>
2757
array constant(T val, const dim_t d0, const dim_t d1, const af_dtype ty=(af_dtype)dtype_traits<T>::ctype);
2858

59+
/**
60+
\param[in] val is the value of each element of the array to be generated
61+
\param[in] d0 is the size of the 1st dimension of the array to be generated
62+
\param[in] d1 is the size of the 2nd dimension of the array to be generated
63+
\param[in] d2 is the size of the 3rd dimension of the array to be generated
64+
\param[in] ty is the type of the array
65+
66+
\return array of size \p d0 x d1 x d2
67+
68+
\ingroup data_func_constant
69+
*/
2970
template<typename T>
3071
array constant(T val, const dim_t d0, const dim_t d1, const dim_t d2, const af_dtype ty=(af_dtype)dtype_traits<T>::ctype);
3172

73+
/**
74+
\param[in] val is the value of each element of the array to be generated
75+
\param[in] d0 is the size of the 1st dimension of the array to be generated
76+
\param[in] d1 is the size of the 2nd dimension of the array to be generated
77+
\param[in] d2 is the size of the 3rd dimension of the array to be generated
78+
\param[in] d3 is the size of the 4rd dimension of the array to be generated
79+
\param[in] ty is the type of the array
80+
81+
\return array of size \p d0 x d1 x d2 x d3
82+
83+
\ingroup data_func_constant
84+
*/
3285
template<typename T>
3386
array constant(T val, const dim_t d0, const dim_t d1, const dim_t d2, const dim_t d3, const af_dtype ty=(af_dtype)dtype_traits<T>::ctype);
3487

@@ -446,21 +499,52 @@ namespace af
446499
extern "C" {
447500
#endif
448501

502+
449503
/**
450-
\defgroup data_func_constant constant
451-
Create constant array from the specified dimensions
452-
@{
504+
\param[out] arr is the generated array of given type
505+
\param[in] val is the value of each element in the generated array
506+
\param[in] ndims is size of dimension array \p dims
507+
\param[in] dims is the array containing sizes of the dimension
508+
\param[in] type is the type of array to generate
453509
454-
\ingroup arrayfire_func
455-
\ingroup data_mat
510+
\ingroup data_func_constant
456511
*/
457512
AFAPI af_err af_constant(af_array *arr, const double val, const unsigned ndims, const dim_t * const dims, const af_dtype type);
458513

514+
/**
515+
\param[out] arr is the generated array of type \ref c32 or \ref c64
516+
\param[in] real is the real value of each element in the generated array
517+
\param[in] imag is the imaginary value of each element in the generated array
518+
\param[in] ndims is size of dimension array \p dims
519+
\param[in] dims is the array containing sizes of the dimension
520+
\param[in] type is the type of array to generate
521+
522+
\ingroup data_func_constant
523+
*/
524+
459525
AFAPI af_err af_constant_complex(af_array *arr, const double real, const double imag,
460526
const unsigned ndims, const dim_t * const dims, const af_dtype type);
461527

528+
/**
529+
\param[out] arr is the generated array of type \ref s64
530+
\param[in] val is a complex value of each element in the generated array
531+
\param[in] ndims is size of dimension array \p dims
532+
\param[in] dims is the array containing sizes of the dimension
533+
534+
\ingroup data_func_constant
535+
*/
536+
462537
AFAPI af_err af_constant_long (af_array *arr, const intl val, const unsigned ndims, const dim_t * const dims);
463538

539+
/**
540+
\param[out] arr is the generated array of type \ref u64
541+
\param[in] val is a complex value of each element in the generated array
542+
\param[in] ndims is size of dimension array \p dims
543+
\param[in] dims is the array containing sizes of the dimension
544+
545+
\ingroup data_func_constant
546+
*/
547+
464548
AFAPI af_err af_constant_ulong(af_array *arr, const uintl val, const unsigned ndims, const dim_t * const dims);
465549
/**
466550
@}

0 commit comments

Comments
 (0)