array constant(T val, const dim4 &dims, const af::dtype type) { af_array res; if (type != s64 && type != u64) { AF_THROW(af_constant(&res, (double)val, dims.ndims(), dims.get(), type)); } else if (type == s64) { AF_THROW(af_constant_long (&res, ( intl)val, dims.ndims(), dims.get())); } else { AF_THROW(af_constant_ulong(&res, (uintl)val, dims.ndims(), dims.get())); } return array(res); }
array constant(double val, const dim4 &dims, af_dtype type) { af_array res; AF_THROW(af_constant(&res, val, dims.ndims(), dims.get(), type)); return array(res); }