forked from hunter-packages/arrayfire
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.cpp
More file actions
180 lines (148 loc) · 4.63 KB
/
data.cpp
File metadata and controls
180 lines (148 loc) · 4.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/*******************************************************
* Copyright (c) 2015, ArrayFire
* All rights reserved.
*
* This file is distributed under 3-clause BSD license.
* The complete license agreement can be obtained at:
* http://arrayfire.com/licenses/BSD-3-Clause
********************************************************/
#include <af/array.h>
#include <af/data.h>
#include "symbol_manager.hpp"
af_err af_constant(af_array *result, const double value,
const unsigned ndims, const dim_t * const dims,
const af_dtype type)
{
return CALL(result, value, ndims, dims, type);
}
af_err af_constant_complex(af_array *arr, const double real, const double imag,
const unsigned ndims, const dim_t * const dims, const af_dtype type)
{
return CALL(arr, real, imag, ndims, dims, type);
}
af_err af_constant_long (af_array *arr, const intl val, const unsigned ndims, const dim_t * const dims)
{
return CALL(arr, val, ndims, dims);
}
af_err af_constant_ulong(af_array *arr, const uintl val, const unsigned ndims, const dim_t * const dims)
{
return CALL(arr, val, ndims, dims);
}
af_err af_range(af_array *out, const unsigned ndims, const dim_t * const dims,
const int seq_dim, const af_dtype type)
{
return CALL(out, ndims, dims, seq_dim, type);
}
af_err af_iota(af_array *out, const unsigned ndims, const dim_t * const dims,
const unsigned t_ndims, const dim_t * const tdims, const af_dtype type)
{
return CALL(out, ndims, dims, t_ndims, tdims, type);
}
af_err af_randu(af_array *out, const unsigned ndims, const dim_t * const dims, const af_dtype type)
{
return CALL(out, ndims, dims, type);
}
af_err af_randn(af_array *out, const unsigned ndims, const dim_t * const dims, const af_dtype type)
{
return CALL(out, ndims, dims, type);
}
af_err af_set_seed(const uintl seed)
{
return CALL(seed);
}
af_err af_get_seed(uintl *seed)
{
return CALL(seed);
}
af_err af_identity(af_array *out, const unsigned ndims, const dim_t * const dims, const af_dtype type)
{
return CALL(out, ndims, dims, type);
}
af_err af_diag_create(af_array *out, const af_array in, const int num)
{
CHECK_ARRAYS(in);
return CALL(out, in, num);
}
af_err af_diag_extract(af_array *out, const af_array in, const int num)
{
CHECK_ARRAYS(in);
return CALL(out, in, num);
}
af_err af_join(af_array *out, const int dim, const af_array first, const af_array second)
{
CHECK_ARRAYS(first, second);
return CALL(out, dim, first, second);
}
af_err af_join_many(af_array *out, const int dim, const unsigned n_arrays, const af_array *inputs)
{
for(unsigned i = 0; i < n_arrays; i++)
CHECK_ARRAYS(inputs[i]);
return CALL(out, dim, n_arrays, inputs);
}
af_err af_tile(af_array *out, const af_array in,
const unsigned x, const unsigned y, const unsigned z, const unsigned w)
{
CHECK_ARRAYS(in);
return CALL(out, in, x, y, z, w);
}
af_err af_reorder(af_array *out, const af_array in,
const unsigned x, const unsigned y, const unsigned z, const unsigned w)
{
CHECK_ARRAYS(in);
return CALL(out, in, x, y, z, w);
}
af_err af_shift(af_array *out, const af_array in, const int x, const int y, const int z, const int w)
{
CHECK_ARRAYS(in);
return CALL(out, in, x, y, z, w);
}
af_err af_moddims(af_array *out, const af_array in, const unsigned ndims, const dim_t * const dims)
{
CHECK_ARRAYS(in);
return CALL(out, in, ndims, dims);
}
af_err af_flat(af_array *out, const af_array in)
{
CHECK_ARRAYS(in);
return CALL(out, in);
}
af_err af_flip(af_array *out, const af_array in, const unsigned dim)
{
CHECK_ARRAYS(in);
return CALL(out, in, dim);
}
af_err af_lower(af_array *out, const af_array in, bool is_unit_diag)
{
CHECK_ARRAYS(in);
return CALL(out, in, is_unit_diag);
}
af_err af_upper(af_array *out, const af_array in, bool is_unit_diag)
{
CHECK_ARRAYS(in);
return CALL(out, in, is_unit_diag);
}
af_err af_select(af_array *out, const af_array cond, const af_array a, const af_array b)
{
CHECK_ARRAYS(cond, a, b);
return CALL(out, cond, a, b);
}
af_err af_select_scalar_r(af_array *out, const af_array cond, const af_array a, const double b)
{
CHECK_ARRAYS(cond, a);
return CALL(out, cond, a, b);
}
af_err af_select_scalar_l(af_array *out, const af_array cond, const double a, const af_array b)
{
CHECK_ARRAYS(cond, b);
return CALL(out, cond, a, b);
}
af_err af_replace(af_array a, const af_array cond, const af_array b)
{
CHECK_ARRAYS(a, cond, b);
return CALL(a, cond, b);
}
af_err af_replace_scalar(af_array a, const af_array cond, const double b)
{
CHECK_ARRAYS(a, cond);
return CALL(a, cond, b);
}