defines.h
Go to the documentation of this file.
1 /*******************************************************
2  * Copyright (c) 2014, ArrayFire
3  * All rights reserved.
4  *
5  * This file is distributed under 3-clause BSD license.
6  * The complete license agreement can be obtained at:
7  * http://arrayfire.com/licenses/BSD-3-Clause
8  ********************************************************/
9 
10 #pragma once
11 
12 #if defined(_WIN32) || defined(_MSC_VER)
13  // http://msdn.microsoft.com/en-us/library/b0084kay(v=VS.80).aspx
14  // http://msdn.microsoft.com/en-us/library/3y1sfaz2%28v=VS.80%29.aspx
15  #ifdef AFDLL // libaf
16  #define AFAPI __declspec(dllexport)
17  #else
18  #define AFAPI __declspec(dllimport)
19  #endif
20 
21 // bool
22  #ifndef __cplusplus
23  #define bool unsigned char
24  #define false 0
25  #define true 1
26  #endif
27  #define __PRETTY_FUNCTION__ __FUNCSIG__
28  #define SIZE_T_FRMT_SPECIFIER "%Iu"
29  #define DEPRECATED(msg) __declspec(deprecated( msg ))
30 #else
31  #define AFAPI __attribute__((visibility("default")))
32  #include <stdbool.h>
33  #define SIZE_T_FRMT_SPECIFIER "%zu"
34 #if __GNUC__ >= 4 && __GNUC_MINOR > 4
35  #define DEPRECATED(msg) __attribute__((deprecated( msg )))
36 #else
37  #define DEPRECATED(msg) __attribute__((deprecated))
38 #endif
39 
40 #endif
41 
42 // Known 64-bit x86 and ARM architectures use long long
43 #if defined(__x86_64__) || defined(_M_X64) || defined(_WIN64) || defined(__aarch64__) || defined(__LP64__) // 64-bit Architectures
44  typedef long long dim_t;
45 // Known 32-bit x86 and ARM architectures use int
46 #elif defined(__i386__) || defined(_M_IX86) || defined(__arm__) || defined(_M_ARM) // 32-bit x86 Architecture
47  typedef int dim_t;
48 // All other platforms use long long
49 #else
50  typedef long long dim_t;
51 #endif
52 
53 #include <stdlib.h>
54 
55 typedef long long intl;
56 typedef unsigned long long uintl;
57 
58 typedef enum {
63 
64  // 100-199 Errors in environment
65 
70 
75 
80 
81  // 200-299 Errors in input parameters
82 
87 
91  AF_ERR_ARG = 202,
92 
96  AF_ERR_SIZE = 203,
97 
101  AF_ERR_TYPE = 204,
102 
107 
112 
113 
114  // 300-399 Errors for missing software features
115 
120 
125  // 400-499 Errors for missing hardware features
126 
131 
137  // 900-999 Errors from upstream libraries and runtimes
138 
144 
149 } af_err;
150 
151 typedef enum {
152  f32,
153  c32,
154  f64,
155  c64,
156  b8,
157  s32,
158  u32,
159  u8,
160  s64,
162 } af_dtype;
163 
164 typedef enum {
167 } af_source;
168 
169 #define AF_MAX_DIMS 4
170 
171 // A handle for an internal array object
172 typedef void * af_array;
173 
174 typedef enum {
180 
181 typedef enum {
186 
192 
193 typedef enum {
198 
204 
205 typedef enum {
206 
211 
216 } af_conv_mode;
217 
218 typedef enum {
223 
224 typedef enum {
225  AF_SAD = 0,
234 } af_match_type;
235 
236 typedef enum {
237  AF_GRAY = 0,
240 } af_cspace_t;
241 
242 typedef enum {
249  AF_MAT_SYM = 512,
250  AF_MAT_POSDEF = 1024,
251  AF_MAT_ORTHOG = 2048,
254 } af_mat_prop;
255 
256 typedef enum {
265 
267 } af_norm_type;
268 
269 typedef enum {
277 } af_colormap;
278 
279 // Below enum is purely added for example purposes
280 // it doesn't and shoudn't be used anywhere in the
281 // code. No Guarantee's provided if it is used.
282 typedef enum {
283  AF_ID = 0
284 } af_someenum_t;
285 
286 #ifdef __cplusplus
287 namespace af
288 {
289  typedef af_dtype dtype;
290  typedef af_source source;
296  typedef af_someenum_t SomeEnum; // Purpose of Addition: How to add Function example
303 }
304 
305 #endif
The system or device ran out of memory.
Definition: defines.h:69
af_source source
Definition: defines.h:290
Matrix is symmetric.
Definition: defines.h:249
returns the max singular value). Currently NOT SUPPORTED
Definition: defines.h:263
Match based on Sum of Squared Differences (SSD)
Definition: defines.h:228
af_someenum_t SomeEnum
Definition: defines.h:296
af_colormap ColorMap
Definition: defines.h:301
Cubic Interpolation.
Definition: defines.h:178
Matrix is orthogonal.
Definition: defines.h:251
Linear Interpolation.
Definition: defines.h:176
Definition: algorithm.h:14
Definition: defines.h:283
Device pointer.
Definition: defines.h:165
The function returned successfully.
Definition: defines.h:62
af_norm_type
Definition: defines.h:256
af_border_type
Definition: defines.h:181
The type of the input arrays are not compatible.
Definition: defines.h:106
Output of the convolution is signal_len + filter_len - 1.
Definition: defines.h:215
Blue hue map.
Definition: defines.h:276
Matrix is upper triangular.
Definition: defines.h:246
Matrix diagonal contains unitary values.
Definition: defines.h:248
Output of the convolution is the same size as input.
Definition: defines.h:210
Mood map.
Definition: defines.h:274
32-bit signed integral values
Definition: defines.h:157
Function does not support GFOR / batch mode.
Definition: defines.h:111
Matrix is positive definite.
Definition: defines.h:250
The option is not supported.
Definition: defines.h:119
Match based on Zero mean SAD.
Definition: defines.h:226
64-bit signed integral values
Definition: defines.h:160
Match based on Zero mean SSD.
Definition: defines.h:229
Grayscale.
Definition: defines.h:237
Match based on Zero mean NCC.
Definition: defines.h:232
Default.
Definition: defines.h:243
af_interp_type
Definition: defines.h:174
Match based on Locally scaled SSD.
Definition: defines.h:230
Data needs to be conjugate tansposed.
Definition: defines.h:245
64-bit complex floating point values
Definition: defines.h:154
Match based on Normalized Cross Correlation (NCC)
Definition: defines.h:231
treats the input as a vector and returns the p-norm
Definition: defines.h:260
af_conv_domain
Definition: defines.h:218
af_colormap
Definition: defines.h:269
return the max of row sums
Definition: defines.h:262
There was an error with the runtime environment.
Definition: defines.h:79
Out of bound values are symmetric over the edge.
Definition: defines.h:190
Spectrum map.
Definition: defines.h:271
3-channel HSV
Definition: defines.h:239
af_connectivity
Definition: defines.h:193
returns Lpq-norm
Definition: defines.h:264
af_err
Definition: defines.h:58
Match based on Locally scaled SAD.
Definition: defines.h:227
The type is not suppported by this function.
Definition: defines.h:101
af_source
Definition: defines.h:164
Connectivity includes neighbors, North, East, South and West of current pixel.
Definition: defines.h:197
64-bit unsigned integral values
Definition: defines.h:161
af_someenum_t
Definition: defines.h:282
af_conv_mode
Definition: defines.h:205
Out of bound values are 0.
Definition: defines.h:185
Bilinear Interpolation.
Definition: defines.h:177
This device does not support double.
Definition: defines.h:130
64-bit complex floating point values
Definition: defines.h:155
long long dim_t
Definition: defines.h:50
This build of ArrayFire was not built with graphics or this device does not support graphics...
Definition: defines.h:136
This build of ArrayFire does not support this feature.
Definition: defines.h:124
ArrayFire automatically picks the right convolution algorithm.
Definition: defines.h:219
32-bit complex floating point values
Definition: defines.h:153
af_mat_prop matProp
Definition: defines.h:300
af_norm_type normType
Definition: defines.h:302
treats the input as a vector and returns the max of absolute values
Definition: defines.h:258
Matrix is block diagonal.
Definition: defines.h:253
There was an error in the device driver.
Definition: defines.h:74
Connectivity includes 4-connectivity neigbors and also those on Northeast, Northwest, Southeast and Southwest.
Definition: defines.h:202
af_conv_domain convDomain
Definition: defines.h:299
The default. Same as AF_NORM_VECTOR_2.
Definition: defines.h:266
8-bit unsigned integral values
Definition: defines.h:159
af_border_type borderType
Definition: defines.h:292
Perform convolution in spatial domain.
Definition: defines.h:220
Perform convolution in frequency domain.
Definition: defines.h:221
Match based on Sum of Hamming Distances (SHD)
Definition: defines.h:233
Match based on Sum of Absolute Differences (SAD)
Definition: defines.h:225
Data needs to be transposed.
Definition: defines.h:244
return the max of column sums
Definition: defines.h:261
af_mat_prop trans
Definition: defines.h:297
One of the function arguments is incorrect.
Definition: defines.h:91
Nearest Interpolation.
Definition: defines.h:175
unsigned long long uintl
Definition: defines.h:56
3-channel RGB
Definition: defines.h:238
af_mat_prop
Definition: defines.h:242
The input array is not a valid af_array object.
Definition: defines.h:86
32-bit unsigned integral values
Definition: defines.h:158
af_cspace_t
Definition: defines.h:236
Default grayscale map.
Definition: defines.h:270
Matrix is lower triangular.
Definition: defines.h:247
void * af_array
Definition: defines.h:172
af_match_type matchType
Definition: defines.h:294
Matrix is tri diagonal.
Definition: defines.h:252
af_cspace_t CSpace
Definition: defines.h:295
32-bit floating point values
Definition: defines.h:152
treats the input as a vector and returns euclidean norm
Definition: defines.h:259
Heat map.
Definition: defines.h:275
treats the input as a vector and returns the sum of absolute values
Definition: defines.h:257
8-bit boolean values
Definition: defines.h:156
Host pointer.
Definition: defines.h:166
af_dtype
Definition: defines.h:151
af_interp_type interpType
Definition: defines.h:291
af_match_type
Definition: defines.h:224
Red hue map.
Definition: defines.h:273
There was an internal error either in ArrayFire or in a project upstream.
Definition: defines.h:143
af_conv_mode convMode
Definition: defines.h:298
Unknown Error.
Definition: defines.h:148
af_dtype dtype
Definition: defines.h:289
long long intl
Definition: defines.h:55
Colors.
Definition: defines.h:272
The size is incorrect.
Definition: defines.h:96
af_connectivity connectivity
Definition: defines.h:293