JuliaGPU / ArrayFire.jl
1
# Julia wrapper for header: /usr/include/arrayfire.h
2
# Automatically generated using Clang.jl wrap_c, version 0.0.0
3

4

5
export abs, accum, acos, acosh, add, afinfo, afinit, afversion, all, all_true_all, alloc_device, and, anisotropic_diffusion
6
export any, any_true_all, approx1, approx2, arg, array_to_string, asin, asinh, assign_seq, atan, atan2
7
export atanh, bilateral, bitand, bitor, bitshiftl, bitshiftr, bitxor, canny, cbrt, ceil, cholesky_inplace
8
export color_space, complex, conj, convolve1, convolve2, convolve2_sep, convolve3, copy, corrcoef, cos
9
export cosh, count, count_all, cov, create_features, create_handle, create_indexers, create_random_engine
10
export create_sparse_array, create_sparse_array_from_dense, create_sparse_array_from_ptr, create_window
11
export delete_image_memory, destroy_window, det, device_array, device_gc, diag, diagm
12
export diff1, diff2, dilate, dilate3, div, dog, dot, dot_all, draw_hist, draw_image, draw_plot, draw_plot3
13
export draw_plot_2d, draw_plot_3d, draw_plot_nd, draw_scatter, draw_scatter3, draw_scatter_2d, draw_scatter_3d
14
export draw_scatter_nd, draw_surface, draw_vector_field_2d, draw_vector_field_3d, draw_vector_field_nd
15
export eq, erf, erfc, erode, erode3, exp, expm1, factorial, fast, flip, floor, free_device, full, gaussian_kernel
16
export ge, get_active_backend, get_available_backends, get_backend_count, get_backend_id, get_data_ptr
17
export get_dbl_support, get_default_random_engine, get_device, get_device_count, get_device_id, get_device_ptr
18
export get_dims, get_elements, get_features_num, get_features_orientation, get_features_score, get_features_size
19
export get_features_xpos, get_features_ypos, get_manual_eval_flag, get_mem_step_size, get_revision, get_seed
20
export gloh, gradient, gray2rgb, gt, hamming_matcher, harris, hist_equal, histogram, homography, hsv2rgb
21
export hypot, identity, imag, imax, imax_all, imin, imin_all, index, index_gen, inverse, iota, is_bool
22
export is_column, is_complex, is_double, is_empty, is_floating, is_image_io_available, is_integer, is_lapack_available
23
export is_locked_array, is_real, is_realfloating, is_row, is_scalar, is_single, is_vector, is_window_closed
24
export isinf, isnan, issparse, iszero, le, lgamma, load_image, load_image_memory, load_image_native, lock_array
25
export lock_device_ptr, log, log10, log1p, log2, lookup, lower, lt, lu, lu_inplace, make_seq, match_template
26
export matmul, max_all, maxfilt, maximum, maxof, mean_all, mean_all_weighted, mean_shift, medfilt, medfilt1
27
export medfilt2, median_all, min_all, minfilt, minimum, minof, mod, moments, moments_all, mul, nearest_neighbour
28
export neq, norm, not, or, orb, pow, pow2, print_array, print_array_gen, print_mem_info, prod, product_all
29
export product_nan, product_nan_all, qr, qr_inplace, random_engine_get_seed, random_engine_get_type, random_engine_set_seed
30
export random_engine_set_type, random_normal, random_uniform, range, rank, read_array_index, read_array_key
31
export read_array_key_check, real, regions, release_features, release_random_engine, rem, reorder, replace
32
export replace, resize, retain_features, retain_random_engine, rgb2gray, rgb2hsv, rgb2ycbcr, root, rotate
33
export round, sat, save_array, save_image, save_image_memory, save_image_native, scale, scan, scan_by_key
34
export set_axes_limits_2d, set_axes_limits_3d, set_axes_limits_compute, set_axes_titles, set_backend, set_default_random_engine_type
35
export set_device, set_intersect, set_manual_eval_flag, set_mem_step_size, set_position, set_seed, set_size
36
export set_title, set_union, set_unique, set_visibility, shift, show_window, sift, sigmoid, signbit, sin, sinh
37
export skew, sobel_operator, solve, solve_lu, sort_by_key, sparse_convert_to, sparse_get_col_idx, sparse_get_info
38
export sparse_get_nnz, sparse_get_row_idx, sparse_get_storage, sparse_get_values, sqrt, stdev_all, sub
39
export sum, sum_all, sum_nan, sum_nan_all, susan, svd_inplace, sync, tan, tanh, tgamma, tile, topk, transform
40
export transform_coordinates, translate, transpose_inplace, trunc, unlock_array, unlock_device_ptr, unwrap
41
export upper, var_all, var_all_weighted, wrap, write_array, ycbcr2rgb
42

43
function sum(_in::AFArray{T,N},dim::Integer) where {T,N}
44 4
    out = RefValue{af_array}(0)
45 4
    _error(ccall((:af_sum,af_lib),af_err,(Ptr{af_array},af_array,Cint),out,_in.arr,Cint(dim - 1)))
46 4
    AFArray!(out[])
47
end
48

49
function sum_nan(_in::AFArray{T,N},dim::Integer,nanval::Real) where {T,N}
50 0
    out = RefValue{af_array}(0)
51 0
    _error(ccall((:af_sum_nan,af_lib),af_err,(Ptr{af_array},af_array,Cint,Cdouble),out,_in.arr,Cint(dim - 1),Cdouble(nanval)))
52 0
    AFArray{T,N}(out[])
53
end
54

55
function prod(_in::AFArray{T,N},dim::Integer) where {T,N}
56 4
    out = RefValue{af_array}(0)
57 4
    _error(ccall((:af_product,af_lib),af_err,(Ptr{af_array},af_array,Cint),out,_in.arr,Cint(dim - 1)))
58 4
    AFArray{T,N}(out[])
59
end
60

61
function product_nan(_in::AFArray{T,N},dim::Integer,nanval::Real) where {T,N}
62 0
    out = RefValue{af_array}(0)
63 0
    _error(ccall((:af_product_nan,af_lib),af_err,(Ptr{af_array},af_array,Cint,Cdouble),out,_in.arr,Cint(dim - 1),Cdouble(nanval)))
64 0
    AFArray{T,N}(out[])
65
end
66

67
function minimum(_in::AFArray{T,N},dim::Integer) where {T,N}
68 4
    out = RefValue{af_array}(0)
69 4
    _error(ccall((:af_min,af_lib),af_err,(Ptr{af_array},af_array,Cint),out,_in.arr,Cint(dim - 1)))
70 4
    AFArray{T,N}(out[])
71
end
72

73
function maximum(_in::AFArray{T,N},dim::Integer) where {T,N}
74 4
    out = RefValue{af_array}(0)
75 4
    _error(ccall((:af_max,af_lib),af_err,(Ptr{af_array},af_array,Cint),out,_in.arr,Cint(dim - 1)))
76 4
    AFArray{T,N}(out[])
77
end
78

79
function all(_in::AFArray{T,N},dim::Integer) where {T,N}
80 4
    out = RefValue{af_array}(0)
81 4
    _error(ccall((:af_all_true,af_lib),af_err,(Ptr{af_array},af_array,Cint),out,_in.arr,Cint(dim - 1)))
82 4
    AFArray{T,N}(out[])
83
end
84

85
function any(_in::AFArray{T,N},dim::Integer) where {T,N}
86 4
    out = RefValue{af_array}(0)
87 4
    _error(ccall((:af_any_true,af_lib),af_err,(Ptr{af_array},af_array,Cint),out,_in.arr,Cint(dim - 1)))
88 4
    AFArray{T,N}(out[])
89
end
90

91
function count(_in::AFArray{T,N},dim::Integer) where {T,N}
92 0
    out = RefValue{af_array}(0)
93 0
    _error(ccall((:af_count,af_lib),af_err,(Ptr{af_array},af_array,Cint),out,_in.arr,Cint(dim - 1)))
94 0
    AFArray{T,N}(out[])
95
end
96

97
function sum_all(_in::AFArray)
98 3
    real = RefValue{Cdouble}(0)
99 3
    imag = RefValue{Cdouble}(0)
100 4
    _error(ccall((:af_sum_all,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array),real,imag,_in.arr))
101 3
    (real[],imag[])
102
end
103

104
function sum_nan_all(_in::AFArray,nanval::Real)
105 0
    real = RefValue{Cdouble}(0)
106 0
    imag = RefValue{Cdouble}(0)
107 0
    _error(ccall((:af_sum_nan_all,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array,Cdouble),real,imag,_in.arr,Cdouble(nanval)))
108 0
    (real[],imag[])
109
end
110

111
function product_all(_in::AFArray)
112 3
    real = RefValue{Cdouble}(0)
113 3
    imag = RefValue{Cdouble}(0)
114 4
    _error(ccall((:af_product_all,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array),real,imag,_in.arr))
115 3
    (real[],imag[])
116
end
117

118
function product_nan_all(_in::AFArray,nanval::Real)
119 0
    real = RefValue{Cdouble}(0)
120 0
    imag = RefValue{Cdouble}(0)
121 0
    _error(ccall((:af_product_nan_all,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array,Cdouble),real,imag,_in.arr,Cdouble(nanval)))
122 0
    (real[],imag[])
123
end
124

125
function min_all(_in::AFArray)
126 3
    real = RefValue{Cdouble}(0)
127 3
    imag = RefValue{Cdouble}(0)
128 4
    _error(ccall((:af_min_all,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array),real,imag,_in.arr))
129 3
    (real[],imag[])
130
end
131

132
function max_all(_in::AFArray)
133 3
    real = RefValue{Cdouble}(0)
134 3
    imag = RefValue{Cdouble}(0)
135 4
    _error(ccall((:af_max_all,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array),real,imag,_in.arr))
136 3
    (real[],imag[])
137
end
138

139
function all_true_all(_in::AFArray)
140 3
    real = RefValue{Cdouble}(0)
141 3
    imag = RefValue{Cdouble}(0)
142 4
    _error(ccall((:af_all_true_all,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array),real,imag,_in.arr))
143 3
    (real[],imag[])
144
end
145

146
function any_true_all(_in::AFArray)
147 3
    real = RefValue{Cdouble}(0)
148 3
    imag = RefValue{Cdouble}(0)
149 4
    _error(ccall((:af_any_true_all,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array),real,imag,_in.arr))
150 3
    (real[],imag[])
151
end
152

153
function count_all(_in::AFArray)
154 0
    real = RefValue{Cdouble}(0)
155 0
    imag = RefValue{Cdouble}(0)
156 0
    _error(ccall((:af_count_all,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array),real,imag,_in.arr))
157 0
    (real[],imag[])
158
end
159

160
function imin(_in::AFArray,dim::Integer)
161 0
    out = RefValue{af_array}(0)
162 0
    idx = RefValue{af_array}(0)
163 0
    _error(ccall((:af_imin,af_lib),af_err,(Ptr{af_array},Ptr{af_array},af_array,Cint),out,idx,_in.arr,Cint(dim - 1)))
164 0
    (AFArray!(out[]),AFArray!(idx[]))
165
end
166

167
function imax(_in::AFArray,dim::Integer)
168 0
    out = RefValue{af_array}(0)
169 0
    idx = RefValue{af_array}(0)
170 0
    _error(ccall((:af_imax,af_lib),af_err,(Ptr{af_array},Ptr{af_array},af_array,Cint),out,idx,_in.arr,Cint(dim - 1)))
171 0
    (AFArray!(out[]),AFArray!(idx[]))
172
end
173

174
function imin_all(_in::AFArray)
175 0
    real = RefValue{Cdouble}(0)
176 0
    imag = RefValue{Cdouble}(0)
177 0
    idx = RefValue{UInt32}(0)
178 0
    _error(ccall((:af_imin_all,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},Ptr{UInt32},af_array),real,imag,idx,_in.arr))
179 0
    (real[],imag[],idx[])
180
end
181

182
function imax_all(_in::AFArray)
183 0
    real = RefValue{Cdouble}(0)
184 0
    imag = RefValue{Cdouble}(0)
185 0
    idx = RefValue{UInt32}(0)
186 0
    _error(ccall((:af_imax_all,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},Ptr{UInt32},af_array),real,imag,idx,_in.arr))
187 0
    (real[],imag[],idx[])
188
end
189

190
function accum(_in::AFArray{T,N},dim::Integer) where {T,N}
191 0
    out = RefValue{af_array}(0)
192 0
    _error(ccall((:af_accum,af_lib),af_err,(Ptr{af_array},af_array,Cint),out,_in.arr,Cint(dim - 1)))
193 0
    AFArray{T,N}(out[])
194
end
195

196
function scan(_in::AFArray{T,N},dim::Integer,op::af_binary_op,inclusive_scan::Bool) where {T,N}
197 3
    out = RefValue{af_array}(0)
198 4
    _error(ccall((:af_scan,af_lib),af_err,(Ptr{af_array},af_array,Cint,af_binary_op,Bool),out,_in.arr,Cint(dim - 1),op,inclusive_scan))
199 4
    AFArray{T,N}(out[])
200
end
201

202
function scan_by_key(key::AFArray,_in::AFArray,dim::Integer,op::af_binary_op,inclusive_scan::Bool)
203 0
    out = RefValue{af_array}(0)
204 0
    _error(ccall((:af_scan_by_key,af_lib),af_err,(Ptr{af_array},af_array,af_array,Cint,af_binary_op,Bool),out,key.arr,_in.arr,Cint(dim - 1),op,inclusive_scan))
205 0
    AFArray!(out[])
206
end
207

208
function diff1(_in::AFArray{T,N},dim::Integer) where {T,N}
209 0
    out = RefValue{af_array}(0)
210 0
    _error(ccall((:af_diff1,af_lib),af_err,(Ptr{af_array},af_array,Cint),out,_in.arr,Cint(dim - 1)))
211 0
    AFArray{T,N}(out[])
212
end
213

214
function diff2(_in::AFArray{T,N},dim::Integer) where {T,N}
215 0
    out = RefValue{af_array}(0)
216 0
    _error(ccall((:af_diff2,af_lib),af_err,(Ptr{af_array},af_array,Cint),out,_in.arr,Cint(dim - 1)))
217 0
    AFArray{T,N}(out[])
218
end
219

220
function sort_by_key(keys::AFArray,values::AFArray,dim::Integer,isAscending::Bool)
221 0
    out_keys = RefValue{af_array}(0)
222 0
    out_values = RefValue{af_array}(0)
223 0
    _error(ccall((:af_sort_by_key,af_lib),af_err,(Ptr{af_array},Ptr{af_array},af_array,af_array,UInt32,Bool),out_keys,out_values,keys.arr,values.arr,UInt32(dim - 1),isAscending))
224 0
    (AFArray!(out_keys[]),AFArray!(out_values[]))
225
end
226

227
function set_unique(_in::AFArray{T,N},is_sorted::Bool) where {T,N}
228 0
    out = RefValue{af_array}(0)
229 0
    _error(ccall((:af_set_unique,af_lib),af_err,(Ptr{af_array},af_array,Bool),out,_in.arr,is_sorted))
230 0
    AFArray{T,N}(out[])
231
end
232

233
function set_union(first::AFArray,second::AFArray,is_unique::Bool)
234 0
    out = RefValue{af_array}(0)
235 0
    _error(ccall((:af_set_union,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,first.arr,second.arr,is_unique))
236 0
    AFArray!(out[])
237
end
238

239
function set_intersect(first::AFArray,second::AFArray,is_unique::Bool)
240 0
    out = RefValue{af_array}(0)
241 0
    _error(ccall((:af_set_intersect,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,first.arr,second.arr,is_unique))
242 0
    AFArray!(out[])
243
end
244

245
function add(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
246 3
    out = RefValue{af_array}(0)
247 4
    _error(ccall((:af_add,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
248 4
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
249
end
250

251
function sub(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
252 3
    out = RefValue{af_array}(0)
253 4
    _error(ccall((:af_sub,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
254 4
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
255
end
256

257
function mul(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
258 3
    out = RefValue{af_array}(0)
259 4
    _error(ccall((:af_mul,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
260 4
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
261
end
262

263
function div(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
264 3
    out = RefValue{af_array}(0)
265 4
    _error(ccall((:af_div,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
266 4
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
267
end
268

269
function lt(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
270 3
    out = RefValue{af_array}(0)
271 4
    _error(ccall((:af_lt,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
272 4
    AFArray{Bool,batched(N1,N2)}(out[])
273
end
274

275
function gt(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
276 3
    out = RefValue{af_array}(0)
277 4
    _error(ccall((:af_gt,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
278 4
    AFArray{Bool,batched(N1,N2)}(out[])
279
end
280

281
function le(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
282 3
    out = RefValue{af_array}(0)
283 4
    _error(ccall((:af_le,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
284 4
    AFArray{Bool,batched(N1,N2)}(out[])
285
end
286

287
function ge(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
288 3
    out = RefValue{af_array}(0)
289 4
    _error(ccall((:af_ge,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
290 4
    AFArray{Bool,batched(N1,N2)}(out[])
291
end
292

293
function eq(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
294 3
    out = RefValue{af_array}(0)
295 4
    _error(ccall((:af_eq,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
296 4
    AFArray{Bool,batched(N1,N2)}(out[])
297
end
298

299
function neq(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
300 3
    out = RefValue{af_array}(0)
301 4
    _error(ccall((:af_neq,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
302 4
    AFArray{Bool,batched(N1,N2)}(out[])
303
end
304

305
function and(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
306 3
    out = RefValue{af_array}(0)
307 4
    _error(ccall((:af_and,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
308 4
    AFArray{Bool,batched(N1,N2)}(out[])
309
end
310

311
function or(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
312 3
    out = RefValue{af_array}(0)
313 4
    _error(ccall((:af_or,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
314 4
    AFArray{Bool,batched(N1,N2)}(out[])
315
end
316

317
function not(_in::AFArray{T,N}) where {T,N}
318 3
    out = RefValue{af_array}(0)
319 4
    _error(ccall((:af_not,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
320 4
    AFArray{Bool,N}(out[])
321
end
322

323
function bitand(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
324 3
    out = RefValue{af_array}(0)
325 4
    _error(ccall((:af_bitand,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
326 4
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
327
end
328

329
function bitor(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
330 3
    out = RefValue{af_array}(0)
331 4
    _error(ccall((:af_bitor,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
332 4
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
333
end
334

335
function bitxor(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
336 3
    out = RefValue{af_array}(0)
337 4
    _error(ccall((:af_bitxor,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
338 4
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
339
end
340

341
function bitshiftl(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
342 3
    out = RefValue{af_array}(0)
343 4
    _error(ccall((:af_bitshiftl,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
344 4
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
345
end
346

347
function bitshiftr(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
348 3
    out = RefValue{af_array}(0)
349 4
    _error(ccall((:af_bitshiftr,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
350 4
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
351
end
352

353
function minof(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
354 3
    out = RefValue{af_array}(0)
355 4
    _error(ccall((:af_minof,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
356 4
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
357
end
358

359
function maxof(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
360 3
    out = RefValue{af_array}(0)
361 4
    _error(ccall((:af_maxof,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
362 4
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
363
end
364

365
function rem(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
366 0
    out = RefValue{af_array}(0)
367 0
    _error(ccall((:af_rem,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
368 0
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
369
end
370

371
function mod(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
372 0
    out = RefValue{af_array}(0)
373 0
    _error(ccall((:af_mod,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
374 0
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
375
end
376

377
function abs(_in::AFArray{T,N}) where {T,N}
378 4
    out = RefValue{af_array}(0)
379 4
    _error(ccall((:af_abs,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
380 4
    AFArray{T,N}(out[])
381
end
382

383
function arg(_in::AFArray{T,N}) where {T,N}
384 0
    out = RefValue{af_array}(0)
385 0
    _error(ccall((:af_arg,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
386 0
    AFArray{T,N}(out[])
387
end
388

389
function signbit(_in::AFArray{T,N}) where {T,N}
390 4
    out = RefValue{af_array}(0)
391 4
    _error(ccall((:af_sign,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
392 4
    AFArray{Float32,N}(out[])
393
end
394

395
function round(_in::AFArray{T,N}) where {T,N}
396 4
    out = RefValue{af_array}(0)
397 4
    _error(ccall((:af_round,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
398 4
    AFArray{T,N}(out[])
399
end
400

401
function trunc(_in::AFArray{T,N}) where {T,N}
402 4
    out = RefValue{af_array}(0)
403 4
    _error(ccall((:af_trunc,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
404 4
    AFArray{T,N}(out[])
405
end
406

407
function floor(_in::AFArray{T,N}) where {T,N}
408 4
    out = RefValue{af_array}(0)
409 4
    _error(ccall((:af_floor,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
410 4
    AFArray{T,N}(out[])
411
end
412

413
function ceil(_in::AFArray{T,N}) where {T,N}
414 4
    out = RefValue{af_array}(0)
415 4
    _error(ccall((:af_ceil,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
416 4
    AFArray{T,N}(out[])
417
end
418

419
function hypot(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
420 0
    out = RefValue{af_array}(0)
421 0
    _error(ccall((:af_hypot,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
422 0
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
423
end
424

425
function sin(_in::AFArray{T,N}) where {T,N}
426 4
    out = RefValue{af_array}(0)
427 4
    _error(ccall((:af_sin,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
428 4
    AFArray{T,N}(out[])
429
end
430

431
function cos(_in::AFArray{T,N}) where {T,N}
432 4
    out = RefValue{af_array}(0)
433 4
    _error(ccall((:af_cos,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
434 4
    AFArray{T,N}(out[])
435
end
436

437
function tan(_in::AFArray{T,N}) where {T,N}
438 4
    out = RefValue{af_array}(0)
439 4
    _error(ccall((:af_tan,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
440 4
    AFArray{T,N}(out[])
441
end
442

443
function asin(_in::AFArray{T,N}) where {T,N}
444 4
    out = RefValue{af_array}(0)
445 4
    _error(ccall((:af_asin,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
446 4
    AFArray{T,N}(out[])
447
end
448

449
function acos(_in::AFArray{T,N}) where {T,N}
450 4
    out = RefValue{af_array}(0)
451 4
    _error(ccall((:af_acos,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
452 4
    AFArray{T,N}(out[])
453
end
454

455
function atan(_in::AFArray{T,N}) where {T,N}
456 4
    out = RefValue{af_array}(0)
457 4
    _error(ccall((:af_atan,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
458 4
    AFArray{T,N}(out[])
459
end
460

461
function atan2(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
462 0
    out = RefValue{af_array}(0)
463 0
    _error(ccall((:af_atan2,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
464 0
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
465
end
466

467
function complex(_in::AFArray{T,N}) where {T,N}
468 4
    out = RefValue{af_array}(0)
469 4
    _error(ccall((:af_cplx,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
470 4
    AFArray{Complex{T},N}(out[])
471
end
472

473
function real(_in::AFArray{Complex{T},N}) where {T,N}
474 4
    out = RefValue{af_array}(0)
475 4
    _error(ccall((:af_real,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
476 4
    AFArray{T,N}(out[])
477
end
478

479
function imag(_in::AFArray{Complex{T},N}) where {T,N}
480 4
    out = RefValue{af_array}(0)
481 4
    _error(ccall((:af_imag,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
482 4
    AFArray{T,N}(out[])
483
end
484

485
function conj(_in::AFArray{T,N}) where {T,N}
486 4
    out = RefValue{af_array}(0)
487 4
    _error(ccall((:af_conjg,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
488 4
    AFArray{T,N}(out[])
489
end
490

491
function sinh(_in::AFArray{T,N}) where {T,N}
492 4
    out = RefValue{af_array}(0)
493 4
    _error(ccall((:af_sinh,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
494 4
    AFArray{T,N}(out[])
495
end
496

497
function cosh(_in::AFArray{T,N}) where {T,N}
498 4
    out = RefValue{af_array}(0)
499 4
    _error(ccall((:af_cosh,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
500 4
    AFArray{T,N}(out[])
501
end
502

503
function tanh(_in::AFArray{T,N}) where {T,N}
504 4
    out = RefValue{af_array}(0)
505 4
    _error(ccall((:af_tanh,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
506 4
    AFArray{T,N}(out[])
507
end
508

509
function asinh(_in::AFArray{T,N}) where {T,N}
510 0
    out = RefValue{af_array}(0)
511 0
    _error(ccall((:af_asinh,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
512 0
    AFArray{T,N}(out[])
513
end
514

515
function acosh(_in::AFArray{T,N}) where {T,N}
516 0
    out = RefValue{af_array}(0)
517 0
    _error(ccall((:af_acosh,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
518 0
    AFArray{T,N}(out[])
519
end
520

521
function atanh(_in::AFArray{T,N}) where {T,N}
522 0
    out = RefValue{af_array}(0)
523 0
    _error(ccall((:af_atanh,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
524 0
    AFArray{T,N}(out[])
525
end
526

527
function root(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
528 0
    out = RefValue{af_array}(0)
529 0
    _error(ccall((:af_root,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
530 0
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
531
end
532

533
function pow(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},batch::Bool) where {T1,N1,T2,N2}
534 3
    out = RefValue{af_array}(0)
535 4
    _error(ccall((:af_pow,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,lhs.arr,rhs.arr,batch))
536 4
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
537
end
538

539
function pow2(_in::AFArray{T,N}) where {T,N}
540 0
    out = RefValue{af_array}(0)
541 0
    _error(ccall((:af_pow2,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
542 0
    AFArray{T,N}(out[])
543
end
544

545
function exp(_in::AFArray{T,N}) where {T,N}
546 4
    out = RefValue{af_array}(0)
547 4
    _error(ccall((:af_exp,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
548 4
    AFArray{T,N}(out[])
549
end
550

551
function sigmoid(_in::AFArray{T,N}) where {T,N}
552 0
    out = RefValue{af_array}(0)
553 0
    _error(ccall((:af_sigmoid,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
554 0
    AFArray{T,N}(out[])
555
end
556

557
function expm1(_in::AFArray{T,N}) where {T,N}
558 4
    out = RefValue{af_array}(0)
559 4
    _error(ccall((:af_expm1,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
560 4
    AFArray{T,N}(out[])
561
end
562

563
function erf(_in::AFArray{T,N}) where {T,N}
564 3
    out = RefValue{af_array}(0)
565 4
    _error(ccall((:af_erf,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
566 4
    AFArray{T,N}(out[])
567
end
568

569
function erfc(_in::AFArray{T,N}) where {T,N}
570 4
    out = RefValue{af_array}(0)
571 4
    _error(ccall((:af_erfc,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
572 4
    AFArray{T,N}(out[])
573
end
574

575
function log(_in::AFArray{T,N}) where {T,N}
576 4
    out = RefValue{af_array}(0)
577 4
    _error(ccall((:af_log,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
578 4
    AFArray{T,N}(out[])
579
end
580

581
function log1p(_in::AFArray{T,N}) where {T,N}
582 4
    out = RefValue{af_array}(0)
583 4
    _error(ccall((:af_log1p,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
584 4
    AFArray{T,N}(out[])
585
end
586

587
function log10(_in::AFArray{T,N}) where {T,N}
588 4
    out = RefValue{af_array}(0)
589 4
    _error(ccall((:af_log10,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
590 4
    AFArray{T,N}(out[])
591
end
592

593
function log2(_in::AFArray{T,N}) where {T,N}
594 4
    out = RefValue{af_array}(0)
595 4
    _error(ccall((:af_log2,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
596 4
    AFArray{T,N}(out[])
597
end
598

599
function sqrt(_in::AFArray{T,N}) where {T,N}
600 4
    out = RefValue{af_array}(0)
601 4
    _error(ccall((:af_sqrt,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
602 4
    AFArray{T,N}(out[])
603
end
604

605
function cbrt(_in::AFArray{T,N}) where {T,N}
606 4
    out = RefValue{af_array}(0)
607 4
    _error(ccall((:af_cbrt,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
608 4
    AFArray{T,N}(out[])
609
end
610

611
function factorial(_in::AFArray{T,N}) where {T,N}
612 0
    out = RefValue{af_array}(0)
613 0
    _error(ccall((:af_factorial,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
614 0
    AFArray{T,N}(out[])
615
end
616

617
function tgamma(_in::AFArray{T,N}) where {T,N}
618 0
    out = RefValue{af_array}(0)
619 0
    _error(ccall((:af_tgamma,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
620 0
    AFArray{T,N}(out[])
621
end
622

623
function lgamma(_in::AFArray{T,N}) where {T,N}
624 4
    out = RefValue{af_array}(0)
625 4
    _error(ccall((:af_lgamma,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
626 4
    AFArray{T,N}(out[])
627
end
628

629
function iszero(_in::AFArray{T,N}) where {T,N}
630 0
    out = RefValue{af_array}(0)
631 0
    _error(ccall((:af_iszero,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
632 0
    AFArray{Bool,N}(out[])
633
end
634

635
function isinf(_in::AFArray{T,N}) where {T,N}
636 4
    out = RefValue{af_array}(0)
637 4
    _error(ccall((:af_isinf,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
638 4
    AFArray{Bool,N}(out[])
639
end
640

641
function isnan(_in::AFArray{T,N}) where {T,N}
642 4
    out = RefValue{af_array}(0)
643 4
    _error(ccall((:af_isnan,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
644 4
    AFArray{Bool,N}(out[])
645
end
646

647
function make_seq(_begin::Real,_end::Real,step::Real)
648 0
    ccall((:af_make_seq,af_lib),af_seq,(Cdouble,Cdouble,Cdouble),Cdouble(_begin),Cdouble(_end),Cdouble(step))
649
end
650

651
function print_array(arr::AFArray)
652 0
    _error(ccall((:af_print_array,af_lib),af_err,(af_array,),arr.arr))
653
end
654

655
function print_array_gen(exp,arr::AFArray,precision::Integer)
656 0
    _error(ccall((:af_print_array_gen,af_lib),af_err,(Cstring,af_array,Cint),exp,arr.arr,Cint(precision)))
657
end
658

659
function save_array(key,arr::AFArray,filename,append::Bool)
660 0
    index = RefValue{Cint}(0)
661 0
    _error(ccall((:af_save_array,af_lib),af_err,(Ptr{Cint},Cstring,af_array,Cstring,Bool),index,key,arr.arr,filename,append))
662 0
    index[]
663
end
664

665
function read_array_index(filename,index::Integer)
666 0
    out = RefValue{af_array}(0)
667 0
    _error(ccall((:af_read_array_index,af_lib),af_err,(Ptr{af_array},Cstring,UInt32),out,filename,UInt32(index)))
668 0
    AFArray!(out[])
669
end
670

671
function read_array_key(filename,key)
672 0
    out = RefValue{af_array}(0)
673 0
    _error(ccall((:af_read_array_key,af_lib),af_err,(Ptr{af_array},Cstring,Cstring),out,filename,key))
674 0
    AFArray!(out[])
675
end
676

677
function read_array_key_check(filename,key)
678 0
    index = RefValue{Cint}(0)
679 0
    _error(ccall((:af_read_array_key_check,af_lib),af_err,(Ptr{Cint},Cstring,Cstring),index,filename,key))
680 0
    index[]
681
end
682

683
function array_to_string(exp,arr::AFArray,precision::Integer,transpose::Bool)
684 0
    output = RefValue{Cstring}()
685 0
    _error(ccall((:af_array_to_string,af_lib),af_err,(Ptr{Cstring},Cstring,af_array,Cint,Bool),output,exp,arr.arr,Cint(precision),transpose))
686 0
    output[]
687
end
688

689
function afversion()
690 0
    major = RefValue{Cint}(0)
691 0
    minor = RefValue{Cint}(0)
692 0
    patch = RefValue{Cint}(0)
693 0
    _error(ccall((:af_get_version,af_lib),af_err,(Ptr{Cint},Ptr{Cint},Ptr{Cint}),major,minor,patch))
694 0
    (major[],minor[],patch[])
695
end
696

697
function get_revision()
698 0
    ccall((:af_get_revision,af_lib),Cstring,())
699
end
700

701
function index(_in::AFArray{T,N},ndims::Integer,index) where {T,N}
702 0
    out = RefValue{af_array}(0)
703 0
    _error(ccall((:af_index,af_lib),af_err,(Ptr{af_array},af_array,UInt32,Ptr{af_seq}),out,_in.arr,UInt32(ndims),index))
704 0
    AFArray{T,N}(out[])
705
end
706

707
function lookup(_in::AFArray,indices::AFArray,dim::Integer)
708 0
    out = RefValue{af_array}(0)
709 0
    _error(ccall((:af_lookup,af_lib),af_err,(Ptr{af_array},af_array,af_array,UInt32),out,_in.arr,indices.arr,UInt32(dim - 1)))
710 0
    AFArray!(out[])
711
end
712

713
function assign_seq(lhs::AFArray,ndims::Integer,indices,rhs::AFArray)
714 0
    out = RefValue{af_array}(0)
715 0
    _error(ccall((:af_assign_seq,af_lib),af_err,(Ptr{af_array},af_array,UInt32,Ptr{af_seq},af_array),out,lhs.arr,UInt32(ndims),indices,rhs.arr))
716 0
    AFArray!(out[])
717
end
718

719
function index_gen(_in::AFArray{T,N},ndims::dim_t,indices) where {T,N}
720 3
    out = RefValue{af_array}(0)
721 4
    _error(ccall((:af_index_gen,af_lib),af_err,(Ptr{af_array},af_array,dim_t,Ptr{af_index_t}),out,_in.arr,ndims,indices))
722 4
    AFArray{T,N}(out[])
723
end
724

725
function create_indexers()
726 3
    indexers = RefValue{Ptr{af_index_t}}(0)
727 4
    _error(ccall((:af_create_indexers,af_lib),af_err,(Ptr{Ptr{af_index_t}},),indexers))
728 3
    indexers[]
729
end
730

731
function create_handle(ndims::Integer,dims,_type::Type)
732 0
    arr = RefValue{af_array}(0)
733 0
    _error(ccall((:af_create_handle,af_lib),af_err,(Ptr{af_array},UInt32,Ptr{dim_t},af_dtype),arr,UInt32(ndims),dims,af_type(_type)))
734 0
    AFArray!(arr[])
735
end
736

737
function copy(_in::AFArray{T,N}) where {T,N}
738 4
    arr = RefValue{af_array}(0)
739 4
    _error(ccall((:af_copy_array,af_lib),af_err,(Ptr{af_array},af_array),arr,_in.arr))
740 4
    AFArray{T,N}(arr[])
741
end
742

743
function write_array(arr::AFArray,data,bytes::Csize_t,src::af_source)
744 0
    _error(ccall((:af_write_array,af_lib),af_err,(af_array,Ptr{Cvoid},Csize_t,af_source),arr.arr,data,bytes,src))
745
end
746

747
function get_data_ptr(data,arr::AFArray)
748 4
    _error(ccall((:af_get_data_ptr,af_lib),af_err,(Ptr{Cvoid},af_array),data,arr.arr))
749
end
750

751
function set_manual_eval_flag(flag::Bool)
752 0
    _error(ccall((:af_set_manual_eval_flag,af_lib),af_err,(Bool,),flag))
753
end
754

755
function get_manual_eval_flag()
756 0
    flag = RefValue{Bool}(0)
757 0
    _error(ccall((:af_get_manual_eval_flag,af_lib),af_err,(Ptr{Bool},),flag))
758 0
    flag[]
759
end
760

761
function get_elements(arr::AFArray)
762 0
    elems = RefValue{dim_t}(0)
763 0
    _error(ccall((:af_get_elements,af_lib),af_err,(Ptr{dim_t},af_array),elems,arr.arr))
764 0
    elems[]
765
end
766

767
function get_dims(arr::AFArray)
768 4
    d0 = RefValue{dim_t}(0)
769 3
    d1 = RefValue{dim_t}(0)
770 3
    d2 = RefValue{dim_t}(0)
771 3
    d3 = RefValue{dim_t}(0)
772 4
    _error(ccall((:af_get_dims,af_lib),af_err,(Ptr{dim_t},Ptr{dim_t},Ptr{dim_t},Ptr{dim_t},af_array),d0,d1,d2,d3,arr.arr))
773 4
    (d0[],d1[],d2[],d3[])
774
end
775

776
function is_empty(arr::AFArray)
777 0
    result = RefValue{Bool}(0)
778 0
    _error(ccall((:af_is_empty,af_lib),af_err,(Ptr{Bool},af_array),result,arr.arr))
779 0
    result[]
780
end
781

782
function is_scalar(arr::AFArray)
783 0
    result = RefValue{Bool}(0)
784 0
    _error(ccall((:af_is_scalar,af_lib),af_err,(Ptr{Bool},af_array),result,arr.arr))
785 0
    result[]
786
end
787

788
function is_row(arr::AFArray)
789 0
    result = RefValue{Bool}(0)
790 0
    _error(ccall((:af_is_row,af_lib),af_err,(Ptr{Bool},af_array),result,arr.arr))
791 0
    result[]
792
end
793

794
function is_column(arr::AFArray)
795 0
    result = RefValue{Bool}(0)
796 0
    _error(ccall((:af_is_column,af_lib),af_err,(Ptr{Bool},af_array),result,arr.arr))
797 0
    result[]
798
end
799

800
function is_vector(arr::AFArray)
801 0
    result = RefValue{Bool}(0)
802 0
    _error(ccall((:af_is_vector,af_lib),af_err,(Ptr{Bool},af_array),result,arr.arr))
803 0
    result[]
804
end
805

806
function is_complex(arr::AFArray)
807 0
    result = RefValue{Bool}(0)
808 0
    _error(ccall((:af_is_complex,af_lib),af_err,(Ptr{Bool},af_array),result,arr.arr))
809 0
    result[]
810
end
811

812
function is_real(arr::AFArray)
813 0
    result = RefValue{Bool}(0)
814 0
    _error(ccall((:af_is_real,af_lib),af_err,(Ptr{Bool},af_array),result,arr.arr))
815 0
    result[]
816
end
817

818
function is_double(arr::AFArray)
819 0
    result = RefValue{Bool}(0)
820 0
    _error(ccall((:af_is_double,af_lib),af_err,(Ptr{Bool},af_array),result,arr.arr))
821 0
    result[]
822
end
823

824
function is_single(arr::AFArray)
825 0
    result = RefValue{Bool}(0)
826 0
    _error(ccall((:af_is_single,af_lib),af_err,(Ptr{Bool},af_array),result,arr.arr))
827 0
    result[]
828
end
829

830
function is_realfloating(arr::AFArray)
831 0
    result = RefValue{Bool}(0)
832 0
    _error(ccall((:af_is_realfloating,af_lib),af_err,(Ptr{Bool},af_array),result,arr.arr))
833 0
    result[]
834
end
835

836
function is_floating(arr::AFArray)
837 0
    result = RefValue{Bool}(0)
838 0
    _error(ccall((:af_is_floating,af_lib),af_err,(Ptr{Bool},af_array),result,arr.arr))
839 0
    result[]
840
end
841

842
function is_integer(arr::AFArray)
843 0
    result = RefValue{Bool}(0)
844 0
    _error(ccall((:af_is_integer,af_lib),af_err,(Ptr{Bool},af_array),result,arr.arr))
845 0
    result[]
846
end
847

848
function is_bool(arr::AFArray)
849 0
    result = RefValue{Bool}(0)
850 0
    _error(ccall((:af_is_bool,af_lib),af_err,(Ptr{Bool},af_array),result,arr.arr))
851 0
    result[]
852
end
853

854
function issparse(arr::AFArray)
855 4
    result = RefValue{Bool}(0)
856 4
    _error(ccall((:af_is_sparse,af_lib),af_err,(Ptr{Bool},af_array),result,arr.arr))
857 4
    result[]
858
end
859

860
function set_backend(bknd::af_backend)
861 0
    _error(ccall((:af_set_backend,af_lib),af_err,(af_backend,),bknd))
862
end
863

864
function get_backend_count()
865 0
    num_backends = RefValue{UInt32}(0)
866 0
    _error(ccall((:af_get_backend_count,af_lib),af_err,(Ptr{UInt32},),num_backends))
867 0
    num_backends[]
868
end
869

870
function get_available_backends()
871 0
    backends = RefValue{Cint}(0)
872 0
    _error(ccall((:af_get_available_backends,af_lib),af_err,(Ptr{Cint},),backends))
873 0
    backends[]
874
end
875

876
function get_backend_id(_in::AFArray)
877 0
    backend = RefValue{af_backend}(0)
878 0
    _error(ccall((:af_get_backend_id,af_lib),af_err,(Ptr{af_backend},af_array),backend,_in.arr))
879 0
    backend[]
880
end
881

882
function get_active_backend()
883 0
    backend = RefValue{af_backend}(0)
884 0
    _error(ccall((:af_get_active_backend,af_lib),af_err,(Ptr{af_backend},),backend))
885 0
    backend[]
886
end
887

888
function get_device_id(_in::AFArray)
889 3
    device = RefValue{Cint}(0)
890 4
    _error(ccall((:af_get_device_id,af_lib),af_err,(Ptr{Cint},af_array),device,_in.arr))
891 3
    device[]
892
end
893

894
function matmul(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},optLhs::af_mat_prop,optRhs::af_mat_prop) where {T1,N1,T2,N2}
895 3
    out = RefValue{af_array}(0)
896 4
    _error(ccall((:af_matmul,af_lib),af_err,(Ptr{af_array},af_array,af_array,af_mat_prop,af_mat_prop),out,lhs.arr,rhs.arr,optLhs,optRhs))
897 4
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
898
end
899

900
function dot(lhs::AFArray{T1,N1},rhs::AFArray{T2,N2},optLhs::af_mat_prop,optRhs::af_mat_prop) where {T1,N1,T2,N2}
901 0
    out = RefValue{af_array}(0)
902 0
    _error(ccall((:af_dot,af_lib),af_err,(Ptr{af_array},af_array,af_array,af_mat_prop,af_mat_prop),out,lhs.arr,rhs.arr,optLhs,optRhs))
903 0
    AFArray{typed(T1,T2),batched(N1,N2)}(out[])
904
end
905

906
function dot_all(lhs::AFArray,rhs::AFArray,optLhs::af_mat_prop,optRhs::af_mat_prop)
907 0
    real = RefValue{Cdouble}(0)
908 0
    imag = RefValue{Cdouble}(0)
909 0
    _error(ccall((:af_dot_all,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array,af_array,af_mat_prop,af_mat_prop),real,imag,lhs.arr,rhs.arr,optLhs,optRhs))
910 0
    (real[],imag[])
911
end
912

913
function transpose_inplace(_in::AFArray,conjugate::Bool)
914 0
    _error(ccall((:af_transpose_inplace,af_lib),af_err,(af_array,Bool),_in.arr,conjugate))
915
end
916

917
function range(ndims::Integer,dims,seq_dim::Integer,_type::Type)
918 4
    out = RefValue{af_array}(0)
919 4
    _error(ccall((:af_range,af_lib),af_err,(Ptr{af_array},UInt32,Ptr{dim_t},Cint,af_dtype),out,UInt32(ndims),dims,Cint(seq_dim),af_type(_type)))
920 4
    AFArray!(out[])
921
end
922

923
function iota(ndims::Integer,dims,t_ndims::Integer,tdims,_type::Type)
924 0
    out = RefValue{af_array}(0)
925 0
    _error(ccall((:af_iota,af_lib),af_err,(Ptr{af_array},UInt32,Ptr{dim_t},UInt32,Ptr{dim_t},af_dtype),out,UInt32(ndims),dims,UInt32(t_ndims),tdims,af_type(_type)))
926 0
    AFArray!(out[])
927
end
928

929
function identity(ndims::Integer,dims,_type::Type)
930 0
    out = RefValue{af_array}(0)
931 0
    _error(ccall((:af_identity,af_lib),af_err,(Ptr{af_array},UInt32,Ptr{dim_t},af_dtype),out,UInt32(ndims),dims,af_type(_type)))
932 0
    AFArray!(out[])
933
end
934

935
function diagm(_in::AFArray,num::Integer)
936 0
    out = RefValue{af_array}(0)
937 0
    _error(ccall((:af_diag_create,af_lib),af_err,(Ptr{af_array},af_array,Cint),out,_in.arr,Cint(num)))
938 0
    AFArray!(out[])
939
end
940

941
function diag(_in::AFArray,num::Integer)
942 0
    out = RefValue{af_array}(0)
943 0
    _error(ccall((:af_diag_extract,af_lib),af_err,(Ptr{af_array},af_array,Cint),out,_in.arr,Cint(num)))
944 0
    AFArray!(out[])
945
end
946

947
function tile(_in::AFArray{T,N},x::Integer,y::Integer,z::Integer,w::Integer) where {T,N}
948 0
    out = RefValue{af_array}(0)
949 0
    _error(ccall((:af_tile,af_lib),af_err,(Ptr{af_array},af_array,UInt32,UInt32,UInt32,UInt32),out,_in.arr,UInt32(x),UInt32(y),UInt32(z),UInt32(w)))
950 0
    AFArray{T,N}(out[])
951
end
952

953
function reorder(_in::AFArray{T,N},x::Integer,y::Integer,z::Integer,w::Integer) where {T,N}
954 0
    out = RefValue{af_array}(0)
955 0
    _error(ccall((:af_reorder,af_lib),af_err,(Ptr{af_array},af_array,UInt32,UInt32,UInt32,UInt32),out,_in.arr,UInt32(x),UInt32(y),UInt32(z),UInt32(w)))
956 0
    AFArray{T,N}(out[])
957
end
958

959
function shift(_in::AFArray{T,N},x::Integer,y::Integer,z::Integer,w::Integer) where {T,N}
960 0
    out = RefValue{af_array}(0)
961 0
    _error(ccall((:af_shift,af_lib),af_err,(Ptr{af_array},af_array,Cint,Cint,Cint,Cint),out,_in.arr,Cint(x),Cint(y),Cint(z),Cint(w)))
962 0
    AFArray{T,N}(out[])
963
end
964

965
function flip(_in::AFArray{T,N},dim::Integer) where {T,N}
966 0
    out = RefValue{af_array}(0)
967 0
    _error(ccall((:af_flip,af_lib),af_err,(Ptr{af_array},af_array,UInt32),out,_in.arr,UInt32(dim - 1)))
968 0
    AFArray{T,N}(out[])
969
end
970

971
function lower(_in::AFArray{T,N},is_unit_diag::Bool) where {T,N}
972 0
    out = RefValue{af_array}(0)
973 0
    _error(ccall((:af_lower,af_lib),af_err,(Ptr{af_array},af_array,Bool),out,_in.arr,is_unit_diag))
974 0
    AFArray{T,N}(out[])
975
end
976

977
function upper(_in::AFArray{T,N},is_unit_diag::Bool) where {T,N}
978 0
    out = RefValue{af_array}(0)
979 0
    _error(ccall((:af_upper,af_lib),af_err,(Ptr{af_array},af_array,Bool),out,_in.arr,is_unit_diag))
980 0
    AFArray{T,N}(out[])
981
end
982

983
function replace(a::AFArray,cond::AFArray,b::AFArray)
984 0
    _error(ccall((:af_replace,af_lib),af_err,(af_array,af_array,af_array),a.arr,cond.arr,b.arr))
985
end
986

987
function replace(a::AFArray,cond::AFArray,b::Real)
988 0
    _error(ccall((:af_replace_scalar,af_lib),af_err,(af_array,af_array,Cdouble),a.arr,cond.arr,Cdouble(b)))
989
end
990

991
function afinfo()
992 4
    _error(ccall((:af_info,af_lib),af_err,()))
993
end
994

995
function afinit()
996 4
    _error(ccall((:af_init,af_lib),af_err,()))
997
end
998

999
function get_device_count()
1000 0
    num_of_devices = RefValue{Cint}(0)
1001 0
    _error(ccall((:af_get_device_count,af_lib),af_err,(Ptr{Cint},),num_of_devices))
1002 0
    num_of_devices[]
1003
end
1004

1005
function get_dbl_support(device::Integer)
1006 0
    available = RefValue{Bool}(0)
1007 0
    _error(ccall((:af_get_dbl_support,af_lib),af_err,(Ptr{Bool},Cint),available,Cint(device)))
1008 0
    available[]
1009
end
1010

1011
function set_device(device::Integer)
1012 4
    _error(ccall((:af_set_device,af_lib),af_err,(Cint,),Cint(device)))
1013
end
1014

1015
function get_device()
1016 0
    device = RefValue{Cint}(0)
1017 0
    _error(ccall((:af_get_device,af_lib),af_err,(Ptr{Cint},),device))
1018 0
    device[]
1019
end
1020

1021
function sync(device::Integer)
1022 4
    _error(ccall((:af_sync,af_lib),af_err,(Cint,),Cint(device)))
1023
end
1024

1025
function alloc_device(bytes::dim_t)
1026 0
    ptr = RefValue{Ptr{Cvoid}}(0)
1027 0
    _error(ccall((:af_alloc_device,af_lib),af_err,(Ptr{Ptr{Cvoid}},dim_t),ptr,bytes))
1028 0
    ptr[]
1029
end
1030

1031
function free_device(ptr)
1032 0
    _error(ccall((:af_free_device,af_lib),af_err,(Ptr{Cvoid},),ptr))
1033
end
1034

1035
function device_array(data,ndims::Integer,dims,_type::Type)
1036 0
    arr = RefValue{af_array}(0)
1037 0
    _error(ccall((:af_device_array,af_lib),af_err,(Ptr{af_array},Ptr{Cvoid},UInt32,Ptr{dim_t},af_dtype),arr,data,UInt32(ndims),dims,af_type(_type)))
1038 0
    AFArray!(arr[])
1039
end
1040

1041
function print_mem_info(msg,device_id::Integer)
1042 0
    _error(ccall((:af_print_mem_info,af_lib),af_err,(Cstring,Cint),msg,Cint(device_id)))
1043
end
1044

1045
function set_mem_step_size(step_bytes::Csize_t)
1046 0
    _error(ccall((:af_set_mem_step_size,af_lib),af_err,(Csize_t,),step_bytes))
1047
end
1048

1049
function get_mem_step_size()
1050 0
    step_bytes = RefValue{Csize_t}(0)
1051 0
    _error(ccall((:af_get_mem_step_size,af_lib),af_err,(Ptr{Csize_t},),step_bytes))
1052 0
    step_bytes[]
1053
end
1054

1055
function lock_device_ptr(arr::AFArray)
1056 0
    _error(ccall((:af_lock_device_ptr,af_lib),af_err,(af_array,),arr.arr))
1057
end
1058

1059
function unlock_device_ptr(arr::AFArray)
1060 0
    _error(ccall((:af_unlock_device_ptr,af_lib),af_err,(af_array,),arr.arr))
1061
end
1062

1063
function lock_array(arr::AFArray)
1064 0
    _error(ccall((:af_lock_array,af_lib),af_err,(af_array,),arr.arr))
1065
end
1066

1067
function unlock_array(arr::AFArray)
1068 0
    _error(ccall((:af_unlock_array,af_lib),af_err,(af_array,),arr.arr))
1069
end
1070

1071
function is_locked_array(arr::AFArray)
1072 0
    res = RefValue{Bool}(0)
1073 0
    _error(ccall((:af_is_locked_array,af_lib),af_err,(Ptr{Bool},af_array),res,arr.arr))
1074 0
    res[]
1075
end
1076

1077
function get_device_ptr(arr::AFArray)
1078 0
    ptr = RefValue{Ptr{Cvoid}}(0)
1079 0
    _error(ccall((:af_get_device_ptr,af_lib),af_err,(Ptr{Ptr{Cvoid}},af_array),ptr,arr.arr))
1080 0
    ptr[]
1081
end
1082

1083
function create_features(num::dim_t)
1084 0
    feat = RefValue{af_features}(0)
1085 0
    _error(ccall((:af_create_features,af_lib),af_err,(Ptr{af_features},dim_t),feat,num))
1086 0
    feat[]
1087
end
1088

1089
function retain_features(feat::af_features)
1090 0
    out = RefValue{af_features}(0)
1091 0
    _error(ccall((:af_retain_features,af_lib),af_err,(Ptr{af_features},af_features),out,feat))
1092 0
    out[]
1093
end
1094

1095
function get_features_num(feat::af_features)
1096 0
    num = RefValue{dim_t}(0)
1097 0
    _error(ccall((:af_get_features_num,af_lib),af_err,(Ptr{dim_t},af_features),num,feat))
1098 0
    num[]
1099
end
1100

1101
function get_features_xpos(feat::af_features)
1102 0
    out = RefValue{af_array}(0)
1103 0
    _error(ccall((:af_get_features_xpos,af_lib),af_err,(Ptr{af_array},af_features),out,feat))
1104 0
    AFArray!(out[])
1105
end
1106

1107
function get_features_ypos(feat::af_features)
1108 0
    out = RefValue{af_array}(0)
1109 0
    _error(ccall((:af_get_features_ypos,af_lib),af_err,(Ptr{af_array},af_features),out,feat))
1110 0
    AFArray!(out[])
1111
end
1112

1113
function get_features_score(feat::af_features)
1114 0
    score = RefValue{af_array}(0)
1115 0
    _error(ccall((:af_get_features_score,af_lib),af_err,(Ptr{af_array},af_features),score,feat))
1116 0
    AFArray!(score[])
1117
end
1118

1119
function get_features_orientation(feat::af_features)
1120 0
    orientation = RefValue{af_array}(0)
1121 0
    _error(ccall((:af_get_features_orientation,af_lib),af_err,(Ptr{af_array},af_features),orientation,feat))
1122 0
    AFArray!(orientation[])
1123
end
1124

1125
function get_features_size(feat::af_features)
1126 0
    size = RefValue{af_array}(0)
1127 0
    _error(ccall((:af_get_features_size,af_lib),af_err,(Ptr{af_array},af_features),size,feat))
1128 0
    AFArray!(size[])
1129
end
1130

1131
function release_features(feat::af_features)
1132 0
    _error(ccall((:af_release_features,af_lib),af_err,(af_features,),feat))
1133
end
1134

1135
function create_window(width::Integer,height::Integer,title)
1136 0
    out = RefValue{af_window}(0)
1137 0
    _error(ccall((:af_create_window,af_lib),af_err,(Ptr{af_window},Cint,Cint,Cstring),out,Cint(width),Cint(height),title))
1138 0
    out[]
1139
end
1140

1141
function set_position(wind::af_window,x::Integer,y::Integer)
1142 0
    _error(ccall((:af_set_position,af_lib),af_err,(af_window,UInt32,UInt32),wind,UInt32(x),UInt32(y)))
1143
end
1144

1145
function set_title(wind::af_window,title)
1146 0
    _error(ccall((:af_set_title,af_lib),af_err,(af_window,Cstring),wind,title))
1147
end
1148

1149
function set_size(wind::af_window,w::Integer,h::Integer)
1150 0
    _error(ccall((:af_set_size,af_lib),af_err,(af_window,UInt32,UInt32),wind,UInt32(w),UInt32(h)))
1151
end
1152

1153
function draw_image(wind::af_window,_in::AFArray,props)
1154 0
    _error(ccall((:af_draw_image,af_lib),af_err,(af_window,af_array,Ptr{af_cell}),wind,_in.arr,props))
1155
end
1156

1157
function draw_plot(wind::af_window,X::AFArray,Y::AFArray,props)
1158 0
    _error(ccall((:af_draw_plot,af_lib),af_err,(af_window,af_array,af_array,Ptr{af_cell}),wind,X.arr,Y.arr,props))
1159
end
1160

1161
function draw_plot3(wind::af_window,P::AFArray,props)
1162 0
    _error(ccall((:af_draw_plot3,af_lib),af_err,(af_window,af_array,Ptr{af_cell}),wind,P.arr,props))
1163
end
1164

1165
function draw_plot_nd(wind::af_window,P::AFArray,props)
1166 0
    _error(ccall((:af_draw_plot_nd,af_lib),af_err,(af_window,af_array,Ptr{af_cell}),wind,P.arr,props))
1167
end
1168

1169
function draw_plot_2d(wind::af_window,X::AFArray,Y::AFArray,props)
1170 0
    _error(ccall((:af_draw_plot_2d,af_lib),af_err,(af_window,af_array,af_array,Ptr{af_cell}),wind,X.arr,Y.arr,props))
1171
end
1172

1173
function draw_plot_3d(wind::af_window,X::AFArray,Y::AFArray,Z::AFArray,props)
1174 0
    _error(ccall((:af_draw_plot_3d,af_lib),af_err,(af_window,af_array,af_array,af_array,Ptr{af_cell}),wind,X.arr,Y.arr,Z.arr,props))
1175
end
1176

1177
function draw_scatter(wind::af_window,X::AFArray,Y::AFArray,marker::af_marker_type,props)
1178 0
    _error(ccall((:af_draw_scatter,af_lib),af_err,(af_window,af_array,af_array,af_marker_type,Ptr{af_cell}),wind,X.arr,Y.arr,marker,props))
1179
end
1180

1181
function draw_scatter3(wind::af_window,P::AFArray,marker::af_marker_type,props)
1182 0
    _error(ccall((:af_draw_scatter3,af_lib),af_err,(af_window,af_array,af_marker_type,Ptr{af_cell}),wind,P.arr,marker,props))
1183
end
1184

1185
function draw_scatter_nd(wind::af_window,P::AFArray,marker::af_marker_type,props)
1186 0
    _error(ccall((:af_draw_scatter_nd,af_lib),af_err,(af_window,af_array,af_marker_type,Ptr{af_cell}),wind,P.arr,marker,props))
1187
end
1188

1189
function draw_scatter_2d(wind::af_window,X::AFArray,Y::AFArray,marker::af_marker_type,props)
1190 0
    _error(ccall((:af_draw_scatter_2d,af_lib),af_err,(af_window,af_array,af_array,af_marker_type,Ptr{af_cell}),wind,X.arr,Y.arr,marker,props))
1191
end
1192

1193
function draw_scatter_3d(wind::af_window,X::AFArray,Y::AFArray,Z::AFArray,marker::af_marker_type,props)
1194 0
    _error(ccall((:af_draw_scatter_3d,af_lib),af_err,(af_window,af_array,af_array,af_array,af_marker_type,Ptr{af_cell}),wind,X.arr,Y.arr,Z.arr,marker,props))
1195
end
1196

1197
function draw_hist(wind::af_window,X::AFArray,minval::Real,maxval::Real,props)
1198 0
    _error(ccall((:af_draw_hist,af_lib),af_err,(af_window,af_array,Cdouble,Cdouble,Ptr{af_cell}),wind,X.arr,Cdouble(minval),Cdouble(maxval),props))
1199
end
1200

1201
function draw_surface(wind::af_window,xVals::AFArray,yVals::AFArray,S::AFArray,props)
1202 0
    _error(ccall((:af_draw_surface,af_lib),af_err,(af_window,af_array,af_array,af_array,Ptr{af_cell}),wind,xVals.arr,yVals.arr,S.arr,props))
1203
end
1204

1205
function draw_vector_field_nd(wind::af_window,points::AFArray,directions::AFArray,props)
1206 0
    _error(ccall((:af_draw_vector_field_nd,af_lib),af_err,(af_window,af_array,af_array,Ptr{af_cell}),wind,points.arr,directions.arr,props))
1207
end
1208

1209
function draw_vector_field_3d(wind::af_window,xPoints::AFArray,yPoints::AFArray,zPoints::AFArray,xDirs::AFArray,yDirs::AFArray,zDirs::AFArray,props)
1210 0
    _error(ccall((:af_draw_vector_field_3d,af_lib),af_err,(af_window,af_array,af_array,af_array,af_array,af_array,af_array,Ptr{af_cell}),wind,xPoints.arr,yPoints.arr,zPoints.arr,xDirs.arr,yDirs.arr,zDirs.arr,props))
1211
end
1212

1213
function draw_vector_field_2d(wind::af_window,xPoints::AFArray,yPoints::AFArray,xDirs::AFArray,yDirs::AFArray,props)
1214 0
    _error(ccall((:af_draw_vector_field_2d,af_lib),af_err,(af_window,af_array,af_array,af_array,af_array,Ptr{af_cell}),wind,xPoints.arr,yPoints.arr,xDirs.arr,yDirs.arr,props))
1215
end
1216

1217
function set_axes_limits_compute(wind::af_window,x::AFArray,y::AFArray,z::AFArray,exact::Bool,props)
1218 0
    _error(ccall((:af_set_axes_limits_compute,af_lib),af_err,(af_window,af_array,af_array,af_array,Bool,Ptr{af_cell}),wind,x.arr,y.arr,z.arr,exact,props))
1219
end
1220

1221
function set_axes_limits_2d(wind::af_window,xmin::Cfloat,xmax::Cfloat,ymin::Cfloat,ymax::Cfloat,exact::Bool,props)
1222 0
    _error(ccall((:af_set_axes_limits_2d,af_lib),af_err,(af_window,Cfloat,Cfloat,Cfloat,Cfloat,Bool,Ptr{af_cell}),wind,xmin,xmax,ymin,ymax,exact,props))
1223
end
1224

1225
function set_axes_limits_3d(wind::af_window,xmin::Cfloat,xmax::Cfloat,ymin::Cfloat,ymax::Cfloat,zmin::Cfloat,zmax::Cfloat,exact::Bool,props)
1226 0
    _error(ccall((:af_set_axes_limits_3d,af_lib),af_err,(af_window,Cfloat,Cfloat,Cfloat,Cfloat,Cfloat,Cfloat,Bool,Ptr{af_cell}),wind,xmin,xmax,ymin,ymax,zmin,zmax,exact,props))
1227
end
1228

1229
function set_axes_titles(wind::af_window,xtitle,ytitle,ztitle,props)
1230 0
    _error(ccall((:af_set_axes_titles,af_lib),af_err,(af_window,Cstring,Cstring,Cstring,Ptr{af_cell}),wind,xtitle,ytitle,ztitle,props))
1231
end
1232

1233
function show_window(wind::af_window)
1234 0
    _error(ccall((:af_show,af_lib),af_err,(af_window,),wind))
1235
end
1236

1237
function is_window_closed(wind::af_window)
1238 0
    out = RefValue{Bool}(0)
1239 0
    _error(ccall((:af_is_window_closed,af_lib),af_err,(Ptr{Bool},af_window),out,wind))
1240 0
    out[]
1241
end
1242

1243
function set_visibility(wind::af_window,is_visible::Bool)
1244 0
    _error(ccall((:af_set_visibility,af_lib),af_err,(af_window,Bool),wind,is_visible))
1245
end
1246

1247
function destroy_window(wind::af_window)
1248 0
    _error(ccall((:af_destroy_window,af_lib),af_err,(af_window,),wind))
1249
end
1250

1251
function gradient(_in::AFArray)
1252 0
    dx = RefValue{af_array}(0)
1253 0
    dy = RefValue{af_array}(0)
1254 0
    _error(ccall((:af_gradient,af_lib),af_err,(Ptr{af_array},Ptr{af_array},af_array),dx,dy,_in.arr))
1255 0
    (AFArray!(dx[]),AFArray!(dy[]))
1256
end
1257

1258
function load_image(filename,isColor::Bool)
1259 0
    out = RefValue{af_array}(0)
1260 0
    _error(ccall((:af_load_image,af_lib),af_err,(Ptr{af_array},Cstring,Bool),out,filename,isColor))
1261 0
    AFArray!(out[])
1262
end
1263

1264
function save_image(filename,_in::AFArray)
1265 0
    _error(ccall((:af_save_image,af_lib),af_err,(Cstring,af_array),filename,_in.arr))
1266
end
1267

1268
function load_image_memory(ptr)
1269 0
    out = RefValue{af_array}(0)
1270 0
    _error(ccall((:af_load_image_memory,af_lib),af_err,(Ptr{af_array},Ptr{Cvoid}),out,ptr))
1271 0
    AFArray!(out[])
1272
end
1273

1274
function save_image_memory(_in::AFArray,format::af_image_format)
1275 0
    ptr = RefValue{Ptr{Cvoid}}(0)
1276 0
    _error(ccall((:af_save_image_memory,af_lib),af_err,(Ptr{Ptr{Cvoid}},af_array,af_image_format),ptr,_in.arr,format))
1277 0
    ptr[]
1278
end
1279

1280
function delete_image_memory(ptr)
1281 0
    _error(ccall((:af_delete_image_memory,af_lib),af_err,(Ptr{Cvoid},),ptr))
1282
end
1283

1284
function load_image_native(filename)
1285 0
    out = RefValue{af_array}(0)
1286 0
    _error(ccall((:af_load_image_native,af_lib),af_err,(Ptr{af_array},Cstring),out,filename))
1287 0
    AFArray!(out[])
1288
end
1289

1290
function save_image_native(filename,_in::AFArray)
1291 0
    _error(ccall((:af_save_image_native,af_lib),af_err,(Cstring,af_array),filename,_in.arr))
1292
end
1293

1294
function is_image_io_available()
1295 0
    out = RefValue{Bool}(0)
1296 0
    _error(ccall((:af_is_image_io_available,af_lib),af_err,(Ptr{Bool},),out))
1297 0
    out[]
1298
end
1299

1300
function resize(_in::AFArray{T,N},odim0::dim_t,odim1::dim_t,method::af_interp_type) where {T,N}
1301 0
    out = RefValue{af_array}(0)
1302 0
    _error(ccall((:af_resize,af_lib),af_err,(Ptr{af_array},af_array,dim_t,dim_t,af_interp_type),out,_in.arr,odim0,odim1,method))
1303 0
    AFArray{T,N}(out[])
1304
end
1305

1306
function transform(_in::AFArray,transform::AFArray,odim0::dim_t,odim1::dim_t,method::af_interp_type,inverse::Bool)
1307 0
    out = RefValue{af_array}(0)
1308 0
    _error(ccall((:af_transform,af_lib),af_err,(Ptr{af_array},af_array,af_array,dim_t,dim_t,af_interp_type,Bool),out,_in.arr,transform.arr,odim0,odim1,method,inverse))
1309 0
    AFArray!(out[])
1310
end
1311

1312
function transform_coordinates(tf::AFArray{T,N},d0::Cfloat,d1::Cfloat) where {T,N}
1313 0
    out = RefValue{af_array}(0)
1314 0
    _error(ccall((:af_transform_coordinates,af_lib),af_err,(Ptr{af_array},af_array,Cfloat,Cfloat),out,tf.arr,d0,d1))
1315 0
    AFArray{T,N}(out[])
1316
end
1317

1318
function rotate(_in::AFArray{T,N},theta::Cfloat,crop::Bool,method::af_interp_type) where {T,N}
1319 0
    out = RefValue{af_array}(0)
1320 0
    _error(ccall((:af_rotate,af_lib),af_err,(Ptr{af_array},af_array,Cfloat,Bool,af_interp_type),out,_in.arr,theta,crop,method))
1321 0
    AFArray{T,N}(out[])
1322
end
1323

1324
function translate(_in::AFArray{T,N},trans0::Cfloat,trans1::Cfloat,odim0::dim_t,odim1::dim_t,method::af_interp_type) where {T,N}
1325 0
    out = RefValue{af_array}(0)
1326 0
    _error(ccall((:af_translate,af_lib),af_err,(Ptr{af_array},af_array,Cfloat,Cfloat,dim_t,dim_t,af_interp_type),out,_in.arr,trans0,trans1,odim0,odim1,method))
1327 0
    AFArray{T,N}(out[])
1328
end
1329

1330
function scale(_in::AFArray{T,N},scale0::Cfloat,scale1::Cfloat,odim0::dim_t,odim1::dim_t,method::af_interp_type) where {T,N}
1331 0
    out = RefValue{af_array}(0)
1332 0
    _error(ccall((:af_scale,af_lib),af_err,(Ptr{af_array},af_array,Cfloat,Cfloat,dim_t,dim_t,af_interp_type),out,_in.arr,scale0,scale1,odim0,odim1,method))
1333 0
    AFArray{T,N}(out[])
1334
end
1335

1336
function skew(_in::AFArray{T,N},skew0::Cfloat,skew1::Cfloat,odim0::dim_t,odim1::dim_t,method::af_interp_type,inverse::Bool) where {T,N}
1337 0
    out = RefValue{af_array}(0)
1338 0
    _error(ccall((:af_skew,af_lib),af_err,(Ptr{af_array},af_array,Cfloat,Cfloat,dim_t,dim_t,af_interp_type,Bool),out,_in.arr,skew0,skew1,odim0,odim1,method,inverse))
1339 0
    AFArray{T,N}(out[])
1340
end
1341

1342
function histogram(_in::AFArray{T,N},nbins::Integer,minval::Real,maxval::Real) where {T,N}
1343 0
    out = RefValue{af_array}(0)
1344 0
    _error(ccall((:af_histogram,af_lib),af_err,(Ptr{af_array},af_array,UInt32,Cdouble,Cdouble),out,_in.arr,UInt32(nbins),Cdouble(minval),Cdouble(maxval)))
1345 0
    AFArray{T,N}(out[])
1346
end
1347

1348
function dilate(_in::AFArray,mask::AFArray)
1349 0
    out = RefValue{af_array}(0)
1350 0
    _error(ccall((:af_dilate,af_lib),af_err,(Ptr{af_array},af_array,af_array),out,_in.arr,mask.arr))
1351 0
    AFArray!(out[])
1352
end
1353

1354
function dilate3(_in::AFArray,mask::AFArray)
1355 0
    out = RefValue{af_array}(0)
1356 0
    _error(ccall((:af_dilate3,af_lib),af_err,(Ptr{af_array},af_array,af_array),out,_in.arr,mask.arr))
1357 0
    AFArray!(out[])
1358
end
1359

1360
function erode(_in::AFArray,mask::AFArray)
1361 0
    out = RefValue{af_array}(0)
1362 0
    _error(ccall((:af_erode,af_lib),af_err,(Ptr{af_array},af_array,af_array),out,_in.arr,mask.arr))
1363 0
    AFArray!(out[])
1364
end
1365

1366
function erode3(_in::AFArray,mask::AFArray)
1367 0
    out = RefValue{af_array}(0)
1368 0
    _error(ccall((:af_erode3,af_lib),af_err,(Ptr{af_array},af_array,af_array),out,_in.arr,mask.arr))
1369 0
    AFArray!(out[])
1370
end
1371

1372
function bilateral(_in::AFArray{T,N},spatial_sigma::Cfloat,chromatic_sigma::Cfloat,isColor::Bool) where {T,N}
1373 0
    out = RefValue{af_array}(0)
1374 0
    _error(ccall((:af_bilateral,af_lib),af_err,(Ptr{af_array},af_array,Cfloat,Cfloat,Bool),out,_in.arr,spatial_sigma,chromatic_sigma,isColor))
1375 0
    AFArray{T,N}(out[])
1376
end
1377

1378
function mean_shift(_in::AFArray{T,N},spatial_sigma::Cfloat,chromatic_sigma::Cfloat,iter::Integer,is_color::Bool) where {T,N}
1379 0
    out = RefValue{af_array}(0)
1380 0
    _error(ccall((:af_mean_shift,af_lib),af_err,(Ptr{af_array},af_array,Cfloat,Cfloat,UInt32,Bool),out,_in.arr,spatial_sigma,chromatic_sigma,UInt32(iter),is_color))
1381 0
    AFArray{T,N}(out[])
1382
end
1383

1384
function minfilt(_in::AFArray{T,N},wind_length::dim_t,wind_width::dim_t,edge_pad::af_border_type) where {T,N}
1385 0
    out = RefValue{af_array}(0)
1386 0
    _error(ccall((:af_minfilt,af_lib),af_err,(Ptr{af_array},af_array,dim_t,dim_t,af_border_type),out,_in.arr,wind_length,wind_width,edge_pad))
1387 0
    AFArray{T,N}(out[])
1388
end
1389

1390
function maxfilt(_in::AFArray{T,N},wind_length::dim_t,wind_width::dim_t,edge_pad::af_border_type) where {T,N}
1391 0
    out = RefValue{af_array}(0)
1392 0
    _error(ccall((:af_maxfilt,af_lib),af_err,(Ptr{af_array},af_array,dim_t,dim_t,af_border_type),out,_in.arr,wind_length,wind_width,edge_pad))
1393 0
    AFArray{T,N}(out[])
1394
end
1395

1396
function regions(_in::AFArray{T,N},connectivity::af_connectivity,ty::Type) where {T,N}
1397 0
    out = RefValue{af_array}(0)
1398 0
    _error(ccall((:af_regions,af_lib),af_err,(Ptr{af_array},af_array,af_connectivity,af_dtype),out,_in.arr,connectivity,af_type(ty)))
1399 0
    AFArray!(out[])
1400
end
1401

1402
function sobel_operator(img::AFArray,ker_size::Integer)
1403 0
    dx = RefValue{af_array}(0)
1404 0
    dy = RefValue{af_array}(0)
1405 0
    _error(ccall((:af_sobel_operator,af_lib),af_err,(Ptr{af_array},Ptr{af_array},af_array,UInt32),dx,dy,img.arr,UInt32(ker_size)))
1406 0
    (AFArray!(dx[]),AFArray!(dy[]))
1407
end
1408

1409
function rgb2gray(_in::AFArray{T,N},rPercent::Cfloat,gPercent::Cfloat,bPercent::Cfloat) where {T,N}
1410 0
    out = RefValue{af_array}(0)
1411 0
    _error(ccall((:af_rgb2gray,af_lib),af_err,(Ptr{af_array},af_array,Cfloat,Cfloat,Cfloat),out,_in.arr,rPercent,gPercent,bPercent))
1412 0
    AFArray{T,N}(out[])
1413
end
1414

1415
function gray2rgb(_in::AFArray{T,N},rFactor::Cfloat,gFactor::Cfloat,bFactor::Cfloat) where {T,N}
1416 0
    out = RefValue{af_array}(0)
1417 0
    _error(ccall((:af_gray2rgb,af_lib),af_err,(Ptr{af_array},af_array,Cfloat,Cfloat,Cfloat),out,_in.arr,rFactor,gFactor,bFactor))
1418 0
    AFArray{T,N}(out[])
1419
end
1420

1421
function hist_equal(_in::AFArray,hist::AFArray)
1422 0
    out = RefValue{af_array}(0)
1423 0
    _error(ccall((:af_hist_equal,af_lib),af_err,(Ptr{af_array},af_array,af_array),out,_in.arr,hist.arr))
1424 0
    AFArray!(out[])
1425
end
1426

1427
function gaussian_kernel(rows::Integer,cols::Integer,sigma_r::Real,sigma_c::Real)
1428 0
    out = RefValue{af_array}(0)
1429 0
    _error(ccall((:af_gaussian_kernel,af_lib),af_err,(Ptr{af_array},Cint,Cint,Cdouble,Cdouble),out,Cint(rows),Cint(cols),Cdouble(sigma_r),Cdouble(sigma_c)))
1430 0
    AFArray!(out[])
1431
end
1432

1433
function hsv2rgb(_in::AFArray{T,N}) where {T,N}
1434 0
    out = RefValue{af_array}(0)
1435 0
    _error(ccall((:af_hsv2rgb,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
1436 0
    AFArray{T,N}(out[])
1437
end
1438

1439
function rgb2hsv(_in::AFArray{T,N}) where {T,N}
1440 0
    out = RefValue{af_array}(0)
1441 0
    _error(ccall((:af_rgb2hsv,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
1442 0
    AFArray{T,N}(out[])
1443
end
1444

1445
function color_space(image::AFArray{T,N},to::af_cspace_t,from::af_cspace_t) where {T,N}
1446 0
    out = RefValue{af_array}(0)
1447 0
    _error(ccall((:af_color_space,af_lib),af_err,(Ptr{af_array},af_array,af_cspace_t,af_cspace_t),out,image.arr,to,from))
1448 0
    AFArray{T,N}(out[])
1449
end
1450

1451
function unwrap(_in::AFArray{T,N},wx::dim_t,wy::dim_t,sx::dim_t,sy::dim_t,px::dim_t,py::dim_t,is_column::Bool) where {T,N}
1452 0
    out = RefValue{af_array}(0)
1453 0
    _error(ccall((:af_unwrap,af_lib),af_err,(Ptr{af_array},af_array,dim_t,dim_t,dim_t,dim_t,dim_t,dim_t,Bool),out,_in.arr,wx,wy,sx,sy,px,py,is_column))
1454 0
    AFArray{T,N}(out[])
1455
end
1456

1457
function wrap(_in::AFArray{T,N},ox::dim_t,oy::dim_t,wx::dim_t,wy::dim_t,sx::dim_t,sy::dim_t,px::dim_t,py::dim_t,is_column::Bool) where {T,N}
1458 0
    out = RefValue{af_array}(0)
1459 0
    _error(ccall((:af_wrap,af_lib),af_err,(Ptr{af_array},af_array,dim_t,dim_t,dim_t,dim_t,dim_t,dim_t,dim_t,dim_t,Bool),out,_in.arr,ox,oy,wx,wy,sx,sy,px,py,is_column))
1460 0
    AFArray{T,N}(out[])
1461
end
1462

1463
function sat(_in::AFArray{T,N}) where {T,N}
1464 0
    out = RefValue{af_array}(0)
1465 0
    _error(ccall((:af_sat,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
1466 0
    AFArray{T,N}(out[])
1467
end
1468

1469
function ycbcr2rgb(_in::AFArray{T,N},standard::af_ycc_std) where {T,N}
1470 0
    out = RefValue{af_array}(0)
1471 0
    _error(ccall((:af_ycbcr2rgb,af_lib),af_err,(Ptr{af_array},af_array,af_ycc_std),out,_in.arr,standard))
1472 0
    AFArray{T,N}(out[])
1473
end
1474

1475
function rgb2ycbcr(_in::AFArray{T,N},standard::af_ycc_std) where {T,N}
1476 0
    out = RefValue{af_array}(0)
1477 0
    _error(ccall((:af_rgb2ycbcr,af_lib),af_err,(Ptr{af_array},af_array,af_ycc_std),out,_in.arr,standard))
1478 0
    AFArray{T,N}(out[])
1479
end
1480

1481
function moments(_in::AFArray{T,N},moment::af_moment_type) where {T,N}
1482 0
    out = RefValue{af_array}(0)
1483 0
    _error(ccall((:af_moments,af_lib),af_err,(Ptr{af_array},af_array,af_moment_type),out,_in.arr,moment))
1484 0
    AFArray{T,N}(out[])
1485
end
1486

1487
function moments_all(_in::AFArray,moment::af_moment_type)
1488 0
    out = RefValue{Cdouble}(0)
1489 0
    _error(ccall((:af_moments_all,af_lib),af_err,(Ptr{Cdouble},af_array,af_moment_type),out,_in.arr,moment))
1490 0
    out[]
1491
end
1492

1493
function canny(_in::AFArray{T,N},threshold_type::af_canny_threshold,low_threshold_ratio::Cfloat,high_threshold_ratio::Cfloat,sobel_window::Integer,is_fast::Bool) where {T,N}
1494 0
    out = RefValue{af_array}(0)
1495 0
    _error(ccall((:af_canny,af_lib),af_err,(Ptr{af_array},af_array,af_canny_threshold,Cfloat,Cfloat,UInt32,Bool),out,_in.arr,threshold_type,low_threshold_ratio,high_threshold_ratio,UInt32(sobel_window),is_fast))
1496 0
    AFArray{T,N}(out[])
1497
end
1498

1499
function anisotropic_diffusion(_in::AFArray{T,N},timestep::Cfloat,conductance::Cfloat,iterations::Integer,fftype::af_flux_function,diffusion_kind::af_diffusion_eq) where {T,N}
1500 0
    out = RefValue{af_array}(0)
1501 0
    _error(ccall((:af_anisotropic_diffusion,af_lib),af_err,(Ptr{af_array},af_array,Cfloat,Cfloat,UInt32,af_flux_function,af_diffusion_eq),out,_in.arr,timestep,conductance,UInt32(iterations),fftype,diffusion_kind))
1502 0
    AFArray{T,N}(out[])
1503
end
1504

1505
function svd_inplace(_in::AFArray)
1506 0
    u = RefValue{af_array}(0)
1507 0
    s = RefValue{af_array}(0)
1508 0
    vt = RefValue{af_array}(0)
1509 0
    _error(ccall((:af_svd_inplace,af_lib),af_err,(Ptr{af_array},Ptr{af_array},Ptr{af_array},af_array),u,s,vt,_in.arr))
1510 0
    (AFArray!(u[]),AFArray!(s[]),AFArray!(vt[]))
1511
end
1512

1513
function lu(_in::AFArray)
1514 0
    lower = RefValue{af_array}(0)
1515 0
    upper = RefValue{af_array}(0)
1516 0
    pivot = RefValue{af_array}(0)
1517 0
    _error(ccall((:af_lu,af_lib),af_err,(Ptr{af_array},Ptr{af_array},Ptr{af_array},af_array),lower,upper,pivot,_in.arr))
1518 0
    (AFArray!(lower[]),AFArray!(upper[]),AFArray!(pivot[]))
1519
end
1520

1521
function lu_inplace(_in::AFArray{T,N},is_lapack_piv::Bool) where {T,N}
1522 0
    pivot = RefValue{af_array}(0)
1523 0
    _error(ccall((:af_lu_inplace,af_lib),af_err,(Ptr{af_array},af_array,Bool),pivot,_in.arr,is_lapack_piv))
1524 0
    AFArray{T,N}(pivot[])
1525
end
1526

1527
function qr(_in::AFArray)
1528 0
    q = RefValue{af_array}(0)
1529 0
    r = RefValue{af_array}(0)
1530 0
    tau = RefValue{af_array}(0)
1531 0
    _error(ccall((:af_qr,af_lib),af_err,(Ptr{af_array},Ptr{af_array},Ptr{af_array},af_array),q,r,tau,_in.arr))
1532 0
    (AFArray!(q[]),AFArray!(r[]),AFArray!(tau[]))
1533
end
1534

1535
function qr_inplace(_in::AFArray{T,N}) where {T,N}
1536 0
    tau = RefValue{af_array}(0)
1537 0
    _error(ccall((:af_qr_inplace,af_lib),af_err,(Ptr{af_array},af_array),tau,_in.arr))
1538 0
    AFArray{T,N}(tau[])
1539
end
1540

1541
function cholesky_inplace(_in::AFArray,is_upper::Bool)
1542 0
    info = RefValue{Cint}(0)
1543 0
    _error(ccall((:af_cholesky_inplace,af_lib),af_err,(Ptr{Cint},af_array,Bool),info,_in.arr,is_upper))
1544 0
    info[]
1545
end
1546

1547
function solve(a::AFArray,b::AFArray,options::af_mat_prop)
1548 0
    x = RefValue{af_array}(0)
1549 0
    _error(ccall((:af_solve,af_lib),af_err,(Ptr{af_array},af_array,af_array,af_mat_prop),x,a.arr,b.arr,options))
1550 0
    AFArray!(x[])
1551
end
1552

1553
function solve_lu(a::AFArray,piv::AFArray,b::AFArray,options::af_mat_prop)
1554 0
    x = RefValue{af_array}(0)
1555 0
    _error(ccall((:af_solve_lu,af_lib),af_err,(Ptr{af_array},af_array,af_array,af_array,af_mat_prop),x,a.arr,piv.arr,b.arr,options))
1556 0
    AFArray!(x[])
1557
end
1558

1559
function inverse(_in::AFArray{T,N},options::af_mat_prop) where {T,N}
1560 0
    out = RefValue{af_array}(0)
1561 0
    _error(ccall((:af_inverse,af_lib),af_err,(Ptr{af_array},af_array,af_mat_prop),out,_in.arr,options))
1562 0
    AFArray{T,N}(out[])
1563
end
1564

1565
function rank(_in::AFArray,tol::Real)
1566 0
    rank = RefValue{UInt32}(0)
1567 0
    _error(ccall((:af_rank,af_lib),af_err,(Ptr{UInt32},af_array,Cdouble),rank,_in.arr,Cdouble(tol)))
1568 0
    rank[]
1569
end
1570

1571
function det(_in::AFArray)
1572 0
    det_real = RefValue{Cdouble}(0)
1573 0
    det_imag = RefValue{Cdouble}(0)
1574 0
    _error(ccall((:af_det,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array),det_real,det_imag,_in.arr))
1575 0
    (det_real[],det_imag[])
1576
end
1577

1578
function norm(_in::AFArray,_type::af_norm_type,p::Real,q::Real)
1579 3
    out = RefValue{Cdouble}(0)
1580 4
    _error(ccall((:af_norm,af_lib),af_err,(Ptr{Cdouble},af_array,af_norm_type,Cdouble,Cdouble),out,_in.arr,_type,Cdouble(p),Cdouble(q)))
1581 3
    out[]
1582
end
1583

1584
function is_lapack_available()
1585 0
    out = RefValue{Bool}(0)
1586 0
    _error(ccall((:af_is_lapack_available,af_lib),af_err,(Ptr{Bool},),out))
1587 0
    out[]
1588
end
1589

1590
function create_random_engine(rtype::af_random_engine_type,seed::uintl)
1591 0
    engine = RefValue{af_random_engine}(0)
1592 0
    _error(ccall((:af_create_random_engine,af_lib),af_err,(Ptr{af_random_engine},af_random_engine_type,uintl),engine,rtype,seed))
1593 0
    engine[]
1594
end
1595

1596
function retain_random_engine(engine::af_random_engine)
1597 0
    out = RefValue{af_random_engine}(0)
1598 0
    _error(ccall((:af_retain_random_engine,af_lib),af_err,(Ptr{af_random_engine},af_random_engine),out,engine))
1599 0
    out[]
1600
end
1601

1602
function random_engine_set_type(rtype::af_random_engine_type)
1603 0
    engine = RefValue{af_random_engine}(0)
1604 0
    _error(ccall((:af_random_engine_set_type,af_lib),af_err,(Ptr{af_random_engine},af_random_engine_type),engine,rtype))
1605 0
    engine[]
1606
end
1607

1608
function random_engine_get_type(engine::af_random_engine)
1609 0
    rtype = RefValue{af_random_engine_type}(0)
1610 0
    _error(ccall((:af_random_engine_get_type,af_lib),af_err,(Ptr{af_random_engine_type},af_random_engine),rtype,engine))
1611 0
    rtype[]
1612
end
1613

1614
function random_uniform(ndims::Integer,dims,_type::Type,engine::af_random_engine)
1615 0
    out = RefValue{af_array}(0)
1616 0
    _error(ccall((:af_random_uniform,af_lib),af_err,(Ptr{af_array},UInt32,Ptr{dim_t},af_dtype,af_random_engine),out,UInt32(ndims),dims,af_type(_type),engine))
1617 0
    AFArray!(out[])
1618
end
1619

1620
function random_normal(ndims::Integer,dims,_type::Type,engine::af_random_engine)
1621 0
    out = RefValue{af_array}(0)
1622 0
    _error(ccall((:af_random_normal,af_lib),af_err,(Ptr{af_array},UInt32,Ptr{dim_t},af_dtype,af_random_engine),out,UInt32(ndims),dims,af_type(_type),engine))
1623 0
    AFArray!(out[])
1624
end
1625

1626
function random_engine_set_seed(seed::uintl)
1627 0
    engine = RefValue{af_random_engine}(0)
1628 0
    _error(ccall((:af_random_engine_set_seed,af_lib),af_err,(Ptr{af_random_engine},uintl),engine,seed))
1629 0
    engine[]
1630
end
1631

1632
function get_default_random_engine()
1633 0
    engine = RefValue{af_random_engine}(0)
1634 0
    _error(ccall((:af_get_default_random_engine,af_lib),af_err,(Ptr{af_random_engine},),engine))
1635 0
    engine[]
1636
end
1637

1638
function set_default_random_engine_type(rtype::af_random_engine_type)
1639 0
    _error(ccall((:af_set_default_random_engine_type,af_lib),af_err,(af_random_engine_type,),rtype))
1640
end
1641

1642
function random_engine_get_seed(engine::af_random_engine)
1643 0
    seed = RefValue{uintl}(0)
1644 0
    _error(ccall((:af_random_engine_get_seed,af_lib),af_err,(Ptr{uintl},af_random_engine),seed,engine))
1645 0
    seed[]
1646
end
1647

1648
function release_random_engine(engine::af_random_engine)
1649 0
    _error(ccall((:af_release_random_engine,af_lib),af_err,(af_random_engine,),engine))
1650
end
1651

1652
function set_seed(seed::uintl)
1653 4
    _error(ccall((:af_set_seed,af_lib),af_err,(uintl,),seed))
1654
end
1655

1656
function get_seed()
1657 0
    seed = RefValue{uintl}(0)
1658 0
    _error(ccall((:af_get_seed,af_lib),af_err,(Ptr{uintl},),seed))
1659 0
    seed[]
1660
end
1661

1662
function approx1(_in::AFArray,pos::AFArray,method::af_interp_type,offGrid::Cfloat)
1663 0
    out = RefValue{af_array}(0)
1664 0
    _error(ccall((:af_approx1,af_lib),af_err,(Ptr{af_array},af_array,af_array,af_interp_type,Cfloat),out,_in.arr,pos.arr,method,offGrid))
1665 0
    AFArray!(out[])
1666
end
1667

1668
function approx2(_in::AFArray,pos0::AFArray,pos1::AFArray,method::af_interp_type,offGrid::Cfloat)
1669 0
    out = RefValue{af_array}(0)
1670 0
    _error(ccall((:af_approx2,af_lib),af_err,(Ptr{af_array},af_array,af_array,af_array,af_interp_type,Cfloat),out,_in.arr,pos0.arr,pos1.arr,method,offGrid))
1671 0
    AFArray!(out[])
1672
end
1673

1674
function convolve1(signal::AFArray,filter::AFArray,mode::af_conv_mode,domain::af_conv_domain)
1675 0
    out = RefValue{af_array}(0)
1676 0
    _error(ccall((:af_convolve1,af_lib),af_err,(Ptr{af_array},af_array,af_array,af_conv_mode,af_conv_domain),out,signal.arr,filter.arr,mode,domain))
1677 0
    AFArray!(out[])
1678
end
1679

1680
function convolve2(signal::AFArray,filter::AFArray,mode::af_conv_mode,domain::af_conv_domain)
1681 0
    out = RefValue{af_array}(0)
1682 0
    _error(ccall((:af_convolve2,af_lib),af_err,(Ptr{af_array},af_array,af_array,af_conv_mode,af_conv_domain),out,signal.arr,filter.arr,mode,domain))
1683 0
    AFArray!(out[])
1684
end
1685

1686
function convolve3(signal::AFArray,filter::AFArray,mode::af_conv_mode,domain::af_conv_domain)
1687 0
    out = RefValue{af_array}(0)
1688 0
    _error(ccall((:af_convolve3,af_lib),af_err,(Ptr{af_array},af_array,af_array,af_conv_mode,af_conv_domain),out,signal.arr,filter.arr,mode,domain))
1689 0
    AFArray!(out[])
1690
end
1691

1692
function convolve2_sep(col_filter::AFArray,row_filter::AFArray,signal::AFArray,mode::af_conv_mode)
1693 0
    out = RefValue{af_array}(0)
1694 0
    _error(ccall((:af_convolve2_sep,af_lib),af_err,(Ptr{af_array},af_array,af_array,af_array,af_conv_mode),out,col_filter.arr,row_filter.arr,signal.arr,mode))
1695 0
    AFArray!(out[])
1696
end
1697

1698
function medfilt(_in::AFArray{T,N},wind_length::dim_t,wind_width::dim_t,edge_pad::af_border_type) where {T,N}
1699 0
    out = RefValue{af_array}(0)
1700 0
    _error(ccall((:af_medfilt,af_lib),af_err,(Ptr{af_array},af_array,dim_t,dim_t,af_border_type),out,_in.arr,wind_length,wind_width,edge_pad))
1701 0
    AFArray{T,N}(out[])
1702
end
1703

1704
function medfilt1(_in::AFArray{T,N},wind_width::dim_t,edge_pad::af_border_type) where {T,N}
1705 0
    out = RefValue{af_array}(0)
1706 0
    _error(ccall((:af_medfilt1,af_lib),af_err,(Ptr{af_array},af_array,dim_t,af_border_type),out,_in.arr,wind_width,edge_pad))
1707 0
    AFArray{T,N}(out[])
1708
end
1709

1710
function medfilt2(_in::AFArray{T,N},wind_length::dim_t,wind_width::dim_t,edge_pad::af_border_type) where {T,N}
1711 0
    out = RefValue{af_array}(0)
1712 0
    _error(ccall((:af_medfilt2,af_lib),af_err,(Ptr{af_array},af_array,dim_t,dim_t,af_border_type),out,_in.arr,wind_length,wind_width,edge_pad))
1713 0
    AFArray{T,N}(out[])
1714
end
1715

1716
function create_sparse_array(nRows::dim_t,nCols::dim_t,values::AFArray,rowIdx::AFArray,colIdx::AFArray,stype::af_storage)
1717 3
    out = RefValue{af_array}(0)
1718 4
    _error(ccall((:af_create_sparse_array,af_lib),af_err,(Ptr{af_array},dim_t,dim_t,af_array,af_array,af_array,af_storage),out,nRows,nCols,values.arr,rowIdx.arr,colIdx.arr,stype))
1719 4
    AFArray!(out[])
1720
end
1721

1722
function create_sparse_array_from_ptr(nRows::dim_t,nCols::dim_t,nNZ::dim_t,values,rowIdx,colIdx,_type::Type,stype::af_storage,src::af_source)
1723 0
    out = RefValue{af_array}(0)
1724 0
    _error(ccall((:af_create_sparse_array_from_ptr,af_lib),af_err,(Ptr{af_array},dim_t,dim_t,dim_t,Ptr{Cvoid},Ptr{Cint},Ptr{Cint},af_dtype,af_storage,af_source),out,nRows,nCols,nNZ,values,rowIdx,colIdx,af_type(_type),stype,src))
1725 0
    AFArray!(out[])
1726
end
1727

1728
function create_sparse_array_from_dense(dense::AFArray,stype::af_storage)
1729 3
    out = RefValue{af_array}(0)
1730 4
    _error(ccall((:af_create_sparse_array_from_dense,af_lib),af_err,(Ptr{af_array},af_array,af_storage),out,dense.arr,stype))
1731 4
    AFArray!(out[])
1732
end
1733

1734
function sparse_convert_to(_in::AFArray{T,N},destStorage::af_storage) where {T,N}
1735 0
    out = RefValue{af_array}(0)
1736 0
    _error(ccall((:af_sparse_convert_to,af_lib),af_err,(Ptr{af_array},af_array,af_storage),out,_in.arr,destStorage))
1737 0
    AFArray{T,N}(out[])
1738
end
1739

1740
function full(sparse::AFArray{T,N}) where {T,N}
1741 4
    out = RefValue{af_array}(0)
1742 4
    _error(ccall((:af_sparse_to_dense,af_lib),af_err,(Ptr{af_array},af_array),out,sparse.arr))
1743 4
    AFArray{T,N}(out[])
1744
end
1745

1746
function sparse_get_info(_in::AFArray)
1747 3
    values = RefValue{af_array}(0)
1748 3
    rowIdx = RefValue{af_array}(0)
1749 3
    colIdx = RefValue{af_array}(0)
1750 3
    stype = RefValue{af_storage}(0)
1751 4
    _error(ccall((:af_sparse_get_info,af_lib),af_err,(Ptr{af_array},Ptr{af_array},Ptr{af_array},Ptr{af_storage},af_array),values,rowIdx,colIdx,stype,_in.arr))
1752 4
    (AFArray!(values[]),AFArray!(rowIdx[]),AFArray!(colIdx[]),stype[])
1753
end
1754

1755
function sparse_get_values(_in::AFArray{T,N}) where {T,N}
1756 0
    out = RefValue{af_array}(0)
1757 0
    _error(ccall((:af_sparse_get_values,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
1758 0
    AFArray{T,1}(out[])
1759
end
1760

1761
function sparse_get_row_idx(_in::AFArray{T,N}) where {T,N}
1762 0
    out = RefValue{af_array}(0)
1763 0
    _error(ccall((:af_sparse_get_row_idx,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
1764 0
    AFArray{Int32,1}(out[])
1765
end
1766

1767
function sparse_get_col_idx(_in::AFArray{T,N}) where {T,N}
1768 0
    out = RefValue{af_array}(0)
1769 0
    _error(ccall((:af_sparse_get_col_idx,af_lib),af_err,(Ptr{af_array},af_array),out,_in.arr))
1770 0
    AFArray{Int32,1}(out[])
1771
end
1772

1773
function sparse_get_nnz(_in::AFArray)
1774 0
    out = RefValue{dim_t}(0)
1775 0
    _error(ccall((:af_sparse_get_nnz,af_lib),af_err,(Ptr{dim_t},af_array),out,_in.arr))
1776 0
    out[]
1777
end
1778

1779
function sparse_get_storage(_in::AFArray)
1780 0
    out = RefValue{af_storage}(0)
1781 0
    _error(ccall((:af_sparse_get_storage,af_lib),af_err,(Ptr{af_storage},af_array),out,_in.arr))
1782 0
    out[]
1783
end
1784

1785
function cov(X::AFArray,Y::AFArray,isbiased::Bool)
1786 0
    out = RefValue{af_array}(0)
1787 0
    _error(ccall((:af_cov,af_lib),af_err,(Ptr{af_array},af_array,af_array,Bool),out,X.arr,Y.arr,isbiased))
1788 0
    AFArray!(out[])
1789
end
1790

1791
function mean_all(_in::AFArray)
1792 3
    real = RefValue{Cdouble}(0)
1793 3
    imag = RefValue{Cdouble}(0)
1794 4
    _error(ccall((:af_mean_all,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array),real,imag,_in.arr))
1795 3
    (real[],imag[])
1796
end
1797

1798
function mean_all_weighted(_in::AFArray,weights::AFArray)
1799 0
    real = RefValue{Cdouble}(0)
1800 0
    imag = RefValue{Cdouble}(0)
1801 0
    _error(ccall((:af_mean_all_weighted,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array,af_array),real,imag,_in.arr,weights.arr))
1802 0
    (real[],imag[])
1803
end
1804

1805
function var_all(_in::AFArray,isbiased::Bool)
1806 3
    realVal = RefValue{Cdouble}(0)
1807 3
    imagVal = RefValue{Cdouble}(0)
1808 4
    _error(ccall((:af_var_all,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array,Bool),realVal,imagVal,_in.arr,isbiased))
1809 3
    (realVal[],imagVal[])
1810
end
1811

1812
function var_all_weighted(_in::AFArray,weights::AFArray)
1813 0
    realVal = RefValue{Cdouble}(0)
1814 0
    imagVal = RefValue{Cdouble}(0)
1815 0
    _error(ccall((:af_var_all_weighted,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array,af_array),realVal,imagVal,_in.arr,weights.arr))
1816 0
    (realVal[],imagVal[])
1817
end
1818

1819
function stdev_all(_in::AFArray)
1820 0
    real = RefValue{Cdouble}(0)
1821 0
    imag = RefValue{Cdouble}(0)
1822 0
    _error(ccall((:af_stdev_all,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array),real,imag,_in.arr))
1823 0
    (real[],imag[])
1824
end
1825

1826
function median_all(_in::AFArray)
1827 3
    realVal = RefValue{Cdouble}(0)
1828 3
    imagVal = RefValue{Cdouble}(0)
1829 4
    _error(ccall((:af_median_all,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array),realVal,imagVal,_in.arr))
1830 3
    (realVal[],imagVal[])
1831
end
1832

1833
function corrcoef(X::AFArray,Y::AFArray)
1834 0
    realVal = RefValue{Cdouble}(0)
1835 0
    imagVal = RefValue{Cdouble}(0)
1836 0
    _error(ccall((:af_corrcoef,af_lib),af_err,(Ptr{Cdouble},Ptr{Cdouble},af_array,af_array),realVal,imagVal,X.arr,Y.arr))
1837 0
    (realVal[],imagVal[])
1838
end
1839

1840
function topk(_in::AFArray,k::Integer,dim::Integer,order::af_topk_function)
1841 0
    values = RefValue{af_array}(0)
1842 0
    indices = RefValue{af_array}(0)
1843 0
    _error(ccall((:af_topk,af_lib),af_err,(Ptr{af_array},Ptr{af_array},af_array,Cint,Cint,af_topk_function),values,indices,_in.arr,Cint(k),Cint(dim - 1),order))
1844 0
    (AFArray!(values[]),AFArray!(indices[]))
1845
end
1846

1847
function fast(_in::AFArray,thr::Cfloat,arc_length::Integer,non_max::Bool,feature_ratio::Cfloat,edge::Integer)
1848 0
    out = RefValue{af_features}(0)
1849 0
    _error(ccall((:af_fast,af_lib),af_err,(Ptr{af_features},af_array,Cfloat,UInt32,Bool,Cfloat,UInt32),out,_in.arr,thr,UInt32(arc_length),non_max,feature_ratio,UInt32(edge)))
1850 0
    out[]
1851
end
1852

1853
function harris(_in::AFArray,max_corners::Integer,min_response::Cfloat,sigma::Cfloat,block_size::Integer,k_thr::Cfloat)
1854 0
    out = RefValue{af_features}(0)
1855 0
    _error(ccall((:af_harris,af_lib),af_err,(Ptr{af_features},af_array,UInt32,Cfloat,Cfloat,UInt32,Cfloat),out,_in.arr,UInt32(max_corners),min_response,sigma,UInt32(block_size),k_thr))
1856 0
    out[]
1857
end
1858

1859
function orb(_in::AFArray,fast_thr::Cfloat,max_feat::Integer,scl_fctr::Cfloat,levels::Integer,blur_img::Bool)
1860 0
    feat = RefValue{af_features}(0)
1861 0
    desc = RefValue{af_array}(0)
1862 0
    _error(ccall((:af_orb,af_lib),af_err,(Ptr{af_features},Ptr{af_array},af_array,Cfloat,UInt32,Cfloat,UInt32,Bool),feat,desc,_in.arr,fast_thr,UInt32(max_feat),scl_fctr,UInt32(levels),blur_img))
1863 0
    (feat[],AFArray!(desc[]))
1864
end
1865

1866
function sift(_in::AFArray,n_layers::Integer,contrast_thr::Cfloat,edge_thr::Cfloat,init_sigma::Cfloat,double_input::Bool,intensity_scale::Cfloat,feature_ratio::Cfloat)
1867 0
    feat = RefValue{af_features}(0)
1868 0
    desc = RefValue{af_array}(0)
1869 0
    _error(ccall((:af_sift,af_lib),af_err,(Ptr{af_features},Ptr{af_array},af_array,UInt32,Cfloat,Cfloat,Cfloat,Bool,Cfloat,Cfloat),feat,desc,_in.arr,UInt32(n_layers),contrast_thr,edge_thr,init_sigma,double_input,intensity_scale,feature_ratio))
1870 0
    (feat[],AFArray!(desc[]))
1871
end
1872

1873
function gloh(_in::AFArray,n_layers::Integer,contrast_thr::Cfloat,edge_thr::Cfloat,init_sigma::Cfloat,double_input::Bool,intensity_scale::Cfloat,feature_ratio