Create a array from a scalar input value.  
More...
 | 
| template<typename T >  | 
| array  | constant (T val, const dim4 &dims, const dtype ty=(af_dtype) dtype_traits< T >::ctype) | 
|   | 
| template<typename T >  | 
| array  | constant (T val, const dim_t d0, const af_dtype ty=(af_dtype) dtype_traits< T >::ctype) | 
|   | 
| template<typename T >  | 
| array  | constant (T val, const dim_t d0, const dim_t d1, const af_dtype ty=(af_dtype) dtype_traits< T >::ctype) | 
|   | 
| template<typename T >  | 
| 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) | 
|   | 
| template<typename T >  | 
| 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) | 
|   | 
| AFAPI af_err  | af_constant (af_array *arr, const double val, const unsigned ndims, const dim_t *const dims, const af_dtype type) | 
|   | 
| AFAPI af_err  | af_constant_complex (af_array *arr, const double real, const double imag, const unsigned ndims, const dim_t *const dims, const af_dtype type) | 
|   | 
| AFAPI af_err  | af_constant_long (af_array *arr, const intl val, const unsigned ndims, const dim_t *const dims) | 
|   | 
| AFAPI af_err  | af_constant_ulong (af_array *arr, const uintl val, const unsigned ndims, const dim_t *const dims) | 
|   | 
Create a array from a scalar input value. 
The array created has the same value at all locations
- Parameters
 - 
  
    | [out] | arr | is the generated array of given type  | 
    | [in] | val | is the value of each element in the generated array  | 
    | [in] | ndims | is size of dimension array dims  | 
    | [in] | dims | is the array containing sizes of the dimension  | 
    | [in] | type | is the type of array to generate  | 
  
   
 
 
- Parameters
 - 
  
    | [out] | arr | is the generated array of type c32 or c64  | 
    | [in] | real | is the real value of each element in the generated array  | 
    | [in] | imag | is the imaginary value of each element in the generated array  | 
    | [in] | ndims | is size of dimension array dims  | 
    | [in] | dims | is the array containing sizes of the dimension  | 
    | [in] | type | is the type of array to generate  | 
  
   
 
 
- Parameters
 - 
  
    | [out] | arr | is the generated array of type s64  | 
    | [in] | val | is a complex value of each element in the generated array  | 
    | [in] | ndims | is size of dimension array dims  | 
    | [in] | dims | is the array containing sizes of the dimension  | 
  
   
 
 
- Parameters
 - 
  
    | [out] | arr | is the generated array of type u64  | 
    | [in] | val | is a complex value of each element in the generated array  | 
    | [in] | ndims | is size of dimension array dims  | 
    | [in] | dims | is the array containing sizes of the dimension  | 
  
   
 
 
- Parameters
 - 
  
    | [in] | val | is the value of each element of the array be genrated  | 
    | [in] | dims | is the dimensions of the array to be generated  | 
    | [in] | ty | is the type of the array | 
  
   
- Returns
 - array of size 
dims  
- Examples: 
 - benchmarks/blas.cpp, computer_vision/harris.cpp, financial/heston_model.cpp, financial/monte_carlo_options.cpp, getting_started/rainfall.cpp, getting_started/vectorize.cpp, graphics/fractal.cpp, graphics/gravity_sim.cpp, image_processing/adaptive_thresholding.cpp, image_processing/brain_segmentation.cpp, image_processing/filters.cpp, image_processing/image_editing.cpp, image_processing/morphing.cpp, image_processing/optical_flow.cpp, image_processing/pyramids.cpp, machine_learning/bagging.cpp, machine_learning/deep_belief_net.cpp, machine_learning/kmeans.cpp, machine_learning/knn.cpp, machine_learning/logistic_regression.cpp, machine_learning/naive_bayes.cpp, machine_learning/neural_network.cpp, machine_learning/perceptron.cpp, machine_learning/rbm.cpp, machine_learning/softmax_regression.cpp, pde/swe.cpp, and unified/basic.cpp.
 
 
 
- Parameters
 - 
  
    | [in] | val | is the value of each element of the array to be generated  | 
    | [in] | d0 | is the size of the array to be generated  | 
    | [in] | ty | is the type of the array | 
  
   
- Returns
 - array of size 
d0  
 
 
- Parameters
 - 
  
    | [in] | val | is the value of each element of the array to be generated  | 
    | [in] | d0 | is the number of rows of the array to be generated  | 
    | [in] | d1 | is the number of columns of the array to be generated  | 
    | [in] | ty | is the type of the array | 
  
   
- Returns
 - array of size 
d0 x d1  
 
 
- Parameters
 - 
  
    | [in] | val | is the value of each element of the array to be generated  | 
    | [in] | d0 | is the size of the 1st dimension of the array to be generated  | 
    | [in] | d1 | is the size of the 2nd dimension of the array to be generated  | 
    | [in] | d2 | is the size of the 3rd dimension of the array to be generated  | 
    | [in] | ty | is the type of the array | 
  
   
- Returns
 - array of size 
d0 x d1 x d2  
 
 
- Parameters
 - 
  
    | [in] | val | is the value of each element of the array to be generated  | 
    | [in] | d0 | is the size of the 1st dimension of the array to be generated  | 
    | [in] | d1 | is the size of the 2nd dimension of the array to be generated  | 
    | [in] | d2 | is the size of the 3rd dimension of the array to be generated  | 
    | [in] | d3 | is the size of the 4rd dimension of the array to be generated  | 
    | [in] | ty | is the type of the array | 
  
   
- Returns
 - array of size 
d0 x d1 x d2 x d3