alglib4 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +47 -0
- data/ext/alglib/alglib.cpp +537 -0
- data/ext/alglib/alglib_array_converters.cpp +86 -0
- data/ext/alglib/alglib_array_converters.h +15 -0
- data/ext/alglib/alglib_utils.cpp +10 -0
- data/ext/alglib/alglib_utils.h +6 -0
- data/ext/alglib/alglibinternal.cpp +21749 -0
- data/ext/alglib/alglibinternal.h +2168 -0
- data/ext/alglib/alglibmisc.cpp +9106 -0
- data/ext/alglib/alglibmisc.h +2114 -0
- data/ext/alglib/ap.cpp +20094 -0
- data/ext/alglib/ap.h +7244 -0
- data/ext/alglib/dataanalysis.cpp +52588 -0
- data/ext/alglib/dataanalysis.h +10601 -0
- data/ext/alglib/diffequations.cpp +1342 -0
- data/ext/alglib/diffequations.h +282 -0
- data/ext/alglib/extconf.rb +5 -0
- data/ext/alglib/fasttransforms.cpp +4696 -0
- data/ext/alglib/fasttransforms.h +1018 -0
- data/ext/alglib/integration.cpp +4249 -0
- data/ext/alglib/integration.h +869 -0
- data/ext/alglib/interpolation.cpp +74502 -0
- data/ext/alglib/interpolation.h +12264 -0
- data/ext/alglib/kernels_avx2.cpp +2171 -0
- data/ext/alglib/kernels_avx2.h +201 -0
- data/ext/alglib/kernels_fma.cpp +1065 -0
- data/ext/alglib/kernels_fma.h +137 -0
- data/ext/alglib/kernels_sse2.cpp +735 -0
- data/ext/alglib/kernels_sse2.h +100 -0
- data/ext/alglib/linalg.cpp +65182 -0
- data/ext/alglib/linalg.h +9927 -0
- data/ext/alglib/optimization.cpp +135331 -0
- data/ext/alglib/optimization.h +19235 -0
- data/ext/alglib/solvers.cpp +20488 -0
- data/ext/alglib/solvers.h +4781 -0
- data/ext/alglib/specialfunctions.cpp +10672 -0
- data/ext/alglib/specialfunctions.h +2305 -0
- data/ext/alglib/statistics.cpp +19791 -0
- data/ext/alglib/statistics.h +1359 -0
- data/ext/alglib/stdafx.h +2 -0
- data/gpl2.txt +339 -0
- data/gpl3.txt +674 -0
- data/lib/alglib/version.rb +3 -0
- data/lib/alglib.rb +4 -0
- metadata +101 -0
@@ -0,0 +1,2114 @@
|
|
1
|
+
/*************************************************************************
|
2
|
+
ALGLIB 4.04.0 (source code generated 2024-12-21)
|
3
|
+
Copyright (c) Sergey Bochkanov (ALGLIB project).
|
4
|
+
|
5
|
+
>>> SOURCE LICENSE >>>
|
6
|
+
This program is free software; you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU General Public License as published by
|
8
|
+
the Free Software Foundation (www.fsf.org); either version 2 of the
|
9
|
+
License, or (at your option) any later version.
|
10
|
+
|
11
|
+
This program is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU General Public License for more details.
|
15
|
+
|
16
|
+
A copy of the GNU General Public License is available at
|
17
|
+
http://www.fsf.org/licensing/licenses
|
18
|
+
>>> END OF LICENSE >>>
|
19
|
+
*************************************************************************/
|
20
|
+
#ifndef _alglibmisc_pkg_h
|
21
|
+
#define _alglibmisc_pkg_h
|
22
|
+
#include "ap.h"
|
23
|
+
#include "alglibinternal.h"
|
24
|
+
|
25
|
+
/////////////////////////////////////////////////////////////////////////
|
26
|
+
//
|
27
|
+
// THIS SECTION CONTAINS COMPUTATIONAL CORE DECLARATIONS (DATATYPES)
|
28
|
+
//
|
29
|
+
/////////////////////////////////////////////////////////////////////////
|
30
|
+
namespace alglib_impl
|
31
|
+
{
|
32
|
+
#if defined(AE_COMPILE_XDEBUG) || !defined(AE_PARTIAL_BUILD)
|
33
|
+
typedef struct
|
34
|
+
{
|
35
|
+
ae_int_t i;
|
36
|
+
ae_complex c;
|
37
|
+
ae_vector a;
|
38
|
+
} xdebugrecord1;
|
39
|
+
#endif
|
40
|
+
#if defined(AE_COMPILE_HQRND) || !defined(AE_PARTIAL_BUILD)
|
41
|
+
typedef struct
|
42
|
+
{
|
43
|
+
ae_int_t s1;
|
44
|
+
ae_int_t s2;
|
45
|
+
ae_int_t magicv;
|
46
|
+
} hqrndstate;
|
47
|
+
#endif
|
48
|
+
#if defined(AE_COMPILE_NEARESTNEIGHBOR) || !defined(AE_PARTIAL_BUILD)
|
49
|
+
typedef struct
|
50
|
+
{
|
51
|
+
ae_vector x;
|
52
|
+
ae_vector boxmin;
|
53
|
+
ae_vector boxmax;
|
54
|
+
ae_int_t kneeded;
|
55
|
+
double rneeded;
|
56
|
+
ae_bool selfmatch;
|
57
|
+
double approxf;
|
58
|
+
ae_int_t kcur;
|
59
|
+
ae_vector idx;
|
60
|
+
ae_vector r;
|
61
|
+
ae_vector buf;
|
62
|
+
ae_vector curboxmin;
|
63
|
+
ae_vector curboxmax;
|
64
|
+
double curdist;
|
65
|
+
ae_vector xqc;
|
66
|
+
} kdtreerequestbuffer;
|
67
|
+
typedef struct
|
68
|
+
{
|
69
|
+
ae_int_t n;
|
70
|
+
ae_int_t nx;
|
71
|
+
ae_int_t ny;
|
72
|
+
ae_int_t normtype;
|
73
|
+
ae_matrix xy;
|
74
|
+
ae_vector tags;
|
75
|
+
ae_vector boxmin;
|
76
|
+
ae_vector boxmax;
|
77
|
+
ae_vector nodes;
|
78
|
+
ae_vector splits;
|
79
|
+
kdtreerequestbuffer innerbuf;
|
80
|
+
ae_int_t debugcounter;
|
81
|
+
} kdtree;
|
82
|
+
#endif
|
83
|
+
|
84
|
+
}
|
85
|
+
|
86
|
+
/////////////////////////////////////////////////////////////////////////
|
87
|
+
//
|
88
|
+
// THIS SECTION CONTAINS C++ INTERFACE
|
89
|
+
//
|
90
|
+
/////////////////////////////////////////////////////////////////////////
|
91
|
+
namespace alglib
|
92
|
+
{
|
93
|
+
|
94
|
+
#if defined(AE_COMPILE_XDEBUG) || !defined(AE_PARTIAL_BUILD)
|
95
|
+
/*************************************************************************
|
96
|
+
This is a debug class intended for testing ALGLIB interface generator.
|
97
|
+
Never use it in any real life project.
|
98
|
+
|
99
|
+
-- ALGLIB --
|
100
|
+
Copyright 20.07.2021 by Bochkanov Sergey
|
101
|
+
*************************************************************************/
|
102
|
+
class _xdebugrecord1_owner
|
103
|
+
{
|
104
|
+
public:
|
105
|
+
_xdebugrecord1_owner();
|
106
|
+
_xdebugrecord1_owner(alglib_impl::xdebugrecord1 *attach_to);
|
107
|
+
_xdebugrecord1_owner(const _xdebugrecord1_owner &rhs);
|
108
|
+
_xdebugrecord1_owner& operator=(const _xdebugrecord1_owner &rhs);
|
109
|
+
virtual ~_xdebugrecord1_owner();
|
110
|
+
alglib_impl::xdebugrecord1* c_ptr();
|
111
|
+
const alglib_impl::xdebugrecord1* c_ptr() const;
|
112
|
+
protected:
|
113
|
+
alglib_impl::xdebugrecord1 *p_struct;
|
114
|
+
bool is_attached;
|
115
|
+
};
|
116
|
+
class xdebugrecord1 : public _xdebugrecord1_owner
|
117
|
+
{
|
118
|
+
public:
|
119
|
+
xdebugrecord1();
|
120
|
+
xdebugrecord1(alglib_impl::xdebugrecord1 *attach_to);
|
121
|
+
xdebugrecord1(const xdebugrecord1 &rhs);
|
122
|
+
xdebugrecord1& operator=(const xdebugrecord1 &rhs);
|
123
|
+
virtual ~xdebugrecord1();
|
124
|
+
ae_int_t &i;
|
125
|
+
alglib::complex &c;
|
126
|
+
real_1d_array a;
|
127
|
+
|
128
|
+
};
|
129
|
+
#endif
|
130
|
+
|
131
|
+
#if defined(AE_COMPILE_HQRND) || !defined(AE_PARTIAL_BUILD)
|
132
|
+
/*************************************************************************
|
133
|
+
Portable high quality random number generator state.
|
134
|
+
Initialized with HQRNDRandomize() or HQRNDSeed().
|
135
|
+
|
136
|
+
Fields:
|
137
|
+
S1, S2 - seed values
|
138
|
+
V - precomputed value
|
139
|
+
MagicV - 'magic' value used to determine whether State structure
|
140
|
+
was correctly initialized.
|
141
|
+
*************************************************************************/
|
142
|
+
class _hqrndstate_owner
|
143
|
+
{
|
144
|
+
public:
|
145
|
+
_hqrndstate_owner();
|
146
|
+
_hqrndstate_owner(alglib_impl::hqrndstate *attach_to);
|
147
|
+
_hqrndstate_owner(const _hqrndstate_owner &rhs);
|
148
|
+
_hqrndstate_owner& operator=(const _hqrndstate_owner &rhs);
|
149
|
+
virtual ~_hqrndstate_owner();
|
150
|
+
alglib_impl::hqrndstate* c_ptr();
|
151
|
+
const alglib_impl::hqrndstate* c_ptr() const;
|
152
|
+
protected:
|
153
|
+
alglib_impl::hqrndstate *p_struct;
|
154
|
+
bool is_attached;
|
155
|
+
};
|
156
|
+
class hqrndstate : public _hqrndstate_owner
|
157
|
+
{
|
158
|
+
public:
|
159
|
+
hqrndstate();
|
160
|
+
hqrndstate(alglib_impl::hqrndstate *attach_to);
|
161
|
+
hqrndstate(const hqrndstate &rhs);
|
162
|
+
hqrndstate& operator=(const hqrndstate &rhs);
|
163
|
+
virtual ~hqrndstate();
|
164
|
+
|
165
|
+
};
|
166
|
+
#endif
|
167
|
+
|
168
|
+
#if defined(AE_COMPILE_NEARESTNEIGHBOR) || !defined(AE_PARTIAL_BUILD)
|
169
|
+
/*************************************************************************
|
170
|
+
Buffer object which is used to perform nearest neighbor requests in the
|
171
|
+
multithreaded mode (multiple threads working with same KD-tree object).
|
172
|
+
|
173
|
+
This object should be created with KDTreeCreateRequestBuffer().
|
174
|
+
*************************************************************************/
|
175
|
+
class _kdtreerequestbuffer_owner
|
176
|
+
{
|
177
|
+
public:
|
178
|
+
_kdtreerequestbuffer_owner();
|
179
|
+
_kdtreerequestbuffer_owner(alglib_impl::kdtreerequestbuffer *attach_to);
|
180
|
+
_kdtreerequestbuffer_owner(const _kdtreerequestbuffer_owner &rhs);
|
181
|
+
_kdtreerequestbuffer_owner& operator=(const _kdtreerequestbuffer_owner &rhs);
|
182
|
+
virtual ~_kdtreerequestbuffer_owner();
|
183
|
+
alglib_impl::kdtreerequestbuffer* c_ptr();
|
184
|
+
const alglib_impl::kdtreerequestbuffer* c_ptr() const;
|
185
|
+
protected:
|
186
|
+
alglib_impl::kdtreerequestbuffer *p_struct;
|
187
|
+
bool is_attached;
|
188
|
+
};
|
189
|
+
class kdtreerequestbuffer : public _kdtreerequestbuffer_owner
|
190
|
+
{
|
191
|
+
public:
|
192
|
+
kdtreerequestbuffer();
|
193
|
+
kdtreerequestbuffer(alglib_impl::kdtreerequestbuffer *attach_to);
|
194
|
+
kdtreerequestbuffer(const kdtreerequestbuffer &rhs);
|
195
|
+
kdtreerequestbuffer& operator=(const kdtreerequestbuffer &rhs);
|
196
|
+
virtual ~kdtreerequestbuffer();
|
197
|
+
|
198
|
+
};
|
199
|
+
|
200
|
+
|
201
|
+
/*************************************************************************
|
202
|
+
KD-tree object.
|
203
|
+
*************************************************************************/
|
204
|
+
class _kdtree_owner
|
205
|
+
{
|
206
|
+
public:
|
207
|
+
_kdtree_owner();
|
208
|
+
_kdtree_owner(alglib_impl::kdtree *attach_to);
|
209
|
+
_kdtree_owner(const _kdtree_owner &rhs);
|
210
|
+
_kdtree_owner& operator=(const _kdtree_owner &rhs);
|
211
|
+
virtual ~_kdtree_owner();
|
212
|
+
alglib_impl::kdtree* c_ptr();
|
213
|
+
const alglib_impl::kdtree* c_ptr() const;
|
214
|
+
protected:
|
215
|
+
alglib_impl::kdtree *p_struct;
|
216
|
+
bool is_attached;
|
217
|
+
};
|
218
|
+
class kdtree : public _kdtree_owner
|
219
|
+
{
|
220
|
+
public:
|
221
|
+
kdtree();
|
222
|
+
kdtree(alglib_impl::kdtree *attach_to);
|
223
|
+
kdtree(const kdtree &rhs);
|
224
|
+
kdtree& operator=(const kdtree &rhs);
|
225
|
+
virtual ~kdtree();
|
226
|
+
|
227
|
+
};
|
228
|
+
#endif
|
229
|
+
|
230
|
+
#if defined(AE_COMPILE_XDEBUG) || !defined(AE_PARTIAL_BUILD)
|
231
|
+
/*************************************************************************
|
232
|
+
This is debug function intended for testing ALGLIB interface generator.
|
233
|
+
Never use it in any real life project.
|
234
|
+
|
235
|
+
Creates and returns XDebugRecord1 structure:
|
236
|
+
* integer and complex fields of Rec1 are set to 1 and 1+i correspondingly
|
237
|
+
* array field of Rec1 is set to [2,3]
|
238
|
+
|
239
|
+
-- ALGLIB --
|
240
|
+
Copyright 27.05.2014 by Bochkanov Sergey
|
241
|
+
*************************************************************************/
|
242
|
+
void xdebuginitrecord1(xdebugrecord1 &rec1, const xparams _xparams = alglib::xdefault);
|
243
|
+
|
244
|
+
|
245
|
+
/*************************************************************************
|
246
|
+
This is debug function intended for testing ALGLIB interface generator.
|
247
|
+
Never use it in any real life project.
|
248
|
+
|
249
|
+
Creates and returns XDebugRecord1 structure:
|
250
|
+
* integer and complex fields of Rec1 are set to 1 and 1+i correspondingly
|
251
|
+
* array field of Rec1 is set to [2,3]
|
252
|
+
|
253
|
+
-- ALGLIB --
|
254
|
+
Copyright 27.05.2014 by Bochkanov Sergey
|
255
|
+
*************************************************************************/
|
256
|
+
void xdebugupdaterecord1(xdebugrecord1 &rec1, const xparams _xparams = alglib::xdefault);
|
257
|
+
|
258
|
+
|
259
|
+
/*************************************************************************
|
260
|
+
This is debug function intended for testing ALGLIB interface generator.
|
261
|
+
Never use it in any real life project.
|
262
|
+
|
263
|
+
Counts number of True values in the boolean 1D array.
|
264
|
+
|
265
|
+
-- ALGLIB --
|
266
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
267
|
+
*************************************************************************/
|
268
|
+
ae_int_t xdebugb1count(const boolean_1d_array &a, const xparams _xparams = alglib::xdefault);
|
269
|
+
|
270
|
+
|
271
|
+
/*************************************************************************
|
272
|
+
This is debug function intended for testing ALGLIB interface generator.
|
273
|
+
Never use it in any real life project.
|
274
|
+
|
275
|
+
Replace all values in array by NOT(a[i]).
|
276
|
+
Array is passed using "shared" convention.
|
277
|
+
|
278
|
+
-- ALGLIB --
|
279
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
280
|
+
*************************************************************************/
|
281
|
+
void xdebugb1not(boolean_1d_array &a, const xparams _xparams = alglib::xdefault);
|
282
|
+
|
283
|
+
|
284
|
+
/*************************************************************************
|
285
|
+
This is debug function intended for testing ALGLIB interface generator.
|
286
|
+
Never use it in any real life project.
|
287
|
+
|
288
|
+
Appends copy of array to itself.
|
289
|
+
Array is passed using "var" convention.
|
290
|
+
|
291
|
+
-- ALGLIB --
|
292
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
293
|
+
*************************************************************************/
|
294
|
+
void xdebugb1appendcopy(boolean_1d_array &a, const xparams _xparams = alglib::xdefault);
|
295
|
+
|
296
|
+
|
297
|
+
/*************************************************************************
|
298
|
+
This is debug function intended for testing ALGLIB interface generator.
|
299
|
+
Never use it in any real life project.
|
300
|
+
|
301
|
+
Generate N-element array with even-numbered elements set to True.
|
302
|
+
Array is passed using "out" convention.
|
303
|
+
|
304
|
+
-- ALGLIB --
|
305
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
306
|
+
*************************************************************************/
|
307
|
+
void xdebugb1outeven(const ae_int_t n, boolean_1d_array &a, const xparams _xparams = alglib::xdefault);
|
308
|
+
|
309
|
+
|
310
|
+
/*************************************************************************
|
311
|
+
This is debug function intended for testing ALGLIB interface generator.
|
312
|
+
Never use it in any real life project.
|
313
|
+
|
314
|
+
Returns sum of elements in the array.
|
315
|
+
|
316
|
+
-- ALGLIB --
|
317
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
318
|
+
*************************************************************************/
|
319
|
+
ae_int_t xdebugi1sum(const integer_1d_array &a, const xparams _xparams = alglib::xdefault);
|
320
|
+
|
321
|
+
|
322
|
+
/*************************************************************************
|
323
|
+
This is debug function intended for testing ALGLIB interface generator.
|
324
|
+
Never use it in any real life project.
|
325
|
+
|
326
|
+
Replace all values in array by -A[I]
|
327
|
+
Array is passed using "shared" convention.
|
328
|
+
|
329
|
+
-- ALGLIB --
|
330
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
331
|
+
*************************************************************************/
|
332
|
+
void xdebugi1neg(integer_1d_array &a, const xparams _xparams = alglib::xdefault);
|
333
|
+
|
334
|
+
|
335
|
+
/*************************************************************************
|
336
|
+
This is debug function intended for testing ALGLIB interface generator.
|
337
|
+
Never use it in any real life project.
|
338
|
+
|
339
|
+
Appends copy of array to itself.
|
340
|
+
Array is passed using "var" convention.
|
341
|
+
|
342
|
+
-- ALGLIB --
|
343
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
344
|
+
*************************************************************************/
|
345
|
+
void xdebugi1appendcopy(integer_1d_array &a, const xparams _xparams = alglib::xdefault);
|
346
|
+
|
347
|
+
|
348
|
+
/*************************************************************************
|
349
|
+
This is debug function intended for testing ALGLIB interface generator.
|
350
|
+
Never use it in any real life project.
|
351
|
+
|
352
|
+
Generate N-element array with even-numbered A[I] set to I, and odd-numbered
|
353
|
+
ones set to 0.
|
354
|
+
|
355
|
+
Array is passed using "out" convention.
|
356
|
+
|
357
|
+
-- ALGLIB --
|
358
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
359
|
+
*************************************************************************/
|
360
|
+
void xdebugi1outeven(const ae_int_t n, integer_1d_array &a, const xparams _xparams = alglib::xdefault);
|
361
|
+
|
362
|
+
|
363
|
+
/*************************************************************************
|
364
|
+
This is debug function intended for testing ALGLIB interface generator.
|
365
|
+
Never use it in any real life project.
|
366
|
+
|
367
|
+
Returns sum of elements in the array.
|
368
|
+
|
369
|
+
-- ALGLIB --
|
370
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
371
|
+
*************************************************************************/
|
372
|
+
double xdebugr1sum(const real_1d_array &a, const xparams _xparams = alglib::xdefault);
|
373
|
+
|
374
|
+
|
375
|
+
/*************************************************************************
|
376
|
+
This is debug function intended for testing ALGLIB interface generator.
|
377
|
+
Never use it in any real life project.
|
378
|
+
|
379
|
+
Returns sum of elements in the array.
|
380
|
+
|
381
|
+
Internally it creates a copy of the array.
|
382
|
+
|
383
|
+
-- ALGLIB --
|
384
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
385
|
+
*************************************************************************/
|
386
|
+
double xdebugr1internalcopyandsum(const real_1d_array &a, const xparams _xparams = alglib::xdefault);
|
387
|
+
|
388
|
+
|
389
|
+
/*************************************************************************
|
390
|
+
This is debug function intended for testing ALGLIB interface generator.
|
391
|
+
Never use it in any real life project.
|
392
|
+
|
393
|
+
Replace all values in array by -A[I]
|
394
|
+
Array is passed using "shared" convention.
|
395
|
+
|
396
|
+
-- ALGLIB --
|
397
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
398
|
+
*************************************************************************/
|
399
|
+
void xdebugr1neg(real_1d_array &a, const xparams _xparams = alglib::xdefault);
|
400
|
+
|
401
|
+
|
402
|
+
/*************************************************************************
|
403
|
+
This is debug function intended for testing ALGLIB interface generator.
|
404
|
+
Never use it in any real life project.
|
405
|
+
|
406
|
+
Appends copy of array to itself.
|
407
|
+
Array is passed using "var" convention.
|
408
|
+
|
409
|
+
-- ALGLIB --
|
410
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
411
|
+
*************************************************************************/
|
412
|
+
void xdebugr1appendcopy(real_1d_array &a, const xparams _xparams = alglib::xdefault);
|
413
|
+
|
414
|
+
|
415
|
+
/*************************************************************************
|
416
|
+
This is debug function intended for testing ALGLIB interface generator.
|
417
|
+
Never use it in any real life project.
|
418
|
+
|
419
|
+
Generate N-element array with even-numbered A[I] set to I*0.25,
|
420
|
+
and odd-numbered ones are set to 0.
|
421
|
+
|
422
|
+
Array is passed using "out" convention.
|
423
|
+
|
424
|
+
-- ALGLIB --
|
425
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
426
|
+
*************************************************************************/
|
427
|
+
void xdebugr1outeven(const ae_int_t n, real_1d_array &a, const xparams _xparams = alglib::xdefault);
|
428
|
+
|
429
|
+
|
430
|
+
/*************************************************************************
|
431
|
+
This is debug function intended for testing ALGLIB interface generator.
|
432
|
+
Never use it in any real life project.
|
433
|
+
|
434
|
+
Returns sum of elements in the array.
|
435
|
+
|
436
|
+
-- ALGLIB --
|
437
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
438
|
+
*************************************************************************/
|
439
|
+
alglib::complex xdebugc1sum(const complex_1d_array &a, const xparams _xparams = alglib::xdefault);
|
440
|
+
|
441
|
+
|
442
|
+
/*************************************************************************
|
443
|
+
This is debug function intended for testing ALGLIB interface generator.
|
444
|
+
Never use it in any real life project.
|
445
|
+
|
446
|
+
Replace all values in array by -A[I]
|
447
|
+
Array is passed using "shared" convention.
|
448
|
+
|
449
|
+
-- ALGLIB --
|
450
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
451
|
+
*************************************************************************/
|
452
|
+
void xdebugc1neg(complex_1d_array &a, const xparams _xparams = alglib::xdefault);
|
453
|
+
|
454
|
+
|
455
|
+
/*************************************************************************
|
456
|
+
This is debug function intended for testing ALGLIB interface generator.
|
457
|
+
Never use it in any real life project.
|
458
|
+
|
459
|
+
Appends copy of array to itself.
|
460
|
+
Array is passed using "var" convention.
|
461
|
+
|
462
|
+
-- ALGLIB --
|
463
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
464
|
+
*************************************************************************/
|
465
|
+
void xdebugc1appendcopy(complex_1d_array &a, const xparams _xparams = alglib::xdefault);
|
466
|
+
|
467
|
+
|
468
|
+
/*************************************************************************
|
469
|
+
This is debug function intended for testing ALGLIB interface generator.
|
470
|
+
Never use it in any real life project.
|
471
|
+
|
472
|
+
Generate N-element array with even-numbered A[K] set to (x,y) = (K*0.25, K*0.125)
|
473
|
+
and odd-numbered ones are set to 0.
|
474
|
+
|
475
|
+
Array is passed using "out" convention.
|
476
|
+
|
477
|
+
-- ALGLIB --
|
478
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
479
|
+
*************************************************************************/
|
480
|
+
void xdebugc1outeven(const ae_int_t n, complex_1d_array &a, const xparams _xparams = alglib::xdefault);
|
481
|
+
|
482
|
+
|
483
|
+
/*************************************************************************
|
484
|
+
This is debug function intended for testing ALGLIB interface generator.
|
485
|
+
Never use it in any real life project.
|
486
|
+
|
487
|
+
Counts number of True values in the boolean 2D array.
|
488
|
+
|
489
|
+
-- ALGLIB --
|
490
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
491
|
+
*************************************************************************/
|
492
|
+
ae_int_t xdebugb2count(const boolean_2d_array &a, const xparams _xparams = alglib::xdefault);
|
493
|
+
|
494
|
+
|
495
|
+
/*************************************************************************
|
496
|
+
This is debug function intended for testing ALGLIB interface generator.
|
497
|
+
Never use it in any real life project.
|
498
|
+
|
499
|
+
Replace all values in array by NOT(a[i]).
|
500
|
+
Array is passed using "shared" convention.
|
501
|
+
|
502
|
+
-- ALGLIB --
|
503
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
504
|
+
*************************************************************************/
|
505
|
+
void xdebugb2not(boolean_2d_array &a, const xparams _xparams = alglib::xdefault);
|
506
|
+
|
507
|
+
|
508
|
+
/*************************************************************************
|
509
|
+
This is debug function intended for testing ALGLIB interface generator.
|
510
|
+
Never use it in any real life project.
|
511
|
+
|
512
|
+
Transposes array.
|
513
|
+
Array is passed using "var" convention.
|
514
|
+
|
515
|
+
-- ALGLIB --
|
516
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
517
|
+
*************************************************************************/
|
518
|
+
void xdebugb2transpose(boolean_2d_array &a, const xparams _xparams = alglib::xdefault);
|
519
|
+
|
520
|
+
|
521
|
+
/*************************************************************************
|
522
|
+
This is debug function intended for testing ALGLIB interface generator.
|
523
|
+
Never use it in any real life project.
|
524
|
+
|
525
|
+
Generate MxN matrix with elements set to "Sin(3*I+5*J)>0"
|
526
|
+
Array is passed using "out" convention.
|
527
|
+
|
528
|
+
-- ALGLIB --
|
529
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
530
|
+
*************************************************************************/
|
531
|
+
void xdebugb2outsin(const ae_int_t m, const ae_int_t n, boolean_2d_array &a, const xparams _xparams = alglib::xdefault);
|
532
|
+
|
533
|
+
|
534
|
+
/*************************************************************************
|
535
|
+
This is debug function intended for testing ALGLIB interface generator.
|
536
|
+
Never use it in any real life project.
|
537
|
+
|
538
|
+
Returns sum of elements in the array.
|
539
|
+
|
540
|
+
-- ALGLIB --
|
541
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
542
|
+
*************************************************************************/
|
543
|
+
ae_int_t xdebugi2sum(const integer_2d_array &a, const xparams _xparams = alglib::xdefault);
|
544
|
+
|
545
|
+
|
546
|
+
/*************************************************************************
|
547
|
+
This is debug function intended for testing ALGLIB interface generator.
|
548
|
+
Never use it in any real life project.
|
549
|
+
|
550
|
+
Replace all values in array by -a[i,j]
|
551
|
+
Array is passed using "shared" convention.
|
552
|
+
|
553
|
+
-- ALGLIB --
|
554
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
555
|
+
*************************************************************************/
|
556
|
+
void xdebugi2neg(integer_2d_array &a, const xparams _xparams = alglib::xdefault);
|
557
|
+
|
558
|
+
|
559
|
+
/*************************************************************************
|
560
|
+
This is debug function intended for testing ALGLIB interface generator.
|
561
|
+
Never use it in any real life project.
|
562
|
+
|
563
|
+
Transposes array.
|
564
|
+
Array is passed using "var" convention.
|
565
|
+
|
566
|
+
-- ALGLIB --
|
567
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
568
|
+
*************************************************************************/
|
569
|
+
void xdebugi2transpose(integer_2d_array &a, const xparams _xparams = alglib::xdefault);
|
570
|
+
|
571
|
+
|
572
|
+
/*************************************************************************
|
573
|
+
This is debug function intended for testing ALGLIB interface generator.
|
574
|
+
Never use it in any real life project.
|
575
|
+
|
576
|
+
Generate MxN matrix with elements set to "Sign(Sin(3*I+5*J))"
|
577
|
+
Array is passed using "out" convention.
|
578
|
+
|
579
|
+
-- ALGLIB --
|
580
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
581
|
+
*************************************************************************/
|
582
|
+
void xdebugi2outsin(const ae_int_t m, const ae_int_t n, integer_2d_array &a, const xparams _xparams = alglib::xdefault);
|
583
|
+
|
584
|
+
|
585
|
+
/*************************************************************************
|
586
|
+
This is debug function intended for testing ALGLIB interface generator.
|
587
|
+
Never use it in any real life project.
|
588
|
+
|
589
|
+
Returns sum of elements in the array.
|
590
|
+
|
591
|
+
-- ALGLIB --
|
592
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
593
|
+
*************************************************************************/
|
594
|
+
double xdebugr2sum(const real_2d_array &a, const xparams _xparams = alglib::xdefault);
|
595
|
+
|
596
|
+
|
597
|
+
/*************************************************************************
|
598
|
+
This is debug function intended for testing ALGLIB interface generator.
|
599
|
+
Never use it in any real life project.
|
600
|
+
|
601
|
+
Returns sum of elements in the array.
|
602
|
+
|
603
|
+
Internally it creates a copy of a.
|
604
|
+
|
605
|
+
-- ALGLIB --
|
606
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
607
|
+
*************************************************************************/
|
608
|
+
double xdebugr2internalcopyandsum(const real_2d_array &a, const xparams _xparams = alglib::xdefault);
|
609
|
+
|
610
|
+
|
611
|
+
/*************************************************************************
|
612
|
+
This is debug function intended for testing ALGLIB interface generator.
|
613
|
+
Never use it in any real life project.
|
614
|
+
|
615
|
+
Replace all values in array by -a[i,j]
|
616
|
+
Array is passed using "shared" convention.
|
617
|
+
|
618
|
+
-- ALGLIB --
|
619
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
620
|
+
*************************************************************************/
|
621
|
+
void xdebugr2neg(real_2d_array &a, const xparams _xparams = alglib::xdefault);
|
622
|
+
|
623
|
+
|
624
|
+
/*************************************************************************
|
625
|
+
This is debug function intended for testing ALGLIB interface generator.
|
626
|
+
Never use it in any real life project.
|
627
|
+
|
628
|
+
Transposes array.
|
629
|
+
Array is passed using "var" convention.
|
630
|
+
|
631
|
+
-- ALGLIB --
|
632
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
633
|
+
*************************************************************************/
|
634
|
+
void xdebugr2transpose(real_2d_array &a, const xparams _xparams = alglib::xdefault);
|
635
|
+
|
636
|
+
|
637
|
+
/*************************************************************************
|
638
|
+
This is debug function intended for testing ALGLIB interface generator.
|
639
|
+
Never use it in any real life project.
|
640
|
+
|
641
|
+
Generate MxN matrix with elements set to "Sin(3*I+5*J)"
|
642
|
+
Array is passed using "out" convention.
|
643
|
+
|
644
|
+
-- ALGLIB --
|
645
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
646
|
+
*************************************************************************/
|
647
|
+
void xdebugr2outsin(const ae_int_t m, const ae_int_t n, real_2d_array &a, const xparams _xparams = alglib::xdefault);
|
648
|
+
|
649
|
+
|
650
|
+
/*************************************************************************
|
651
|
+
This is debug function intended for testing ALGLIB interface generator.
|
652
|
+
Never use it in any real life project.
|
653
|
+
|
654
|
+
Returns sum of elements in the array.
|
655
|
+
|
656
|
+
-- ALGLIB --
|
657
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
658
|
+
*************************************************************************/
|
659
|
+
alglib::complex xdebugc2sum(const complex_2d_array &a, const xparams _xparams = alglib::xdefault);
|
660
|
+
|
661
|
+
|
662
|
+
/*************************************************************************
|
663
|
+
This is debug function intended for testing ALGLIB interface generator.
|
664
|
+
Never use it in any real life project.
|
665
|
+
|
666
|
+
Replace all values in array by -a[i,j]
|
667
|
+
Array is passed using "shared" convention.
|
668
|
+
|
669
|
+
-- ALGLIB --
|
670
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
671
|
+
*************************************************************************/
|
672
|
+
void xdebugc2neg(complex_2d_array &a, const xparams _xparams = alglib::xdefault);
|
673
|
+
|
674
|
+
|
675
|
+
/*************************************************************************
|
676
|
+
This is debug function intended for testing ALGLIB interface generator.
|
677
|
+
Never use it in any real life project.
|
678
|
+
|
679
|
+
Transposes array.
|
680
|
+
Array is passed using "var" convention.
|
681
|
+
|
682
|
+
-- ALGLIB --
|
683
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
684
|
+
*************************************************************************/
|
685
|
+
void xdebugc2transpose(complex_2d_array &a, const xparams _xparams = alglib::xdefault);
|
686
|
+
|
687
|
+
|
688
|
+
/*************************************************************************
|
689
|
+
This is debug function intended for testing ALGLIB interface generator.
|
690
|
+
Never use it in any real life project.
|
691
|
+
|
692
|
+
Generate MxN matrix with elements set to "Sin(3*I+5*J),Cos(3*I+5*J)"
|
693
|
+
Array is passed using "out" convention.
|
694
|
+
|
695
|
+
-- ALGLIB --
|
696
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
697
|
+
*************************************************************************/
|
698
|
+
void xdebugc2outsincos(const ae_int_t m, const ae_int_t n, complex_2d_array &a, const xparams _xparams = alglib::xdefault);
|
699
|
+
|
700
|
+
|
701
|
+
/*************************************************************************
|
702
|
+
This is debug function intended for testing ALGLIB interface generator.
|
703
|
+
Never use it in any real life project.
|
704
|
+
|
705
|
+
Returns sum of a[i,j]*(1+b[i,j]) such that c[i,j] is True
|
706
|
+
|
707
|
+
-- ALGLIB --
|
708
|
+
Copyright 11.10.2013 by Bochkanov Sergey
|
709
|
+
*************************************************************************/
|
710
|
+
double xdebugmaskedbiasedproductsum(const ae_int_t m, const ae_int_t n, const real_2d_array &a, const real_2d_array &b, const boolean_2d_array &c, const xparams _xparams = alglib::xdefault);
|
711
|
+
#endif
|
712
|
+
|
713
|
+
#if defined(AE_COMPILE_HQRND) || !defined(AE_PARTIAL_BUILD)
|
714
|
+
/*************************************************************************
|
715
|
+
HQRNDState initialization with random values which come from standard
|
716
|
+
RNG.
|
717
|
+
|
718
|
+
-- ALGLIB --
|
719
|
+
Copyright 02.12.2009 by Bochkanov Sergey
|
720
|
+
*************************************************************************/
|
721
|
+
void hqrndrandomize(hqrndstate &state, const xparams _xparams = alglib::xdefault);
|
722
|
+
|
723
|
+
|
724
|
+
/*************************************************************************
|
725
|
+
HQRNDState initialization with seed values
|
726
|
+
|
727
|
+
-- ALGLIB --
|
728
|
+
Copyright 02.12.2009 by Bochkanov Sergey
|
729
|
+
*************************************************************************/
|
730
|
+
void hqrndseed(const ae_int_t s1, const ae_int_t s2, hqrndstate &state, const xparams _xparams = alglib::xdefault);
|
731
|
+
|
732
|
+
|
733
|
+
/*************************************************************************
|
734
|
+
This function generates random real number in (0,1),
|
735
|
+
not including interval boundaries
|
736
|
+
|
737
|
+
State structure must be initialized with HQRNDRandomize() or HQRNDSeed().
|
738
|
+
|
739
|
+
-- ALGLIB --
|
740
|
+
Copyright 02.12.2009 by Bochkanov Sergey
|
741
|
+
*************************************************************************/
|
742
|
+
double hqrnduniformr(hqrndstate &state, const xparams _xparams = alglib::xdefault);
|
743
|
+
|
744
|
+
|
745
|
+
/*************************************************************************
|
746
|
+
This function generates random integer number in [0, N)
|
747
|
+
|
748
|
+
1. State structure must be initialized with HQRNDRandomize() or HQRNDSeed()
|
749
|
+
2. N can be any positive number except for very large numbers:
|
750
|
+
* close to 2^31 on 32-bit systems
|
751
|
+
* close to 2^62 on 64-bit systems
|
752
|
+
An exception will be generated if N is too large.
|
753
|
+
|
754
|
+
-- ALGLIB --
|
755
|
+
Copyright 02.12.2009 by Bochkanov Sergey
|
756
|
+
*************************************************************************/
|
757
|
+
ae_int_t hqrnduniformi(hqrndstate &state, const ae_int_t n, const xparams _xparams = alglib::xdefault);
|
758
|
+
|
759
|
+
|
760
|
+
/*************************************************************************
|
761
|
+
Random number generator: normal numbers
|
762
|
+
|
763
|
+
This function generates one random number from normal distribution.
|
764
|
+
Its performance is equal to that of HQRNDNormal2()
|
765
|
+
|
766
|
+
State structure must be initialized with HQRNDRandomize() or HQRNDSeed().
|
767
|
+
|
768
|
+
-- ALGLIB --
|
769
|
+
Copyright 02.12.2009 by Bochkanov Sergey
|
770
|
+
*************************************************************************/
|
771
|
+
double hqrndnormal(hqrndstate &state, const xparams _xparams = alglib::xdefault);
|
772
|
+
|
773
|
+
|
774
|
+
/*************************************************************************
|
775
|
+
Random number generator: vector with random entries (normal distribution)
|
776
|
+
|
777
|
+
This function generates N random numbers from normal distribution.
|
778
|
+
|
779
|
+
State structure must be initialized with HQRNDRandomize() or HQRNDSeed().
|
780
|
+
|
781
|
+
-- ALGLIB --
|
782
|
+
Copyright 02.12.2009 by Bochkanov Sergey
|
783
|
+
*************************************************************************/
|
784
|
+
void hqrndnormalv(hqrndstate &state, const ae_int_t n, real_1d_array &x, const xparams _xparams = alglib::xdefault);
|
785
|
+
|
786
|
+
|
787
|
+
/*************************************************************************
|
788
|
+
Random number generator: matrix with random entries (normal distribution)
|
789
|
+
|
790
|
+
This function generates MxN random matrix.
|
791
|
+
|
792
|
+
State structure must be initialized with HQRNDRandomize() or HQRNDSeed().
|
793
|
+
|
794
|
+
-- ALGLIB --
|
795
|
+
Copyright 02.12.2009 by Bochkanov Sergey
|
796
|
+
*************************************************************************/
|
797
|
+
void hqrndnormalm(hqrndstate &state, const ae_int_t m, const ae_int_t n, real_2d_array &x, const xparams _xparams = alglib::xdefault);
|
798
|
+
|
799
|
+
|
800
|
+
/*************************************************************************
|
801
|
+
Random number generator: random X and Y such that X^2+Y^2=1
|
802
|
+
|
803
|
+
State structure must be initialized with HQRNDRandomize() or HQRNDSeed().
|
804
|
+
|
805
|
+
-- ALGLIB --
|
806
|
+
Copyright 02.12.2009 by Bochkanov Sergey
|
807
|
+
*************************************************************************/
|
808
|
+
void hqrndunit2(hqrndstate &state, double &x, double &y, const xparams _xparams = alglib::xdefault);
|
809
|
+
|
810
|
+
|
811
|
+
/*************************************************************************
|
812
|
+
Random number generator: normal numbers
|
813
|
+
|
814
|
+
This function generates two independent random numbers from normal
|
815
|
+
distribution. Its performance is equal to that of HQRNDNormal()
|
816
|
+
|
817
|
+
State structure must be initialized with HQRNDRandomize() or HQRNDSeed().
|
818
|
+
|
819
|
+
-- ALGLIB --
|
820
|
+
Copyright 02.12.2009 by Bochkanov Sergey
|
821
|
+
*************************************************************************/
|
822
|
+
void hqrndnormal2(hqrndstate &state, double &x1, double &x2, const xparams _xparams = alglib::xdefault);
|
823
|
+
|
824
|
+
|
825
|
+
/*************************************************************************
|
826
|
+
Random number generator: exponential distribution
|
827
|
+
|
828
|
+
State structure must be initialized with HQRNDRandomize() or HQRNDSeed().
|
829
|
+
|
830
|
+
-- ALGLIB --
|
831
|
+
Copyright 11.08.2007 by Bochkanov Sergey
|
832
|
+
*************************************************************************/
|
833
|
+
double hqrndexponential(hqrndstate &state, const double lambdav, const xparams _xparams = alglib::xdefault);
|
834
|
+
|
835
|
+
|
836
|
+
/*************************************************************************
|
837
|
+
This function generates random number from discrete distribution given by
|
838
|
+
finite sample X.
|
839
|
+
|
840
|
+
INPUT PARAMETERS
|
841
|
+
State - high quality random number generator, must be
|
842
|
+
initialized with HQRNDRandomize() or HQRNDSeed().
|
843
|
+
X - finite sample
|
844
|
+
N - number of elements to use, N>=1
|
845
|
+
|
846
|
+
RESULT
|
847
|
+
this function returns one of the X[i] for random i=0..N-1
|
848
|
+
|
849
|
+
-- ALGLIB --
|
850
|
+
Copyright 08.11.2011 by Bochkanov Sergey
|
851
|
+
*************************************************************************/
|
852
|
+
double hqrnddiscrete(hqrndstate &state, const real_1d_array &x, const ae_int_t n, const xparams _xparams = alglib::xdefault);
|
853
|
+
|
854
|
+
|
855
|
+
/*************************************************************************
|
856
|
+
This function generates random number from continuous distribution given
|
857
|
+
by finite sample X.
|
858
|
+
|
859
|
+
INPUT PARAMETERS
|
860
|
+
State - high quality random number generator, must be
|
861
|
+
initialized with HQRNDRandomize() or HQRNDSeed().
|
862
|
+
X - finite sample, array[N] (can be larger, in this case only
|
863
|
+
leading N elements are used). THIS ARRAY MUST BE SORTED BY
|
864
|
+
ASCENDING.
|
865
|
+
N - number of elements to use, N>=1
|
866
|
+
|
867
|
+
RESULT
|
868
|
+
this function returns random number from continuous distribution which
|
869
|
+
tries to approximate X as mush as possible. min(X)<=Result<=max(X).
|
870
|
+
|
871
|
+
-- ALGLIB --
|
872
|
+
Copyright 08.11.2011 by Bochkanov Sergey
|
873
|
+
*************************************************************************/
|
874
|
+
double hqrndcontinuous(hqrndstate &state, const real_1d_array &x, const ae_int_t n, const xparams _xparams = alglib::xdefault);
|
875
|
+
#endif
|
876
|
+
|
877
|
+
#if defined(AE_COMPILE_NEARESTNEIGHBOR) || !defined(AE_PARTIAL_BUILD)
|
878
|
+
/*************************************************************************
|
879
|
+
This function serializes data structure to string.
|
880
|
+
|
881
|
+
Important properties of s_out:
|
882
|
+
* it contains alphanumeric characters, dots, underscores, minus signs
|
883
|
+
* these symbols are grouped into words, which are separated by spaces
|
884
|
+
and Windows-style (CR+LF) newlines
|
885
|
+
* although serializer uses spaces and CR+LF as separators, you can
|
886
|
+
replace any separator character by arbitrary combination of spaces,
|
887
|
+
tabs, Windows or Unix newlines. It allows flexible reformatting of
|
888
|
+
the string in case you want to include it into a text or XML file.
|
889
|
+
But you should not insert separators into the middle of the "words"
|
890
|
+
nor should you change the case of letters.
|
891
|
+
* s_out can be freely moved between 32-bit and 64-bit systems, little
|
892
|
+
and big endian machines, and so on. You can serialize structure on
|
893
|
+
32-bit machine and unserialize it on 64-bit one (or vice versa), or
|
894
|
+
serialize it on SPARC and unserialize on x86. You can also
|
895
|
+
serialize it in C++ version of ALGLIB and unserialize it in C# one,
|
896
|
+
and vice versa.
|
897
|
+
*************************************************************************/
|
898
|
+
void kdtreeserialize(const kdtree &obj, std::string &s_out);
|
899
|
+
|
900
|
+
|
901
|
+
/*************************************************************************
|
902
|
+
This function serializes data structure to C++ stream.
|
903
|
+
|
904
|
+
Data stream generated by this function is same as string representation
|
905
|
+
generated by string version of serializer - alphanumeric characters,
|
906
|
+
dots, underscores, minus signs, which are grouped into words separated by
|
907
|
+
spaces and CR+LF.
|
908
|
+
|
909
|
+
We recommend you to read comments on string version of serializer to find
|
910
|
+
out more about serialization of AlGLIB objects.
|
911
|
+
*************************************************************************/
|
912
|
+
void kdtreeserialize(const kdtree &obj, std::ostream &s_out);
|
913
|
+
|
914
|
+
|
915
|
+
/*************************************************************************
|
916
|
+
This function unserializes data structure from string.
|
917
|
+
*************************************************************************/
|
918
|
+
void kdtreeunserialize(const std::string &s_in, kdtree &obj);
|
919
|
+
|
920
|
+
|
921
|
+
/*************************************************************************
|
922
|
+
This function unserializes data structure from stream.
|
923
|
+
*************************************************************************/
|
924
|
+
void kdtreeunserialize(const std::istream &s_in, kdtree &obj);
|
925
|
+
|
926
|
+
|
927
|
+
/*************************************************************************
|
928
|
+
KD-tree creation
|
929
|
+
|
930
|
+
This subroutine creates KD-tree from set of X-values and optional Y-values
|
931
|
+
|
932
|
+
INPUT PARAMETERS
|
933
|
+
XY - dataset, array[0..N-1,0..NX+NY-1].
|
934
|
+
one row corresponds to one point.
|
935
|
+
first NX columns contain X-values, next NY (NY may be zero)
|
936
|
+
columns may contain associated Y-values
|
937
|
+
N - number of points, N>=0.
|
938
|
+
NX - space dimension, NX>=1.
|
939
|
+
NY - number of optional Y-values, NY>=0.
|
940
|
+
NormType- norm type:
|
941
|
+
* 0 denotes infinity-norm
|
942
|
+
* 1 denotes 1-norm
|
943
|
+
* 2 denotes 2-norm (Euclidean norm)
|
944
|
+
|
945
|
+
OUTPUT PARAMETERS
|
946
|
+
KDT - KD-tree
|
947
|
+
|
948
|
+
|
949
|
+
NOTES
|
950
|
+
|
951
|
+
1. KD-tree creation have O(N*logN) complexity and O(N*(2*NX+NY)) memory
|
952
|
+
requirements.
|
953
|
+
2. Although KD-trees may be used with any combination of N and NX, they
|
954
|
+
are more efficient than brute-force search only when N >> 4^NX. So they
|
955
|
+
are most useful in low-dimensional tasks (NX=2, NX=3). NX=1 is another
|
956
|
+
inefficient case, because simple binary search (without additional
|
957
|
+
structures) is much more efficient in such tasks than KD-trees.
|
958
|
+
|
959
|
+
-- ALGLIB --
|
960
|
+
Copyright 28.02.2010 by Bochkanov Sergey
|
961
|
+
*************************************************************************/
|
962
|
+
void kdtreebuild(const real_2d_array &xy, const ae_int_t n, const ae_int_t nx, const ae_int_t ny, const ae_int_t normtype, kdtree &kdt, const xparams _xparams = alglib::xdefault);
|
963
|
+
void kdtreebuild(const real_2d_array &xy, const ae_int_t nx, const ae_int_t ny, const ae_int_t normtype, kdtree &kdt, const xparams _xparams = alglib::xdefault);
|
964
|
+
|
965
|
+
|
966
|
+
/*************************************************************************
|
967
|
+
KD-tree creation
|
968
|
+
|
969
|
+
This subroutine creates KD-tree from set of X-values, integer tags and
|
970
|
+
optional Y-values
|
971
|
+
|
972
|
+
INPUT PARAMETERS
|
973
|
+
XY - dataset, array[0..N-1,0..NX+NY-1].
|
974
|
+
one row corresponds to one point.
|
975
|
+
first NX columns contain X-values, next NY (NY may be zero)
|
976
|
+
columns may contain associated Y-values
|
977
|
+
Tags - tags, array[0..N-1], contains integer tags associated
|
978
|
+
with points.
|
979
|
+
N - number of points, N>=0
|
980
|
+
NX - space dimension, NX>=1.
|
981
|
+
NY - number of optional Y-values, NY>=0.
|
982
|
+
NormType- norm type:
|
983
|
+
* 0 denotes infinity-norm
|
984
|
+
* 1 denotes 1-norm
|
985
|
+
* 2 denotes 2-norm (Euclidean norm)
|
986
|
+
|
987
|
+
OUTPUT PARAMETERS
|
988
|
+
KDT - KD-tree
|
989
|
+
|
990
|
+
NOTES
|
991
|
+
|
992
|
+
1. KD-tree creation have O(N*logN) complexity and O(N*(2*NX+NY)) memory
|
993
|
+
requirements.
|
994
|
+
2. Although KD-trees may be used with any combination of N and NX, they
|
995
|
+
are more efficient than brute-force search only when N >> 4^NX. So they
|
996
|
+
are most useful in low-dimensional tasks (NX=2, NX=3). NX=1 is another
|
997
|
+
inefficient case, because simple binary search (without additional
|
998
|
+
structures) is much more efficient in such tasks than KD-trees.
|
999
|
+
|
1000
|
+
-- ALGLIB --
|
1001
|
+
Copyright 28.02.2010 by Bochkanov Sergey
|
1002
|
+
*************************************************************************/
|
1003
|
+
void kdtreebuildtagged(const real_2d_array &xy, const integer_1d_array &tags, const ae_int_t n, const ae_int_t nx, const ae_int_t ny, const ae_int_t normtype, kdtree &kdt, const xparams _xparams = alglib::xdefault);
|
1004
|
+
void kdtreebuildtagged(const real_2d_array &xy, const integer_1d_array &tags, const ae_int_t nx, const ae_int_t ny, const ae_int_t normtype, kdtree &kdt, const xparams _xparams = alglib::xdefault);
|
1005
|
+
|
1006
|
+
|
1007
|
+
/*************************************************************************
|
1008
|
+
This function creates buffer structure which can be used to perform
|
1009
|
+
parallel KD-tree requests.
|
1010
|
+
|
1011
|
+
KD-tree subpackage provides two sets of request functions - ones which use
|
1012
|
+
internal buffer of KD-tree object (these functions are single-threaded
|
1013
|
+
because they use same buffer, which can not shared between threads), and
|
1014
|
+
ones which use external buffer.
|
1015
|
+
|
1016
|
+
This function is used to initialize external buffer.
|
1017
|
+
|
1018
|
+
INPUT PARAMETERS
|
1019
|
+
KDT - KD-tree which is associated with newly created buffer
|
1020
|
+
|
1021
|
+
OUTPUT PARAMETERS
|
1022
|
+
Buf - external buffer.
|
1023
|
+
|
1024
|
+
|
1025
|
+
IMPORTANT: KD-tree buffer should be used only with KD-tree object which
|
1026
|
+
was used to initialize buffer. Any attempt to use buffer with
|
1027
|
+
different object is dangerous - you may get integrity check
|
1028
|
+
failure (exception) because sizes of internal arrays do not fit
|
1029
|
+
to dimensions of KD-tree structure.
|
1030
|
+
|
1031
|
+
-- ALGLIB --
|
1032
|
+
Copyright 18.03.2016 by Bochkanov Sergey
|
1033
|
+
*************************************************************************/
|
1034
|
+
void kdtreecreaterequestbuffer(const kdtree &kdt, kdtreerequestbuffer &buf, const xparams _xparams = alglib::xdefault);
|
1035
|
+
|
1036
|
+
|
1037
|
+
/*************************************************************************
|
1038
|
+
K-NN query: K nearest neighbors
|
1039
|
+
|
1040
|
+
IMPORTANT: this function can not be used in multithreaded code because it
|
1041
|
+
uses internal temporary buffer of kd-tree object, which can not
|
1042
|
+
be shared between multiple threads. If you want to perform
|
1043
|
+
parallel requests, use function which uses external request
|
1044
|
+
buffer: KDTreeTsQueryKNN() ("Ts" stands for "thread-safe").
|
1045
|
+
|
1046
|
+
INPUT PARAMETERS
|
1047
|
+
KDT - KD-tree
|
1048
|
+
X - point, array[0..NX-1].
|
1049
|
+
K - number of neighbors to return, K>=1
|
1050
|
+
SelfMatch - whether self-matches are allowed:
|
1051
|
+
* if True, nearest neighbor may be the point itself
|
1052
|
+
(if it exists in original dataset)
|
1053
|
+
* if False, then only points with non-zero distance
|
1054
|
+
are returned
|
1055
|
+
* if not given, considered True
|
1056
|
+
|
1057
|
+
RESULT
|
1058
|
+
number of actual neighbors found (either K or N, if K>N).
|
1059
|
+
|
1060
|
+
This subroutine performs query and stores its result in the internal
|
1061
|
+
structures of the KD-tree. You can use following subroutines to obtain
|
1062
|
+
these results:
|
1063
|
+
* KDTreeQueryResultsX() to get X-values
|
1064
|
+
* KDTreeQueryResultsXY() to get X- and Y-values
|
1065
|
+
* KDTreeQueryResultsTags() to get tag values
|
1066
|
+
* KDTreeQueryResultsDistances() to get distances
|
1067
|
+
|
1068
|
+
-- ALGLIB --
|
1069
|
+
Copyright 28.02.2010 by Bochkanov Sergey
|
1070
|
+
*************************************************************************/
|
1071
|
+
ae_int_t kdtreequeryknn(kdtree &kdt, const real_1d_array &x, const ae_int_t k, const bool selfmatch, const xparams _xparams = alglib::xdefault);
|
1072
|
+
ae_int_t kdtreequeryknn(kdtree &kdt, const real_1d_array &x, const ae_int_t k, const xparams _xparams = alglib::xdefault);
|
1073
|
+
|
1074
|
+
|
1075
|
+
/*************************************************************************
|
1076
|
+
K-NN query: K nearest neighbors, using external thread-local buffer.
|
1077
|
+
|
1078
|
+
You can call this function from multiple threads for same kd-tree instance,
|
1079
|
+
assuming that different instances of buffer object are passed to different
|
1080
|
+
threads.
|
1081
|
+
|
1082
|
+
INPUT PARAMETERS
|
1083
|
+
KDT - kd-tree
|
1084
|
+
Buf - request buffer object created for this particular
|
1085
|
+
instance of kd-tree structure with kdtreecreaterequestbuffer()
|
1086
|
+
function.
|
1087
|
+
X - point, array[0..NX-1].
|
1088
|
+
K - number of neighbors to return, K>=1
|
1089
|
+
SelfMatch - whether self-matches are allowed:
|
1090
|
+
* if True, nearest neighbor may be the point itself
|
1091
|
+
(if it exists in original dataset)
|
1092
|
+
* if False, then only points with non-zero distance
|
1093
|
+
are returned
|
1094
|
+
* if not given, considered True
|
1095
|
+
|
1096
|
+
RESULT
|
1097
|
+
number of actual neighbors found (either K or N, if K>N).
|
1098
|
+
|
1099
|
+
This subroutine performs query and stores its result in the internal
|
1100
|
+
structures of the buffer object. You can use following subroutines to
|
1101
|
+
obtain these results (pay attention to "buf" in their names):
|
1102
|
+
* KDTreeTsQueryResultsX() to get X-values
|
1103
|
+
* KDTreeTsQueryResultsXY() to get X- and Y-values
|
1104
|
+
* KDTreeTsQueryResultsTags() to get tag values
|
1105
|
+
* KDTreeTsQueryResultsDistances() to get distances
|
1106
|
+
|
1107
|
+
IMPORTANT: kd-tree buffer should be used only with KD-tree object which
|
1108
|
+
was used to initialize buffer. Any attempt to use biffer with
|
1109
|
+
different object is dangerous - you may get integrity check
|
1110
|
+
failure (exception) because sizes of internal arrays do not fit
|
1111
|
+
to dimensions of KD-tree structure.
|
1112
|
+
|
1113
|
+
-- ALGLIB --
|
1114
|
+
Copyright 18.03.2016 by Bochkanov Sergey
|
1115
|
+
*************************************************************************/
|
1116
|
+
ae_int_t kdtreetsqueryknn(const kdtree &kdt, kdtreerequestbuffer &buf, const real_1d_array &x, const ae_int_t k, const bool selfmatch, const xparams _xparams = alglib::xdefault);
|
1117
|
+
ae_int_t kdtreetsqueryknn(const kdtree &kdt, kdtreerequestbuffer &buf, const real_1d_array &x, const ae_int_t k, const xparams _xparams = alglib::xdefault);
|
1118
|
+
|
1119
|
+
|
1120
|
+
/*************************************************************************
|
1121
|
+
R-NN query: all points within R-sphere centered at X, ordered by distance
|
1122
|
+
between point and X (by ascending).
|
1123
|
+
|
1124
|
+
NOTE: it is also possible to perform undordered queries performed by means
|
1125
|
+
of kdtreequeryrnnu() and kdtreetsqueryrnnu() functions. Such queries
|
1126
|
+
are faster because we do not have to use heap structure for sorting.
|
1127
|
+
|
1128
|
+
IMPORTANT: this function can not be used in multithreaded code because it
|
1129
|
+
uses internal temporary buffer of kd-tree object, which can not
|
1130
|
+
be shared between multiple threads. If you want to perform
|
1131
|
+
parallel requests, use function which uses external request
|
1132
|
+
buffer: kdtreetsqueryrnn() ("Ts" stands for "thread-safe").
|
1133
|
+
|
1134
|
+
INPUT PARAMETERS
|
1135
|
+
KDT - KD-tree
|
1136
|
+
X - point, array[0..NX-1].
|
1137
|
+
R - radius of sphere (in corresponding norm), R>0
|
1138
|
+
SelfMatch - whether self-matches are allowed:
|
1139
|
+
* if True, nearest neighbor may be the point itself
|
1140
|
+
(if it exists in original dataset)
|
1141
|
+
* if False, then only points with non-zero distance
|
1142
|
+
are returned
|
1143
|
+
* if not given, considered True
|
1144
|
+
|
1145
|
+
RESULT
|
1146
|
+
number of neighbors found, >=0
|
1147
|
+
|
1148
|
+
This subroutine performs query and stores its result in the internal
|
1149
|
+
structures of the KD-tree. You can use following subroutines to obtain
|
1150
|
+
actual results:
|
1151
|
+
* KDTreeQueryResultsX() to get X-values
|
1152
|
+
* KDTreeQueryResultsXY() to get X- and Y-values
|
1153
|
+
* KDTreeQueryResultsTags() to get tag values
|
1154
|
+
* KDTreeQueryResultsDistances() to get distances
|
1155
|
+
|
1156
|
+
-- ALGLIB --
|
1157
|
+
Copyright 28.02.2010 by Bochkanov Sergey
|
1158
|
+
*************************************************************************/
|
1159
|
+
ae_int_t kdtreequeryrnn(kdtree &kdt, const real_1d_array &x, const double r, const bool selfmatch, const xparams _xparams = alglib::xdefault);
|
1160
|
+
ae_int_t kdtreequeryrnn(kdtree &kdt, const real_1d_array &x, const double r, const xparams _xparams = alglib::xdefault);
|
1161
|
+
|
1162
|
+
|
1163
|
+
/*************************************************************************
|
1164
|
+
R-NN query: all points within R-sphere centered at X, no ordering by
|
1165
|
+
distance as undicated by "U" suffix (faster that ordered query, for large
|
1166
|
+
queries - significantly faster).
|
1167
|
+
|
1168
|
+
IMPORTANT: this function can not be used in multithreaded code because it
|
1169
|
+
uses internal temporary buffer of kd-tree object, which can not
|
1170
|
+
be shared between multiple threads. If you want to perform
|
1171
|
+
parallel requests, use function which uses external request
|
1172
|
+
buffer: kdtreetsqueryrnn() ("Ts" stands for "thread-safe").
|
1173
|
+
|
1174
|
+
INPUT PARAMETERS
|
1175
|
+
KDT - KD-tree
|
1176
|
+
X - point, array[0..NX-1].
|
1177
|
+
R - radius of sphere (in corresponding norm), R>0
|
1178
|
+
SelfMatch - whether self-matches are allowed:
|
1179
|
+
* if True, nearest neighbor may be the point itself
|
1180
|
+
(if it exists in original dataset)
|
1181
|
+
* if False, then only points with non-zero distance
|
1182
|
+
are returned
|
1183
|
+
* if not given, considered True
|
1184
|
+
|
1185
|
+
RESULT
|
1186
|
+
number of neighbors found, >=0
|
1187
|
+
|
1188
|
+
This subroutine performs query and stores its result in the internal
|
1189
|
+
structures of the KD-tree. You can use following subroutines to obtain
|
1190
|
+
actual results:
|
1191
|
+
* KDTreeQueryResultsX() to get X-values
|
1192
|
+
* KDTreeQueryResultsXY() to get X- and Y-values
|
1193
|
+
* KDTreeQueryResultsTags() to get tag values
|
1194
|
+
* KDTreeQueryResultsDistances() to get distances
|
1195
|
+
|
1196
|
+
As indicated by "U" suffix, this function returns unordered results.
|
1197
|
+
|
1198
|
+
-- ALGLIB --
|
1199
|
+
Copyright 01.11.2018 by Bochkanov Sergey
|
1200
|
+
*************************************************************************/
|
1201
|
+
ae_int_t kdtreequeryrnnu(kdtree &kdt, const real_1d_array &x, const double r, const bool selfmatch, const xparams _xparams = alglib::xdefault);
|
1202
|
+
ae_int_t kdtreequeryrnnu(kdtree &kdt, const real_1d_array &x, const double r, const xparams _xparams = alglib::xdefault);
|
1203
|
+
|
1204
|
+
|
1205
|
+
/*************************************************************************
|
1206
|
+
R-NN query: all points within R-sphere centered at X, using external
|
1207
|
+
thread-local buffer, sorted by distance between point and X (by ascending)
|
1208
|
+
|
1209
|
+
You can call this function from multiple threads for same kd-tree instance,
|
1210
|
+
assuming that different instances of buffer object are passed to different
|
1211
|
+
threads.
|
1212
|
+
|
1213
|
+
NOTE: it is also possible to perform undordered queries performed by means
|
1214
|
+
of kdtreequeryrnnu() and kdtreetsqueryrnnu() functions. Such queries
|
1215
|
+
are faster because we do not have to use heap structure for sorting.
|
1216
|
+
|
1217
|
+
INPUT PARAMETERS
|
1218
|
+
KDT - KD-tree
|
1219
|
+
Buf - request buffer object created for this particular
|
1220
|
+
instance of kd-tree structure with kdtreecreaterequestbuffer()
|
1221
|
+
function.
|
1222
|
+
X - point, array[0..NX-1].
|
1223
|
+
R - radius of sphere (in corresponding norm), R>0
|
1224
|
+
SelfMatch - whether self-matches are allowed:
|
1225
|
+
* if True, nearest neighbor may be the point itself
|
1226
|
+
(if it exists in original dataset)
|
1227
|
+
* if False, then only points with non-zero distance
|
1228
|
+
are returned
|
1229
|
+
* if not given, considered True
|
1230
|
+
|
1231
|
+
RESULT
|
1232
|
+
number of neighbors found, >=0
|
1233
|
+
|
1234
|
+
This subroutine performs query and stores its result in the internal
|
1235
|
+
structures of the buffer object. You can use following subroutines to
|
1236
|
+
obtain these results (pay attention to "buf" in their names):
|
1237
|
+
* KDTreeTsQueryResultsX() to get X-values
|
1238
|
+
* KDTreeTsQueryResultsXY() to get X- and Y-values
|
1239
|
+
* KDTreeTsQueryResultsTags() to get tag values
|
1240
|
+
* KDTreeTsQueryResultsDistances() to get distances
|
1241
|
+
|
1242
|
+
IMPORTANT: kd-tree buffer should be used only with KD-tree object which
|
1243
|
+
was used to initialize buffer. Any attempt to use biffer with
|
1244
|
+
different object is dangerous - you may get integrity check
|
1245
|
+
failure (exception) because sizes of internal arrays do not fit
|
1246
|
+
to dimensions of KD-tree structure.
|
1247
|
+
|
1248
|
+
-- ALGLIB --
|
1249
|
+
Copyright 18.03.2016 by Bochkanov Sergey
|
1250
|
+
*************************************************************************/
|
1251
|
+
ae_int_t kdtreetsqueryrnn(const kdtree &kdt, kdtreerequestbuffer &buf, const real_1d_array &x, const double r, const bool selfmatch, const xparams _xparams = alglib::xdefault);
|
1252
|
+
ae_int_t kdtreetsqueryrnn(const kdtree &kdt, kdtreerequestbuffer &buf, const real_1d_array &x, const double r, const xparams _xparams = alglib::xdefault);
|
1253
|
+
|
1254
|
+
|
1255
|
+
/*************************************************************************
|
1256
|
+
R-NN query: all points within R-sphere centered at X, using external
|
1257
|
+
thread-local buffer, no ordering by distance as undicated by "U" suffix
|
1258
|
+
(faster that ordered query, for large queries - significantly faster).
|
1259
|
+
|
1260
|
+
You can call this function from multiple threads for same kd-tree instance,
|
1261
|
+
assuming that different instances of buffer object are passed to different
|
1262
|
+
threads.
|
1263
|
+
|
1264
|
+
INPUT PARAMETERS
|
1265
|
+
KDT - KD-tree
|
1266
|
+
Buf - request buffer object created for this particular
|
1267
|
+
instance of kd-tree structure with kdtreecreaterequestbuffer()
|
1268
|
+
function.
|
1269
|
+
X - point, array[0..NX-1].
|
1270
|
+
R - radius of sphere (in corresponding norm), R>0
|
1271
|
+
SelfMatch - whether self-matches are allowed:
|
1272
|
+
* if True, nearest neighbor may be the point itself
|
1273
|
+
(if it exists in original dataset)
|
1274
|
+
* if False, then only points with non-zero distance
|
1275
|
+
are returned
|
1276
|
+
* if not given, considered True
|
1277
|
+
|
1278
|
+
RESULT
|
1279
|
+
number of neighbors found, >=0
|
1280
|
+
|
1281
|
+
This subroutine performs query and stores its result in the internal
|
1282
|
+
structures of the buffer object. You can use following subroutines to
|
1283
|
+
obtain these results (pay attention to "buf" in their names):
|
1284
|
+
* KDTreeTsQueryResultsX() to get X-values
|
1285
|
+
* KDTreeTsQueryResultsXY() to get X- and Y-values
|
1286
|
+
* KDTreeTsQueryResultsTags() to get tag values
|
1287
|
+
* KDTreeTsQueryResultsDistances() to get distances
|
1288
|
+
|
1289
|
+
As indicated by "U" suffix, this function returns unordered results.
|
1290
|
+
|
1291
|
+
IMPORTANT: kd-tree buffer should be used only with KD-tree object which
|
1292
|
+
was used to initialize buffer. Any attempt to use biffer with
|
1293
|
+
different object is dangerous - you may get integrity check
|
1294
|
+
failure (exception) because sizes of internal arrays do not fit
|
1295
|
+
to dimensions of KD-tree structure.
|
1296
|
+
|
1297
|
+
-- ALGLIB --
|
1298
|
+
Copyright 18.03.2016 by Bochkanov Sergey
|
1299
|
+
*************************************************************************/
|
1300
|
+
ae_int_t kdtreetsqueryrnnu(const kdtree &kdt, kdtreerequestbuffer &buf, const real_1d_array &x, const double r, const bool selfmatch, const xparams _xparams = alglib::xdefault);
|
1301
|
+
ae_int_t kdtreetsqueryrnnu(const kdtree &kdt, kdtreerequestbuffer &buf, const real_1d_array &x, const double r, const xparams _xparams = alglib::xdefault);
|
1302
|
+
|
1303
|
+
|
1304
|
+
/*************************************************************************
|
1305
|
+
K-NN query: approximate K nearest neighbors
|
1306
|
+
|
1307
|
+
IMPORTANT: this function can not be used in multithreaded code because it
|
1308
|
+
uses internal temporary buffer of kd-tree object, which can not
|
1309
|
+
be shared between multiple threads. If you want to perform
|
1310
|
+
parallel requests, use function which uses external request
|
1311
|
+
buffer: KDTreeTsQueryAKNN() ("Ts" stands for "thread-safe").
|
1312
|
+
|
1313
|
+
INPUT PARAMETERS
|
1314
|
+
KDT - KD-tree
|
1315
|
+
X - point, array[0..NX-1].
|
1316
|
+
K - number of neighbors to return, K>=1
|
1317
|
+
SelfMatch - whether self-matches are allowed:
|
1318
|
+
* if True, nearest neighbor may be the point itself
|
1319
|
+
(if it exists in original dataset)
|
1320
|
+
* if False, then only points with non-zero distance
|
1321
|
+
are returned
|
1322
|
+
* if not given, considered True
|
1323
|
+
Eps - approximation factor, Eps>=0. eps-approximate nearest
|
1324
|
+
neighbor is a neighbor whose distance from X is at
|
1325
|
+
most (1+eps) times distance of true nearest neighbor.
|
1326
|
+
|
1327
|
+
RESULT
|
1328
|
+
number of actual neighbors found (either K or N, if K>N).
|
1329
|
+
|
1330
|
+
NOTES
|
1331
|
+
significant performance gain may be achieved only when Eps is is on
|
1332
|
+
the order of magnitude of 1 or larger.
|
1333
|
+
|
1334
|
+
This subroutine performs query and stores its result in the internal
|
1335
|
+
structures of the KD-tree. You can use following subroutines to obtain
|
1336
|
+
these results:
|
1337
|
+
* KDTreeQueryResultsX() to get X-values
|
1338
|
+
* KDTreeQueryResultsXY() to get X- and Y-values
|
1339
|
+
* KDTreeQueryResultsTags() to get tag values
|
1340
|
+
* KDTreeQueryResultsDistances() to get distances
|
1341
|
+
|
1342
|
+
-- ALGLIB --
|
1343
|
+
Copyright 28.02.2010 by Bochkanov Sergey
|
1344
|
+
*************************************************************************/
|
1345
|
+
ae_int_t kdtreequeryaknn(kdtree &kdt, const real_1d_array &x, const ae_int_t k, const bool selfmatch, const double eps, const xparams _xparams = alglib::xdefault);
|
1346
|
+
ae_int_t kdtreequeryaknn(kdtree &kdt, const real_1d_array &x, const ae_int_t k, const double eps, const xparams _xparams = alglib::xdefault);
|
1347
|
+
|
1348
|
+
|
1349
|
+
/*************************************************************************
|
1350
|
+
K-NN query: approximate K nearest neighbors, using thread-local buffer.
|
1351
|
+
|
1352
|
+
You can call this function from multiple threads for same kd-tree instance,
|
1353
|
+
assuming that different instances of buffer object are passed to different
|
1354
|
+
threads.
|
1355
|
+
|
1356
|
+
INPUT PARAMETERS
|
1357
|
+
KDT - KD-tree
|
1358
|
+
Buf - request buffer object created for this particular
|
1359
|
+
instance of kd-tree structure with kdtreecreaterequestbuffer()
|
1360
|
+
function.
|
1361
|
+
X - point, array[0..NX-1].
|
1362
|
+
K - number of neighbors to return, K>=1
|
1363
|
+
SelfMatch - whether self-matches are allowed:
|
1364
|
+
* if True, nearest neighbor may be the point itself
|
1365
|
+
(if it exists in original dataset)
|
1366
|
+
* if False, then only points with non-zero distance
|
1367
|
+
are returned
|
1368
|
+
* if not given, considered True
|
1369
|
+
Eps - approximation factor, Eps>=0. eps-approximate nearest
|
1370
|
+
neighbor is a neighbor whose distance from X is at
|
1371
|
+
most (1+eps) times distance of true nearest neighbor.
|
1372
|
+
|
1373
|
+
RESULT
|
1374
|
+
number of actual neighbors found (either K or N, if K>N).
|
1375
|
+
|
1376
|
+
NOTES
|
1377
|
+
significant performance gain may be achieved only when Eps is is on
|
1378
|
+
the order of magnitude of 1 or larger.
|
1379
|
+
|
1380
|
+
This subroutine performs query and stores its result in the internal
|
1381
|
+
structures of the buffer object. You can use following subroutines to
|
1382
|
+
obtain these results (pay attention to "buf" in their names):
|
1383
|
+
* KDTreeTsQueryResultsX() to get X-values
|
1384
|
+
* KDTreeTsQueryResultsXY() to get X- and Y-values
|
1385
|
+
* KDTreeTsQueryResultsTags() to get tag values
|
1386
|
+
* KDTreeTsQueryResultsDistances() to get distances
|
1387
|
+
|
1388
|
+
IMPORTANT: kd-tree buffer should be used only with KD-tree object which
|
1389
|
+
was used to initialize buffer. Any attempt to use biffer with
|
1390
|
+
different object is dangerous - you may get integrity check
|
1391
|
+
failure (exception) because sizes of internal arrays do not fit
|
1392
|
+
to dimensions of KD-tree structure.
|
1393
|
+
|
1394
|
+
-- ALGLIB --
|
1395
|
+
Copyright 18.03.2016 by Bochkanov Sergey
|
1396
|
+
*************************************************************************/
|
1397
|
+
ae_int_t kdtreetsqueryaknn(const kdtree &kdt, kdtreerequestbuffer &buf, const real_1d_array &x, const ae_int_t k, const bool selfmatch, const double eps, const xparams _xparams = alglib::xdefault);
|
1398
|
+
ae_int_t kdtreetsqueryaknn(const kdtree &kdt, kdtreerequestbuffer &buf, const real_1d_array &x, const ae_int_t k, const double eps, const xparams _xparams = alglib::xdefault);
|
1399
|
+
|
1400
|
+
|
1401
|
+
/*************************************************************************
|
1402
|
+
Box query: all points within user-specified box.
|
1403
|
+
|
1404
|
+
IMPORTANT: this function can not be used in multithreaded code because it
|
1405
|
+
uses internal temporary buffer of kd-tree object, which can not
|
1406
|
+
be shared between multiple threads. If you want to perform
|
1407
|
+
parallel requests, use function which uses external request
|
1408
|
+
buffer: KDTreeTsQueryBox() ("Ts" stands for "thread-safe").
|
1409
|
+
|
1410
|
+
INPUT PARAMETERS
|
1411
|
+
KDT - KD-tree
|
1412
|
+
BoxMin - lower bounds, array[0..NX-1].
|
1413
|
+
BoxMax - upper bounds, array[0..NX-1].
|
1414
|
+
|
1415
|
+
|
1416
|
+
RESULT
|
1417
|
+
number of actual neighbors found (in [0,N]).
|
1418
|
+
|
1419
|
+
This subroutine performs query and stores its result in the internal
|
1420
|
+
structures of the KD-tree. You can use following subroutines to obtain
|
1421
|
+
these results:
|
1422
|
+
* KDTreeQueryResultsX() to get X-values
|
1423
|
+
* KDTreeQueryResultsXY() to get X- and Y-values
|
1424
|
+
* KDTreeQueryResultsTags() to get tag values
|
1425
|
+
* KDTreeQueryResultsDistances() returns zeros for this request
|
1426
|
+
|
1427
|
+
NOTE: this particular query returns unordered results, because there is no
|
1428
|
+
meaningful way of ordering points. Furthermore, no 'distance' is
|
1429
|
+
associated with points - it is either INSIDE or OUTSIDE (so request
|
1430
|
+
for distances will return zeros).
|
1431
|
+
|
1432
|
+
-- ALGLIB --
|
1433
|
+
Copyright 14.05.2016 by Bochkanov Sergey
|
1434
|
+
*************************************************************************/
|
1435
|
+
ae_int_t kdtreequerybox(kdtree &kdt, const real_1d_array &boxmin, const real_1d_array &boxmax, const xparams _xparams = alglib::xdefault);
|
1436
|
+
|
1437
|
+
|
1438
|
+
/*************************************************************************
|
1439
|
+
Box query: all points within user-specified box, using thread-local buffer.
|
1440
|
+
|
1441
|
+
You can call this function from multiple threads for same kd-tree instance,
|
1442
|
+
assuming that different instances of buffer object are passed to different
|
1443
|
+
threads.
|
1444
|
+
|
1445
|
+
INPUT PARAMETERS
|
1446
|
+
KDT - KD-tree
|
1447
|
+
Buf - request buffer object created for this particular
|
1448
|
+
instance of kd-tree structure with kdtreecreaterequestbuffer()
|
1449
|
+
function.
|
1450
|
+
BoxMin - lower bounds, array[0..NX-1].
|
1451
|
+
BoxMax - upper bounds, array[0..NX-1].
|
1452
|
+
|
1453
|
+
RESULT
|
1454
|
+
number of actual neighbors found (in [0,N]).
|
1455
|
+
|
1456
|
+
This subroutine performs query and stores its result in the internal
|
1457
|
+
structures of the buffer object. You can use following subroutines to
|
1458
|
+
obtain these results (pay attention to "ts" in their names):
|
1459
|
+
* KDTreeTsQueryResultsX() to get X-values
|
1460
|
+
* KDTreeTsQueryResultsXY() to get X- and Y-values
|
1461
|
+
* KDTreeTsQueryResultsTags() to get tag values
|
1462
|
+
* KDTreeTsQueryResultsDistances() returns zeros for this query
|
1463
|
+
|
1464
|
+
NOTE: this particular query returns unordered results, because there is no
|
1465
|
+
meaningful way of ordering points. Furthermore, no 'distance' is
|
1466
|
+
associated with points - it is either INSIDE or OUTSIDE (so request
|
1467
|
+
for distances will return zeros).
|
1468
|
+
|
1469
|
+
IMPORTANT: kd-tree buffer should be used only with KD-tree object which
|
1470
|
+
was used to initialize buffer. Any attempt to use biffer with
|
1471
|
+
different object is dangerous - you may get integrity check
|
1472
|
+
failure (exception) because sizes of internal arrays do not fit
|
1473
|
+
to dimensions of KD-tree structure.
|
1474
|
+
|
1475
|
+
-- ALGLIB --
|
1476
|
+
Copyright 14.05.2016 by Bochkanov Sergey
|
1477
|
+
*************************************************************************/
|
1478
|
+
ae_int_t kdtreetsquerybox(const kdtree &kdt, kdtreerequestbuffer &buf, const real_1d_array &boxmin, const real_1d_array &boxmax, const xparams _xparams = alglib::xdefault);
|
1479
|
+
|
1480
|
+
|
1481
|
+
/*************************************************************************
|
1482
|
+
X-values from last query.
|
1483
|
+
|
1484
|
+
This function retuns results stored in the internal buffer of kd-tree
|
1485
|
+
object. If you performed buffered requests (ones which use instances of
|
1486
|
+
kdtreerequestbuffer class), you should call buffered version of this
|
1487
|
+
function - kdtreetsqueryresultsx().
|
1488
|
+
|
1489
|
+
INPUT PARAMETERS
|
1490
|
+
KDT - KD-tree
|
1491
|
+
X - possibly pre-allocated buffer. If X is too small to store
|
1492
|
+
result, it is resized. If size(X) is enough to store
|
1493
|
+
result, it is left unchanged.
|
1494
|
+
|
1495
|
+
OUTPUT PARAMETERS
|
1496
|
+
X - rows are filled with X-values
|
1497
|
+
|
1498
|
+
NOTES
|
1499
|
+
1. points are ordered by distance from the query point (first = closest)
|
1500
|
+
2. if XY is larger than required to store result, only leading part will
|
1501
|
+
be overwritten; trailing part will be left unchanged. So if on input
|
1502
|
+
XY = [[A,B],[C,D]], and result is [1,2], then on exit we will get
|
1503
|
+
XY = [[1,2],[C,D]]. This is done purposely to increase performance; if
|
1504
|
+
you want function to resize array according to result size, use
|
1505
|
+
function with same name and suffix 'I'.
|
1506
|
+
|
1507
|
+
SEE ALSO
|
1508
|
+
* KDTreeQueryResultsXY() X- and Y-values
|
1509
|
+
* KDTreeQueryResultsTags() tag values
|
1510
|
+
* KDTreeQueryResultsDistances() distances
|
1511
|
+
|
1512
|
+
-- ALGLIB --
|
1513
|
+
Copyright 28.02.2010 by Bochkanov Sergey
|
1514
|
+
*************************************************************************/
|
1515
|
+
void kdtreequeryresultsx(const kdtree &kdt, real_2d_array &x, const xparams _xparams = alglib::xdefault);
|
1516
|
+
|
1517
|
+
|
1518
|
+
/*************************************************************************
|
1519
|
+
X- and Y-values from last query
|
1520
|
+
|
1521
|
+
This function retuns results stored in the internal buffer of kd-tree
|
1522
|
+
object. If you performed buffered requests (ones which use instances of
|
1523
|
+
kdtreerequestbuffer class), you should call buffered version of this
|
1524
|
+
function - kdtreetsqueryresultsxy().
|
1525
|
+
|
1526
|
+
INPUT PARAMETERS
|
1527
|
+
KDT - KD-tree
|
1528
|
+
XY - possibly pre-allocated buffer. If XY is too small to store
|
1529
|
+
result, it is resized. If size(XY) is enough to store
|
1530
|
+
result, it is left unchanged.
|
1531
|
+
|
1532
|
+
OUTPUT PARAMETERS
|
1533
|
+
XY - rows are filled with points: first NX columns with
|
1534
|
+
X-values, next NY columns - with Y-values.
|
1535
|
+
|
1536
|
+
NOTES
|
1537
|
+
1. points are ordered by distance from the query point (first = closest)
|
1538
|
+
2. if XY is larger than required to store result, only leading part will
|
1539
|
+
be overwritten; trailing part will be left unchanged. So if on input
|
1540
|
+
XY = [[A,B],[C,D]], and result is [1,2], then on exit we will get
|
1541
|
+
XY = [[1,2],[C,D]]. This is done purposely to increase performance; if
|
1542
|
+
you want function to resize array according to result size, use
|
1543
|
+
function with same name and suffix 'I'.
|
1544
|
+
|
1545
|
+
SEE ALSO
|
1546
|
+
* KDTreeQueryResultsX() X-values
|
1547
|
+
* KDTreeQueryResultsTags() tag values
|
1548
|
+
* KDTreeQueryResultsDistances() distances
|
1549
|
+
|
1550
|
+
-- ALGLIB --
|
1551
|
+
Copyright 28.02.2010 by Bochkanov Sergey
|
1552
|
+
*************************************************************************/
|
1553
|
+
void kdtreequeryresultsxy(const kdtree &kdt, real_2d_array &xy, const xparams _xparams = alglib::xdefault);
|
1554
|
+
|
1555
|
+
|
1556
|
+
/*************************************************************************
|
1557
|
+
Tags from last query
|
1558
|
+
|
1559
|
+
This function retuns results stored in the internal buffer of kd-tree
|
1560
|
+
object. If you performed buffered requests (ones which use instances of
|
1561
|
+
kdtreerequestbuffer class), you should call buffered version of this
|
1562
|
+
function - kdtreetsqueryresultstags().
|
1563
|
+
|
1564
|
+
INPUT PARAMETERS
|
1565
|
+
KDT - KD-tree
|
1566
|
+
Tags - possibly pre-allocated buffer. If X is too small to store
|
1567
|
+
result, it is resized. If size(X) is enough to store
|
1568
|
+
result, it is left unchanged.
|
1569
|
+
|
1570
|
+
OUTPUT PARAMETERS
|
1571
|
+
Tags - filled with tags associated with points,
|
1572
|
+
or, when no tags were supplied, with zeros
|
1573
|
+
|
1574
|
+
NOTES
|
1575
|
+
1. points are ordered by distance from the query point (first = closest)
|
1576
|
+
2. if XY is larger than required to store result, only leading part will
|
1577
|
+
be overwritten; trailing part will be left unchanged. So if on input
|
1578
|
+
XY = [[A,B],[C,D]], and result is [1,2], then on exit we will get
|
1579
|
+
XY = [[1,2],[C,D]]. This is done purposely to increase performance; if
|
1580
|
+
you want function to resize array according to result size, use
|
1581
|
+
function with same name and suffix 'I'.
|
1582
|
+
|
1583
|
+
SEE ALSO
|
1584
|
+
* KDTreeQueryResultsX() X-values
|
1585
|
+
* KDTreeQueryResultsXY() X- and Y-values
|
1586
|
+
* KDTreeQueryResultsDistances() distances
|
1587
|
+
|
1588
|
+
-- ALGLIB --
|
1589
|
+
Copyright 28.02.2010 by Bochkanov Sergey
|
1590
|
+
*************************************************************************/
|
1591
|
+
void kdtreequeryresultstags(const kdtree &kdt, integer_1d_array &tags, const xparams _xparams = alglib::xdefault);
|
1592
|
+
|
1593
|
+
|
1594
|
+
/*************************************************************************
|
1595
|
+
Distances from last query
|
1596
|
+
|
1597
|
+
This function retuns results stored in the internal buffer of kd-tree
|
1598
|
+
object. If you performed buffered requests (ones which use instances of
|
1599
|
+
kdtreerequestbuffer class), you should call buffered version of this
|
1600
|
+
function - kdtreetsqueryresultsdistances().
|
1601
|
+
|
1602
|
+
INPUT PARAMETERS
|
1603
|
+
KDT - KD-tree
|
1604
|
+
R - possibly pre-allocated buffer. If X is too small to store
|
1605
|
+
result, it is resized. If size(X) is enough to store
|
1606
|
+
result, it is left unchanged.
|
1607
|
+
|
1608
|
+
OUTPUT PARAMETERS
|
1609
|
+
R - filled with distances (in corresponding norm)
|
1610
|
+
|
1611
|
+
NOTES
|
1612
|
+
1. points are ordered by distance from the query point (first = closest)
|
1613
|
+
2. if XY is larger than required to store result, only leading part will
|
1614
|
+
be overwritten; trailing part will be left unchanged. So if on input
|
1615
|
+
XY = [[A,B],[C,D]], and result is [1,2], then on exit we will get
|
1616
|
+
XY = [[1,2],[C,D]]. This is done purposely to increase performance; if
|
1617
|
+
you want function to resize array according to result size, use
|
1618
|
+
function with same name and suffix 'I'.
|
1619
|
+
|
1620
|
+
SEE ALSO
|
1621
|
+
* KDTreeQueryResultsX() X-values
|
1622
|
+
* KDTreeQueryResultsXY() X- and Y-values
|
1623
|
+
* KDTreeQueryResultsTags() tag values
|
1624
|
+
|
1625
|
+
-- ALGLIB --
|
1626
|
+
Copyright 28.02.2010 by Bochkanov Sergey
|
1627
|
+
*************************************************************************/
|
1628
|
+
void kdtreequeryresultsdistances(const kdtree &kdt, real_1d_array &r, const xparams _xparams = alglib::xdefault);
|
1629
|
+
|
1630
|
+
|
1631
|
+
/*************************************************************************
|
1632
|
+
X-values from last query associated with kdtreerequestbuffer object.
|
1633
|
+
|
1634
|
+
INPUT PARAMETERS
|
1635
|
+
KDT - KD-tree
|
1636
|
+
Buf - request buffer object created for this particular
|
1637
|
+
instance of kd-tree structure.
|
1638
|
+
X - possibly pre-allocated buffer. If X is too small to store
|
1639
|
+
result, it is resized. If size(X) is enough to store
|
1640
|
+
result, it is left unchanged.
|
1641
|
+
|
1642
|
+
OUTPUT PARAMETERS
|
1643
|
+
X - rows are filled with X-values
|
1644
|
+
|
1645
|
+
NOTES
|
1646
|
+
1. points are ordered by distance from the query point (first = closest)
|
1647
|
+
2. if XY is larger than required to store result, only leading part will
|
1648
|
+
be overwritten; trailing part will be left unchanged. So if on input
|
1649
|
+
XY = [[A,B],[C,D]], and result is [1,2], then on exit we will get
|
1650
|
+
XY = [[1,2],[C,D]]. This is done purposely to increase performance; if
|
1651
|
+
you want function to resize array according to result size, use
|
1652
|
+
function with same name and suffix 'I'.
|
1653
|
+
|
1654
|
+
SEE ALSO
|
1655
|
+
* KDTreeQueryResultsXY() X- and Y-values
|
1656
|
+
* KDTreeQueryResultsTags() tag values
|
1657
|
+
* KDTreeQueryResultsDistances() distances
|
1658
|
+
|
1659
|
+
-- ALGLIB --
|
1660
|
+
Copyright 28.02.2010 by Bochkanov Sergey
|
1661
|
+
*************************************************************************/
|
1662
|
+
void kdtreetsqueryresultsx(const kdtree &kdt, const kdtreerequestbuffer &buf, real_2d_array &x, const xparams _xparams = alglib::xdefault);
|
1663
|
+
|
1664
|
+
|
1665
|
+
/*************************************************************************
|
1666
|
+
X- and Y-values from last query associated with kdtreerequestbuffer object.
|
1667
|
+
|
1668
|
+
INPUT PARAMETERS
|
1669
|
+
KDT - KD-tree
|
1670
|
+
Buf - request buffer object created for this particular
|
1671
|
+
instance of kd-tree structure.
|
1672
|
+
XY - possibly pre-allocated buffer. If XY is too small to store
|
1673
|
+
result, it is resized. If size(XY) is enough to store
|
1674
|
+
result, it is left unchanged.
|
1675
|
+
|
1676
|
+
OUTPUT PARAMETERS
|
1677
|
+
XY - rows are filled with points: first NX columns with
|
1678
|
+
X-values, next NY columns - with Y-values.
|
1679
|
+
|
1680
|
+
NOTES
|
1681
|
+
1. points are ordered by distance from the query point (first = closest)
|
1682
|
+
2. if XY is larger than required to store result, only leading part will
|
1683
|
+
be overwritten; trailing part will be left unchanged. So if on input
|
1684
|
+
XY = [[A,B],[C,D]], and result is [1,2], then on exit we will get
|
1685
|
+
XY = [[1,2],[C,D]]. This is done purposely to increase performance; if
|
1686
|
+
you want function to resize array according to result size, use
|
1687
|
+
function with same name and suffix 'I'.
|
1688
|
+
|
1689
|
+
SEE ALSO
|
1690
|
+
* KDTreeQueryResultsX() X-values
|
1691
|
+
* KDTreeQueryResultsTags() tag values
|
1692
|
+
* KDTreeQueryResultsDistances() distances
|
1693
|
+
|
1694
|
+
-- ALGLIB --
|
1695
|
+
Copyright 28.02.2010 by Bochkanov Sergey
|
1696
|
+
*************************************************************************/
|
1697
|
+
void kdtreetsqueryresultsxy(const kdtree &kdt, const kdtreerequestbuffer &buf, real_2d_array &xy, const xparams _xparams = alglib::xdefault);
|
1698
|
+
|
1699
|
+
|
1700
|
+
/*************************************************************************
|
1701
|
+
Tags from last query associated with kdtreerequestbuffer object.
|
1702
|
+
|
1703
|
+
This function retuns results stored in the internal buffer of kd-tree
|
1704
|
+
object. If you performed buffered requests (ones which use instances of
|
1705
|
+
kdtreerequestbuffer class), you should call buffered version of this
|
1706
|
+
function - KDTreeTsqueryresultstags().
|
1707
|
+
|
1708
|
+
INPUT PARAMETERS
|
1709
|
+
KDT - KD-tree
|
1710
|
+
Buf - request buffer object created for this particular
|
1711
|
+
instance of kd-tree structure.
|
1712
|
+
Tags - possibly pre-allocated buffer. If X is too small to store
|
1713
|
+
result, it is resized. If size(X) is enough to store
|
1714
|
+
result, it is left unchanged.
|
1715
|
+
|
1716
|
+
OUTPUT PARAMETERS
|
1717
|
+
Tags - filled with tags associated with points,
|
1718
|
+
or, when no tags were supplied, with zeros
|
1719
|
+
|
1720
|
+
NOTES
|
1721
|
+
1. points are ordered by distance from the query point (first = closest)
|
1722
|
+
2. if XY is larger than required to store result, only leading part will
|
1723
|
+
be overwritten; trailing part will be left unchanged. So if on input
|
1724
|
+
XY = [[A,B],[C,D]], and result is [1,2], then on exit we will get
|
1725
|
+
XY = [[1,2],[C,D]]. This is done purposely to increase performance; if
|
1726
|
+
you want function to resize array according to result size, use
|
1727
|
+
function with same name and suffix 'I'.
|
1728
|
+
|
1729
|
+
SEE ALSO
|
1730
|
+
* KDTreeQueryResultsX() X-values
|
1731
|
+
* KDTreeQueryResultsXY() X- and Y-values
|
1732
|
+
* KDTreeQueryResultsDistances() distances
|
1733
|
+
|
1734
|
+
-- ALGLIB --
|
1735
|
+
Copyright 28.02.2010 by Bochkanov Sergey
|
1736
|
+
*************************************************************************/
|
1737
|
+
void kdtreetsqueryresultstags(const kdtree &kdt, const kdtreerequestbuffer &buf, integer_1d_array &tags, const xparams _xparams = alglib::xdefault);
|
1738
|
+
|
1739
|
+
|
1740
|
+
/*************************************************************************
|
1741
|
+
Distances from last query associated with kdtreerequestbuffer object.
|
1742
|
+
|
1743
|
+
This function retuns results stored in the internal buffer of kd-tree
|
1744
|
+
object. If you performed buffered requests (ones which use instances of
|
1745
|
+
kdtreerequestbuffer class), you should call buffered version of this
|
1746
|
+
function - KDTreeTsqueryresultsdistances().
|
1747
|
+
|
1748
|
+
INPUT PARAMETERS
|
1749
|
+
KDT - KD-tree
|
1750
|
+
Buf - request buffer object created for this particular
|
1751
|
+
instance of kd-tree structure.
|
1752
|
+
R - possibly pre-allocated buffer. If X is too small to store
|
1753
|
+
result, it is resized. If size(X) is enough to store
|
1754
|
+
result, it is left unchanged.
|
1755
|
+
|
1756
|
+
OUTPUT PARAMETERS
|
1757
|
+
R - filled with distances (in corresponding norm)
|
1758
|
+
|
1759
|
+
NOTES
|
1760
|
+
1. points are ordered by distance from the query point (first = closest)
|
1761
|
+
2. if XY is larger than required to store result, only leading part will
|
1762
|
+
be overwritten; trailing part will be left unchanged. So if on input
|
1763
|
+
XY = [[A,B],[C,D]], and result is [1,2], then on exit we will get
|
1764
|
+
XY = [[1,2],[C,D]]. This is done purposely to increase performance; if
|
1765
|
+
you want function to resize array according to result size, use
|
1766
|
+
function with same name and suffix 'I'.
|
1767
|
+
|
1768
|
+
SEE ALSO
|
1769
|
+
* KDTreeQueryResultsX() X-values
|
1770
|
+
* KDTreeQueryResultsXY() X- and Y-values
|
1771
|
+
* KDTreeQueryResultsTags() tag values
|
1772
|
+
|
1773
|
+
-- ALGLIB --
|
1774
|
+
Copyright 28.02.2010 by Bochkanov Sergey
|
1775
|
+
*************************************************************************/
|
1776
|
+
void kdtreetsqueryresultsdistances(const kdtree &kdt, const kdtreerequestbuffer &buf, real_1d_array &r, const xparams _xparams = alglib::xdefault);
|
1777
|
+
|
1778
|
+
|
1779
|
+
/*************************************************************************
|
1780
|
+
X-values from last query; 'interactive' variant for languages like Python
|
1781
|
+
which support constructs like "X = KDTreeQueryResultsXI(KDT)" and
|
1782
|
+
interactive mode of interpreter.
|
1783
|
+
|
1784
|
+
This function allocates new array on each call, so it is significantly
|
1785
|
+
slower than its 'non-interactive' counterpart, but it is more convenient
|
1786
|
+
when you call it from command line.
|
1787
|
+
|
1788
|
+
-- ALGLIB --
|
1789
|
+
Copyright 28.02.2010 by Bochkanov Sergey
|
1790
|
+
*************************************************************************/
|
1791
|
+
void kdtreequeryresultsxi(const kdtree &kdt, real_2d_array &x, const xparams _xparams = alglib::xdefault);
|
1792
|
+
|
1793
|
+
|
1794
|
+
/*************************************************************************
|
1795
|
+
XY-values from last query; 'interactive' variant for languages like Python
|
1796
|
+
which support constructs like "XY = KDTreeQueryResultsXYI(KDT)" and
|
1797
|
+
interactive mode of interpreter.
|
1798
|
+
|
1799
|
+
This function allocates new array on each call, so it is significantly
|
1800
|
+
slower than its 'non-interactive' counterpart, but it is more convenient
|
1801
|
+
when you call it from command line.
|
1802
|
+
|
1803
|
+
-- ALGLIB --
|
1804
|
+
Copyright 28.02.2010 by Bochkanov Sergey
|
1805
|
+
*************************************************************************/
|
1806
|
+
void kdtreequeryresultsxyi(const kdtree &kdt, real_2d_array &xy, const xparams _xparams = alglib::xdefault);
|
1807
|
+
|
1808
|
+
|
1809
|
+
/*************************************************************************
|
1810
|
+
Tags from last query; 'interactive' variant for languages like Python
|
1811
|
+
which support constructs like "Tags = KDTreeQueryResultsTagsI(KDT)" and
|
1812
|
+
interactive mode of interpreter.
|
1813
|
+
|
1814
|
+
This function allocates new array on each call, so it is significantly
|
1815
|
+
slower than its 'non-interactive' counterpart, but it is more convenient
|
1816
|
+
when you call it from command line.
|
1817
|
+
|
1818
|
+
-- ALGLIB --
|
1819
|
+
Copyright 28.02.2010 by Bochkanov Sergey
|
1820
|
+
*************************************************************************/
|
1821
|
+
void kdtreequeryresultstagsi(const kdtree &kdt, integer_1d_array &tags, const xparams _xparams = alglib::xdefault);
|
1822
|
+
|
1823
|
+
|
1824
|
+
/*************************************************************************
|
1825
|
+
Distances from last query; 'interactive' variant for languages like Python
|
1826
|
+
which support constructs like "R = KDTreeQueryResultsDistancesI(KDT)"
|
1827
|
+
and interactive mode of interpreter.
|
1828
|
+
|
1829
|
+
This function allocates new array on each call, so it is significantly
|
1830
|
+
slower than its 'non-interactive' counterpart, but it is more convenient
|
1831
|
+
when you call it from command line.
|
1832
|
+
|
1833
|
+
-- ALGLIB --
|
1834
|
+
Copyright 28.02.2010 by Bochkanov Sergey
|
1835
|
+
*************************************************************************/
|
1836
|
+
void kdtreequeryresultsdistancesi(const kdtree &kdt, real_1d_array &r, const xparams _xparams = alglib::xdefault);
|
1837
|
+
#endif
|
1838
|
+
}
|
1839
|
+
|
1840
|
+
/////////////////////////////////////////////////////////////////////////
|
1841
|
+
//
|
1842
|
+
// THIS SECTION CONTAINS COMPUTATIONAL CORE DECLARATIONS (FUNCTIONS)
|
1843
|
+
//
|
1844
|
+
/////////////////////////////////////////////////////////////////////////
|
1845
|
+
namespace alglib_impl
|
1846
|
+
{
|
1847
|
+
#if defined(AE_COMPILE_XDEBUG) || !defined(AE_PARTIAL_BUILD)
|
1848
|
+
void xdebuginitrecord1(xdebugrecord1* rec1, ae_state *_state);
|
1849
|
+
void xdebugupdaterecord1(xdebugrecord1* rec1, ae_state *_state);
|
1850
|
+
ae_int_t xdebugb1count(/* Boolean */ const ae_vector* a, ae_state *_state);
|
1851
|
+
void xdebugb1not(/* Boolean */ ae_vector* a, ae_state *_state);
|
1852
|
+
void xdebugb1appendcopy(/* Boolean */ ae_vector* a, ae_state *_state);
|
1853
|
+
void xdebugb1outeven(ae_int_t n,
|
1854
|
+
/* Boolean */ ae_vector* a,
|
1855
|
+
ae_state *_state);
|
1856
|
+
ae_int_t xdebugi1sum(/* Integer */ const ae_vector* a, ae_state *_state);
|
1857
|
+
void xdebugi1neg(/* Integer */ ae_vector* a, ae_state *_state);
|
1858
|
+
void xdebugi1appendcopy(/* Integer */ ae_vector* a, ae_state *_state);
|
1859
|
+
void xdebugi1outeven(ae_int_t n,
|
1860
|
+
/* Integer */ ae_vector* a,
|
1861
|
+
ae_state *_state);
|
1862
|
+
double xdebugr1sum(/* Real */ const ae_vector* a, ae_state *_state);
|
1863
|
+
double xdebugr1internalcopyandsum(/* Real */ const ae_vector* _a,
|
1864
|
+
ae_state *_state);
|
1865
|
+
void xdebugr1neg(/* Real */ ae_vector* a, ae_state *_state);
|
1866
|
+
void xdebugr1appendcopy(/* Real */ ae_vector* a, ae_state *_state);
|
1867
|
+
void xdebugr1outeven(ae_int_t n,
|
1868
|
+
/* Real */ ae_vector* a,
|
1869
|
+
ae_state *_state);
|
1870
|
+
ae_complex xdebugc1sum(/* Complex */ const ae_vector* a, ae_state *_state);
|
1871
|
+
void xdebugc1neg(/* Complex */ ae_vector* a, ae_state *_state);
|
1872
|
+
void xdebugc1appendcopy(/* Complex */ ae_vector* a, ae_state *_state);
|
1873
|
+
void xdebugc1outeven(ae_int_t n,
|
1874
|
+
/* Complex */ ae_vector* a,
|
1875
|
+
ae_state *_state);
|
1876
|
+
ae_int_t xdebugb2count(/* Boolean */ const ae_matrix* a, ae_state *_state);
|
1877
|
+
void xdebugb2not(/* Boolean */ ae_matrix* a, ae_state *_state);
|
1878
|
+
void xdebugb2transpose(/* Boolean */ ae_matrix* a, ae_state *_state);
|
1879
|
+
void xdebugb2outsin(ae_int_t m,
|
1880
|
+
ae_int_t n,
|
1881
|
+
/* Boolean */ ae_matrix* a,
|
1882
|
+
ae_state *_state);
|
1883
|
+
ae_int_t xdebugi2sum(/* Integer */ const ae_matrix* a, ae_state *_state);
|
1884
|
+
void xdebugi2neg(/* Integer */ ae_matrix* a, ae_state *_state);
|
1885
|
+
void xdebugi2transpose(/* Integer */ ae_matrix* a, ae_state *_state);
|
1886
|
+
void xdebugi2outsin(ae_int_t m,
|
1887
|
+
ae_int_t n,
|
1888
|
+
/* Integer */ ae_matrix* a,
|
1889
|
+
ae_state *_state);
|
1890
|
+
double xdebugr2sum(/* Real */ const ae_matrix* a, ae_state *_state);
|
1891
|
+
double xdebugr2internalcopyandsum(/* Real */ const ae_matrix* _a,
|
1892
|
+
ae_state *_state);
|
1893
|
+
void xdebugr2neg(/* Real */ ae_matrix* a, ae_state *_state);
|
1894
|
+
void xdebugr2transpose(/* Real */ ae_matrix* a, ae_state *_state);
|
1895
|
+
void xdebugr2outsin(ae_int_t m,
|
1896
|
+
ae_int_t n,
|
1897
|
+
/* Real */ ae_matrix* a,
|
1898
|
+
ae_state *_state);
|
1899
|
+
ae_complex xdebugc2sum(/* Complex */ const ae_matrix* a, ae_state *_state);
|
1900
|
+
void xdebugc2neg(/* Complex */ ae_matrix* a, ae_state *_state);
|
1901
|
+
void xdebugc2transpose(/* Complex */ ae_matrix* a, ae_state *_state);
|
1902
|
+
void xdebugc2outsincos(ae_int_t m,
|
1903
|
+
ae_int_t n,
|
1904
|
+
/* Complex */ ae_matrix* a,
|
1905
|
+
ae_state *_state);
|
1906
|
+
double xdebugmaskedbiasedproductsum(ae_int_t m,
|
1907
|
+
ae_int_t n,
|
1908
|
+
/* Real */ const ae_matrix* a,
|
1909
|
+
/* Real */ const ae_matrix* b,
|
1910
|
+
/* Boolean */ const ae_matrix* c,
|
1911
|
+
ae_state *_state);
|
1912
|
+
void _xdebugrecord1_init(void* _p, ae_state *_state, ae_bool make_automatic);
|
1913
|
+
void _xdebugrecord1_init_copy(void* _dst, const void* _src, ae_state *_state, ae_bool make_automatic);
|
1914
|
+
void _xdebugrecord1_clear(void* _p);
|
1915
|
+
void _xdebugrecord1_destroy(void* _p);
|
1916
|
+
#endif
|
1917
|
+
#if defined(AE_COMPILE_HQRND) || !defined(AE_PARTIAL_BUILD)
|
1918
|
+
void hqrndrandomize(hqrndstate* state, ae_state *_state);
|
1919
|
+
void hqrndseed(ae_int_t s1,
|
1920
|
+
ae_int_t s2,
|
1921
|
+
hqrndstate* state,
|
1922
|
+
ae_state *_state);
|
1923
|
+
double hqrnduniformr(hqrndstate* state, ae_state *_state);
|
1924
|
+
ae_int_t hqrnduniformi(hqrndstate* state, ae_int_t n, ae_state *_state);
|
1925
|
+
double hqrndnormal(hqrndstate* state, ae_state *_state);
|
1926
|
+
void hqrndnormalv(hqrndstate* state,
|
1927
|
+
ae_int_t n,
|
1928
|
+
/* Real */ ae_vector* x,
|
1929
|
+
ae_state *_state);
|
1930
|
+
void hqrndnormalm(hqrndstate* state,
|
1931
|
+
ae_int_t m,
|
1932
|
+
ae_int_t n,
|
1933
|
+
/* Real */ ae_matrix* x,
|
1934
|
+
ae_state *_state);
|
1935
|
+
void hqrndunit2(hqrndstate* state, double* x, double* y, ae_state *_state);
|
1936
|
+
void hqrndnormal2(hqrndstate* state,
|
1937
|
+
double* x1,
|
1938
|
+
double* x2,
|
1939
|
+
ae_state *_state);
|
1940
|
+
double hqrndexponential(hqrndstate* state,
|
1941
|
+
double lambdav,
|
1942
|
+
ae_state *_state);
|
1943
|
+
ae_int_t hqrndgetmax(ae_state *_state);
|
1944
|
+
ae_int_t hqrndintegerbase(hqrndstate* state, ae_state *_state);
|
1945
|
+
double hqrnddiscrete(hqrndstate* state,
|
1946
|
+
/* Real */ const ae_vector* x,
|
1947
|
+
ae_int_t n,
|
1948
|
+
ae_state *_state);
|
1949
|
+
double hqrndcontinuous(hqrndstate* state,
|
1950
|
+
/* Real */ const ae_vector* x,
|
1951
|
+
ae_int_t n,
|
1952
|
+
ae_state *_state);
|
1953
|
+
void _hqrndstate_init(void* _p, ae_state *_state, ae_bool make_automatic);
|
1954
|
+
void _hqrndstate_init_copy(void* _dst, const void* _src, ae_state *_state, ae_bool make_automatic);
|
1955
|
+
void _hqrndstate_clear(void* _p);
|
1956
|
+
void _hqrndstate_destroy(void* _p);
|
1957
|
+
#endif
|
1958
|
+
#if defined(AE_COMPILE_NEARESTNEIGHBOR) || !defined(AE_PARTIAL_BUILD)
|
1959
|
+
void kdtreebuild(/* Real */ const ae_matrix* xy,
|
1960
|
+
ae_int_t n,
|
1961
|
+
ae_int_t nx,
|
1962
|
+
ae_int_t ny,
|
1963
|
+
ae_int_t normtype,
|
1964
|
+
kdtree* kdt,
|
1965
|
+
ae_state *_state);
|
1966
|
+
void kdtreebuildtagged(/* Real */ const ae_matrix* xy,
|
1967
|
+
/* Integer */ const ae_vector* tags,
|
1968
|
+
ae_int_t n,
|
1969
|
+
ae_int_t nx,
|
1970
|
+
ae_int_t ny,
|
1971
|
+
ae_int_t normtype,
|
1972
|
+
kdtree* kdt,
|
1973
|
+
ae_state *_state);
|
1974
|
+
void kdtreecreaterequestbuffer(const kdtree* kdt,
|
1975
|
+
kdtreerequestbuffer* buf,
|
1976
|
+
ae_state *_state);
|
1977
|
+
ae_int_t kdtreequeryknn(kdtree* kdt,
|
1978
|
+
/* Real */ const ae_vector* x,
|
1979
|
+
ae_int_t k,
|
1980
|
+
ae_bool selfmatch,
|
1981
|
+
ae_state *_state);
|
1982
|
+
ae_int_t kdtreetsqueryknn(const kdtree* kdt,
|
1983
|
+
kdtreerequestbuffer* buf,
|
1984
|
+
/* Real */ const ae_vector* x,
|
1985
|
+
ae_int_t k,
|
1986
|
+
ae_bool selfmatch,
|
1987
|
+
ae_state *_state);
|
1988
|
+
ae_int_t kdtreequeryrnn(kdtree* kdt,
|
1989
|
+
/* Real */ const ae_vector* x,
|
1990
|
+
double r,
|
1991
|
+
ae_bool selfmatch,
|
1992
|
+
ae_state *_state);
|
1993
|
+
ae_int_t kdtreequeryrnnu(kdtree* kdt,
|
1994
|
+
/* Real */ const ae_vector* x,
|
1995
|
+
double r,
|
1996
|
+
ae_bool selfmatch,
|
1997
|
+
ae_state *_state);
|
1998
|
+
ae_int_t kdtreetsqueryrnn(const kdtree* kdt,
|
1999
|
+
kdtreerequestbuffer* buf,
|
2000
|
+
/* Real */ const ae_vector* x,
|
2001
|
+
double r,
|
2002
|
+
ae_bool selfmatch,
|
2003
|
+
ae_state *_state);
|
2004
|
+
ae_int_t kdtreetsqueryrnnu(const kdtree* kdt,
|
2005
|
+
kdtreerequestbuffer* buf,
|
2006
|
+
/* Real */ const ae_vector* x,
|
2007
|
+
double r,
|
2008
|
+
ae_bool selfmatch,
|
2009
|
+
ae_state *_state);
|
2010
|
+
ae_int_t kdtreequeryaknn(kdtree* kdt,
|
2011
|
+
/* Real */ const ae_vector* x,
|
2012
|
+
ae_int_t k,
|
2013
|
+
ae_bool selfmatch,
|
2014
|
+
double eps,
|
2015
|
+
ae_state *_state);
|
2016
|
+
ae_int_t kdtreetsqueryaknn(const kdtree* kdt,
|
2017
|
+
kdtreerequestbuffer* buf,
|
2018
|
+
/* Real */ const ae_vector* x,
|
2019
|
+
ae_int_t k,
|
2020
|
+
ae_bool selfmatch,
|
2021
|
+
double eps,
|
2022
|
+
ae_state *_state);
|
2023
|
+
ae_int_t kdtreequerybox(kdtree* kdt,
|
2024
|
+
/* Real */ const ae_vector* boxmin,
|
2025
|
+
/* Real */ const ae_vector* boxmax,
|
2026
|
+
ae_state *_state);
|
2027
|
+
ae_int_t kdtreetsquerybox(const kdtree* kdt,
|
2028
|
+
kdtreerequestbuffer* buf,
|
2029
|
+
/* Real */ const ae_vector* boxmin,
|
2030
|
+
/* Real */ const ae_vector* boxmax,
|
2031
|
+
ae_state *_state);
|
2032
|
+
void kdtreequeryresultsx(const kdtree* kdt,
|
2033
|
+
/* Real */ ae_matrix* x,
|
2034
|
+
ae_state *_state);
|
2035
|
+
void kdtreequeryresultsxy(const kdtree* kdt,
|
2036
|
+
/* Real */ ae_matrix* xy,
|
2037
|
+
ae_state *_state);
|
2038
|
+
void kdtreequeryresultstags(const kdtree* kdt,
|
2039
|
+
/* Integer */ ae_vector* tags,
|
2040
|
+
ae_state *_state);
|
2041
|
+
void kdtreequeryresultsdistances(const kdtree* kdt,
|
2042
|
+
/* Real */ ae_vector* r,
|
2043
|
+
ae_state *_state);
|
2044
|
+
void kdtreetsqueryresultsx(const kdtree* kdt,
|
2045
|
+
const kdtreerequestbuffer* buf,
|
2046
|
+
/* Real */ ae_matrix* x,
|
2047
|
+
ae_state *_state);
|
2048
|
+
void kdtreetsqueryresultsxy(const kdtree* kdt,
|
2049
|
+
const kdtreerequestbuffer* buf,
|
2050
|
+
/* Real */ ae_matrix* xy,
|
2051
|
+
ae_state *_state);
|
2052
|
+
void kdtreetsqueryresultstags(const kdtree* kdt,
|
2053
|
+
const kdtreerequestbuffer* buf,
|
2054
|
+
/* Integer */ ae_vector* tags,
|
2055
|
+
ae_state *_state);
|
2056
|
+
void kdtreetsqueryresultsdistances(const kdtree* kdt,
|
2057
|
+
const kdtreerequestbuffer* buf,
|
2058
|
+
/* Real */ ae_vector* r,
|
2059
|
+
ae_state *_state);
|
2060
|
+
void kdtreequeryresultsxi(const kdtree* kdt,
|
2061
|
+
/* Real */ ae_matrix* x,
|
2062
|
+
ae_state *_state);
|
2063
|
+
void kdtreequeryresultsxyi(const kdtree* kdt,
|
2064
|
+
/* Real */ ae_matrix* xy,
|
2065
|
+
ae_state *_state);
|
2066
|
+
void kdtreequeryresultstagsi(const kdtree* kdt,
|
2067
|
+
/* Integer */ ae_vector* tags,
|
2068
|
+
ae_state *_state);
|
2069
|
+
void kdtreequeryresultsdistancesi(const kdtree* kdt,
|
2070
|
+
/* Real */ ae_vector* r,
|
2071
|
+
ae_state *_state);
|
2072
|
+
void kdtreeexplorebox(const kdtree* kdt,
|
2073
|
+
/* Real */ ae_vector* boxmin,
|
2074
|
+
/* Real */ ae_vector* boxmax,
|
2075
|
+
ae_state *_state);
|
2076
|
+
void kdtreeexplorenodetype(const kdtree* kdt,
|
2077
|
+
ae_int_t node,
|
2078
|
+
ae_int_t* nodetype,
|
2079
|
+
ae_state *_state);
|
2080
|
+
void kdtreeexploreleaf(const kdtree* kdt,
|
2081
|
+
ae_int_t node,
|
2082
|
+
/* Real */ ae_matrix* xy,
|
2083
|
+
ae_int_t* k,
|
2084
|
+
ae_state *_state);
|
2085
|
+
void kdtreeexploresplit(const kdtree* kdt,
|
2086
|
+
ae_int_t node,
|
2087
|
+
ae_int_t* d,
|
2088
|
+
double* s,
|
2089
|
+
ae_int_t* nodele,
|
2090
|
+
ae_int_t* nodege,
|
2091
|
+
ae_state *_state);
|
2092
|
+
void kdtreealloc(ae_serializer* s, const kdtree* tree, ae_state *_state);
|
2093
|
+
void kdtreeserialize(ae_serializer* s,
|
2094
|
+
const kdtree* tree,
|
2095
|
+
ae_state *_state);
|
2096
|
+
void kdtreeunserialize(ae_serializer* s, kdtree* tree, ae_state *_state);
|
2097
|
+
double kdtreeapproxrnnquerycost(kdtree* kdt, double r, ae_state *_state);
|
2098
|
+
double kdtreetsapproxrnnquerycost(const kdtree* kdt,
|
2099
|
+
kdtreerequestbuffer* buf,
|
2100
|
+
double r,
|
2101
|
+
ae_state *_state);
|
2102
|
+
void _kdtreerequestbuffer_init(void* _p, ae_state *_state, ae_bool make_automatic);
|
2103
|
+
void _kdtreerequestbuffer_init_copy(void* _dst, const void* _src, ae_state *_state, ae_bool make_automatic);
|
2104
|
+
void _kdtreerequestbuffer_clear(void* _p);
|
2105
|
+
void _kdtreerequestbuffer_destroy(void* _p);
|
2106
|
+
void _kdtree_init(void* _p, ae_state *_state, ae_bool make_automatic);
|
2107
|
+
void _kdtree_init_copy(void* _dst, const void* _src, ae_state *_state, ae_bool make_automatic);
|
2108
|
+
void _kdtree_clear(void* _p);
|
2109
|
+
void _kdtree_destroy(void* _p);
|
2110
|
+
#endif
|
2111
|
+
|
2112
|
+
}
|
2113
|
+
#endif
|
2114
|
+
|