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