-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsli_array_module.h
371 lines (323 loc) · 9.11 KB
/
sli_array_module.h
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
/*
* sliarray.h
*
* This file is part of NEST
*
* Copyright (C) 2004 by
* The NEST Initiative
*
* See the file AUTHORS for details.
*
* Permission is granted to compile and modify
* this file for non-commercial use.
* See the file LICENSE for details.
*
*/
#ifndef SLI_ARRAY_MODULE_H
#define SLIARRAY_MODULE_H
/*
SLI's array access functions
*/
#include "sli_module.h"
#include "sli_function.h"
namespace sli3
{
/**
* SLI module defining array functions.
* This class implements the SLI functions which operate on SLI arrays.
*/
class SLIArrayModule: public SLIModule
{
/**
* @defgroup sliarray SLI array functions
* SLI functions that operate on SLI arrays.
* @{
*/
class MapFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class IMapFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
void backtrace(SLIInterpreter *, int) const ;
};
class MapThreadFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class IMapThreadFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
void backtrace(SLIInterpreter *, int) const ;
};
class MapIndexedFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class IMapIndexedFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
void backtrace(SLIInterpreter *, int) const ;
};
class RangeFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class ArraystoreFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class ArrayloadFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class ReverseFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class RotateFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class FlattenFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class SortFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class UniqueFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class TransposeFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class PartitionFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class ValidFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class Put_a_a_tFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
/**
* Return array of indices defining a 2d subarea of a 2d array.
*
* Given a -- hypothetical -- twodimensional array,
* "area" tells you, what indices you need to
* subscript a contiguous, twodimensional subarea.
* Returns 1-d indices.
*
* For further information refer to the SLI documentation.
*
* @par Synopsis:
* source_width source_anchor_y source_anchor_x
* area_height area_width area_anchor_y area_anchor_x
* area -> [1d-indices]
*
* @param source_width width of the (hypothetical) source
* array to be subscribed into
* @param source_anchor_y y position of the anchor point relative
* to ORIGIN OF THE SOURCE ARRAY
* @param source_anchor_x x position of the anchor point relative
* to ORIGIN OF THE SOURCE ARRAY
*
* @param area_height height of the subarea to be subscribed
* @param area_width width of the subarea to be subscribed
* @param area_anchor_y y position of the anchor point relative
* to ORIGIN OF THE SUBAREA
* @param area_anchor_x x position of the anchor point relative
* to ORIGIN OF THE SUBAREA
*
* @return \a [1d-indices] flat integer array containing the indices
* that can be used to subscript the
* (hypothetical) source array in order to
* access the desired subarea.
*/
class AreaFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
/**
* Return array of indices defining a 2d subarea of a 2d array.
*
* Given a -- hypothetical -- twodimensional array,
* "area" tells you, what indices you need to
* subscript a contiguous, twodimensional subarea.
* Returns 2-d indices.
*
* For further information refer to the SLI documentation.
*
* @par Synopsis:
* source_anchor_y source_anchor_x
* area_height area_width area_anchor_y area_anchor_x
* area -> [1d-indices]
*
* @param source_anchor_y y position of the anchor point relative
* to ORIGIN OF THE SOURCE ARRAY
* @param source_anchor_x x position of the anchor point relative
* to ORIGIN OF THE SOURCE ARRAY
*
* @param area_height height of the subarea to be subscribed
* @param area_width width of the subarea to be subscribed
* @param area_anchor_y y position of the anchor point relative
* to ORIGIN OF THE SUBAREA
* @param area_anchor_x x position of the anchor point relative
* to ORIGIN OF THE SUBAREA
*
* @return \a [2d-indices] flat integer array containing the indices
* that can be used to subscript the
* (hypothetical) source array in order to
* access the desired subarea.
*/
class Area2Function: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class Cv1dFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class Cv2dFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class GetMaxFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
class GetMinFunction: public SLIFunction
{
public:
void execute(SLIInterpreter *) const;
};
/**
* Generate two-dimensional array with Gabor patch.
*/
class GaborFunction: public SLIFunction
{
public:
GaborFunction() {}
void execute(SLIInterpreter *) const;
};
/**
* Generate two-dimensional array with Gauss patch.
*/
class Gauss2dFunction: public SLIFunction
{
public:
Gauss2dFunction() {}
void execute(SLIInterpreter *) const;
};
/**
* Convert SLI array to std::vector.
*/
class Array2IntVectorFunction: public SLIFunction
{
public:
Array2IntVectorFunction() {}
void execute(SLIInterpreter *) const;
};
/**
* Convert SLI array to std::vector.
*/
class Array2DoubleVectorFunction: public SLIFunction
{
public:
Array2DoubleVectorFunction() {}
void execute(SLIInterpreter *) const;
};
class DoubleVector2ArrayFunction: public SLIFunction
{
public:
DoubleVector2ArrayFunction() {}
void execute(SLIInterpreter *) const;
};
class IntVector2ArrayFunction: public SLIFunction
{
public:
IntVector2ArrayFunction() {}
void execute(SLIInterpreter *) const;
};
/**
* Test single double for finiteness.
* @todo This class does not really belong into sliarray, but is placed
* here since it is a Mathematica-style Q function.
*/
class FiniteQ_dFunction : public SLIFunction
{
public:
FiniteQ_dFunction() {}
void execute(SLIInterpreter *) const;
};
/** @} */
RangeFunction rangefunction;
ArraystoreFunction arraystorefunction;
ArraycreateFunction arraycreatefunction;
ArrayloadFunction arrayloadfunction;
ReverseFunction reversefunction;
RotateFunction rotatefunction;
FlattenFunction flattenfunction;
SortFunction sortfunction;
TransposeFunction transposefunction;
MapFunction mapfunction;
IMapFunction imapfunction;
MapIndexedFunction mapindexedfunction;
IMapIndexedFunction imapindexedfunction;
MapThreadFunction mapthreadfunction;
IMapThreadFunction imapthreadfunction;
PartitionFunction partitionfunction;
ValidFunction validfunction;
AreaFunction areafunction;
Area2Function area2function;
Cv1dFunction cv1dfunction;
Cv2dFunction cv2dfunction;
GetMaxFunction getmaxfunction;
GetMinFunction getminfunction;
GaborFunction gaborfunction;
Gauss2dFunction gauss2dfunction;
Put_a_a_tFunction put_a_a_tfunction;
Array2IntVectorFunction array2intvectorfunction;
Array2DoubleVectorFunction array2doublevectorfunction;
IntVector2ArrayFunction intvector2arrayfunction;
DoubleVector2ArrayFunction doublevector2arrayfunction;
FiniteQ_dFunction finiteq_dfunction;
public:
SLIArrayModule(){}
void init(SLIInterpreter *);
const std::string commandstring(void) const;
const std::string name(void) const;
};
}
#endif