Class documentation of Concepts

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