ArrayFire: util.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10#pragma once

12

13#ifdef __cplusplus

14namespace af

15{

16 class array;

17

25

26#if AF_API_VERSION >= 31

35#endif

36

37#if AF_API_VERSION >= 31

49 AFAPI int saveArray(const char *key, const array &arr, const char *filename, const bool append = false);

50#endif

51

52#if AF_API_VERSION >= 31

64#endif

65

66#if AF_API_VERSION >= 31

78#endif

79

80#if AF_API_VERSION >= 31

93#endif

94

95#if AF_API_VERSION >= 31

109 const int precision = 4, const bool transpose = true);

110#endif

111

112#if AF_API_VERSION >= 33

127 const int precision = 4, const bool transpose = true);

128#endif

129

130

132

133#if AF_API_VERSION >= 34

138#endif

139}

140

141#if AF_API_VERSION >= 31

142

143#define AF_PRINT1(exp) af::print(#exp, exp);

144#define AF_PRINT2(exp, precision) af::print(#exp, exp, precision);

145

146#define GET_PRINT_MACRO(_1, _2, NAME, ...) NAME

147

148#define af_print(...) GET_PRINT_MACRO(__VA_ARGS__, AF_PRINT2, AF_PRINT1)(__VA_ARGS__)

149

150#else

151

152#define af_print(exp) af::print(#exp, exp);

153

154#endif

155

156#endif

157

158#ifdef __cplusplus

159extern "C" {

160#endif

161

170

171#if AF_API_VERSION >= 31

182#endif

183

184#if AF_API_VERSION >= 31

196#endif

197

198#if AF_API_VERSION >= 31

209#endif

210

211#if AF_API_VERSION >= 31

222#endif

223

224#if AF_API_VERSION >= 31

236#endif

237

238#if AF_API_VERSION >= 31

251 const int precision, const bool transpose);

252#endif

253

254

258

263

264

265#if AF_API_VERSION >= 33

272#endif

273

274#if AF_API_VERSION >= 34

279#endif

280

281#if AF_API_VERSION >= 37

288#endif

289

290#ifdef __cplusplus

291}

292#endif

A multi dimensional data container.

AFAPI array exp(const array &in)

C++ Interface to evaluate the exponential.

AFAPI array transpose(const array &in, const bool conjugate=false)

C++ Interface to transpose a matrix.

AFAPI af_err af_print_array(af_array arr)

AFAPI af_err af_print_array_gen(const char *exp, const af_array arr, const int precision)

AFAPI void print(const char *exp, const array &arr)

AFAPI af_err af_array_to_string(char **output, const char *exp, const af_array arr, const int precision, const bool transpose)

AFAPI void toString(char **output, const char *exp, const array &arr, const int precision=4, const bool transpose=true)

AFAPI int readArrayCheck(const char *filename, const char *key)

When reading by key, it may be a good idea to run this function first to check for the key and then c...

AFAPI af_err af_read_array_key_check(int *index, const char *filename, const char *key)

When reading by key, it may be a good idea to run this function first to check for the key and then c...

AFAPI af_err af_read_array_key(af_array *out, const char *filename, const char *key)

AFAPI array readArray(const char *filename, const unsigned index)

AFAPI af_err af_read_array_index(af_array *out, const char *filename, const unsigned index)

AFAPI af_err af_save_array(int *index, const char *key, const af_array arr, const char *filename, const bool append)

AFAPI int saveArray(const char *key, const array &arr, const char *filename, const bool append=false)

AFAPI array exampleFunction(const array &in, const af_someenum_t param)

AFAPI size_t getSizeOf(af::dtype type)

Get the size of the type represented by an af_dtype enum.

AFAPI af_err af_example_function(af_array *out, const af_array in, const af_someenum_t param)

AFAPI af_err af_get_version(int *major, int *minor, int *patch)

Get the version information of the library.

AFAPI af_err af_get_size_of(size_t *size, af_dtype type)

Get the size of the type represented by an af_dtype enum.

AFAPI const char * af_get_revision()

Get the revision (commit) information of the library.

AFAPI af_err af_set_enable_stacktrace(int is_enabled)

Enable(default) or disable error messages that display the stacktrace.