ap.h

Go to the documentation of this file.
1 /*************************************************************************
2 ALGLIB 3.11.0 (source code generated 2017-05-11)
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 _ap_h
21 #define _ap_h
22 
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include <stddef.h>
26 #include <string>
27 #include <cstring>
28 #include <iostream>
29 #include <math.h>
30 
31 #if defined(__CODEGEARC__)
32 #include <list>
33 #include <vector>
34 #elif defined(__BORLANDC__)
35 #include <list.h>
36 #include <vector.h>
37 #else
38 #include <list>
39 #include <vector>
40 #endif
41 
42 #define AE_USE_CPP
43 /* Definitions */
44 #define AE_UNKNOWN 0
45 #define AE_MSVC 1
46 #define AE_GNUC 2
47 #define AE_SUNC 3
48 #define AE_INTEL 1
49 #define AE_SPARC 2
50 #define AE_WINDOWS 1
51 #define AE_POSIX 2
52 #define AE_LOCK_ALIGNMENT 16
53 
54 /* in case no OS is defined, use AE_UNKNOWN */
55 #ifndef AE_OS
56 #define AE_OS AE_UNKNOWN
57 #endif
58 
59 /* automatically determine compiler */
60 #define AE_COMPILER AE_UNKNOWN
61 #ifdef __GNUC__
62 #undef AE_COMPILER
63 #define AE_COMPILER AE_GNUC
64 #endif
65 #if defined(__SUNPRO_C)||defined(__SUNPRO_CC)
66 #undef AE_COMPILER
67 #define AE_COMPILER AE_SUNC
68 #endif
69 #ifdef _MSC_VER
70 #undef AE_COMPILER
71 #define AE_COMPILER AE_MSVC
72 #endif
73 
74 /* compiler-specific definitions */
75 #if AE_COMPILER==AE_MSVC
76 #define ALIGNED __declspec(align(8))
77 #elif AE_COMPILER==AE_GNUC
78 #define ALIGNED __attribute__((aligned(8)))
79 #else
80 #define ALIGNED
81 #endif
82 
83 /* now we are ready to include headers */
84 #include <stdlib.h>
85 #include <stdio.h>
86 #include <string.h>
87 #include <setjmp.h>
88 #include <math.h>
89 #include <stddef.h>
90 
91 #if defined(AE_HAVE_STDINT)
92 #include <stdint.h>
93 #endif
94 
95 /*
96  * SSE2 intrinsics
97  *
98  * Preprocessor directives below:
99  * - include headers for SSE2 intrinsics
100  * - define AE_HAS_SSE2_INTRINSICS definition
101  *
102  * These actions are performed when we have:
103  * - x86 architecture definition (AE_CPU==AE_INTEL)
104  * - compiler which supports intrinsics
105  *
106  * Presence of AE_HAS_SSE2_INTRINSICS does NOT mean that our CPU
107  * actually supports SSE2 - such things should be determined at runtime
108  * with ae_cpuid() call. It means that we are working under Intel and
109  * out compiler can issue SSE2-capable code.
110  *
111  */
112 #if defined(AE_CPU)
113 #if AE_CPU==AE_INTEL
114 #if AE_COMPILER==AE_MSVC
115 #include <emmintrin.h>
116 #define AE_HAS_SSE2_INTRINSICS
117 #endif
118 #if AE_COMPILER==AE_GNUC
119 #include <xmmintrin.h>
120 #define AE_HAS_SSE2_INTRINSICS
121 #endif
122 #if AE_COMPILER==AE_SUNC
123 #include <xmmintrin.h>
124 #include <emmintrin.h>
125 #define AE_HAS_SSE2_INTRINSICS
126 #endif
127 #endif
128 #endif
129 
130 
131 
133 //
134 // THIS SECTION CONTAINS DECLARATIONS FOR BASIC FUNCTIONALITY
135 // LIKE MEMORY MANAGEMENT FOR VECTORS/MATRICES WHICH IS SHARED
136 // BETWEEN C++ AND PURE C LIBRARIES
137 //
139 namespace alglib_impl
140 {
141 
142 /* if we work under C++ environment, define several conditions */
143 #ifdef AE_USE_CPP
144 #define AE_USE_CPP_BOOL
145 #define AE_USE_CPP_ERROR_HANDLING
146 #define AE_USE_CPP_SERIALIZATION
147 #include <iostream>
148 #endif
149 
150 /*
151  * define ae_int32_t, ae_int64_t, ae_int_t, ae_bool, ae_complex, ae_error_type and ae_datatype
152  */
153 
154 #if defined(AE_INT32_T)
155 typedef AE_INT32_T ae_int32_t;
156 #endif
157 #if defined(AE_HAVE_STDINT) && !defined(AE_INT32_T)
158 typedef int32_t ae_int32_t;
159 #endif
160 #if !defined(AE_HAVE_STDINT) && !defined(AE_INT32_T)
161 #if AE_COMPILER==AE_MSVC
162 typedef __int32 ae_int32_t;
163 #endif
164 #if (AE_COMPILER==AE_GNUC) || (AE_COMPILER==AE_SUNC) || (AE_COMPILER==AE_UNKNOWN)
165 typedef int ae_int32_t;
166 #endif
167 #endif
168 
169 #if defined(AE_INT64_T)
170 typedef AE_INT64_T ae_int64_t;
171 #endif
172 #if defined(AE_HAVE_STDINT) && !defined(AE_INT64_T)
173 typedef int64_t ae_int64_t;
174 #endif
175 #if !defined(AE_HAVE_STDINT) && !defined(AE_INT64_T)
176 #if AE_COMPILER==AE_MSVC
177 typedef __int64 ae_int64_t;
178 #endif
179 #if (AE_COMPILER==AE_GNUC) || (AE_COMPILER==AE_SUNC) || (AE_COMPILER==AE_UNKNOWN)
180 typedef signed long long ae_int64_t;
181 #endif
182 #endif
183 
184 #if !defined(AE_INT_T)
185 typedef ptrdiff_t ae_int_t;
186 #endif
187 
188 #if !defined(AE_USE_CPP_BOOL)
189 #define ae_bool char
190 #define ae_true 1
191 #define ae_false 0
192 #else
193 #define ae_bool bool
194 #define ae_true true
195 #define ae_false false
196 #endif
197 
198 typedef struct { double x, y; } ae_complex;
199 
200 typedef enum
201 {
202  ERR_OK = 0,
207 
209 
210 /*
211  * other definitions
212  */
213 enum { OWN_CALLER=1, OWN_AE=2 };
215 enum { DT_BOOL=1, DT_INT=2, DT_REAL=3, DT_COMPLEX=4 };
216 enum { CPU_SSE2=1 };
217 
218 /************************************************************************
219 x-string (zero-terminated):
220  owner OWN_CALLER or OWN_AE. Determines what to do on realloc().
221  If vector is owned by caller, X-interface will just set
222  ptr to NULL before realloc(). If it is owned by X, it
223  will call ae_free/x_free/aligned_free family functions.
224 
225  last_action ACT_UNCHANGED, ACT_SAME_LOCATION, ACT_NEW_LOCATION
226  contents is either: unchanged, stored at the same location,
227  stored at the new location.
228  this field is set on return from X.
229 
230  ptr pointer to the actual data
231 
232 Members of this structure are ae_int64_t to avoid alignment problems.
233 ************************************************************************/
234 typedef struct
235 {
236  ALIGNED ae_int64_t owner;
237  ALIGNED ae_int64_t last_action;
238  ALIGNED char *ptr;
239 } x_string;
240 
241 /************************************************************************
242 x-vector:
243  cnt number of elements
244 
245  datatype one of the DT_XXXX values
246 
247  owner OWN_CALLER or OWN_AE. Determines what to do on realloc().
248  If vector is owned by caller, X-interface will just set
249  ptr to NULL before realloc(). If it is owned by X, it
250  will call ae_free/x_free/aligned_free family functions.
251 
252  last_action ACT_UNCHANGED, ACT_SAME_LOCATION, ACT_NEW_LOCATION
253  contents is either: unchanged, stored at the same location,
254  stored at the new location.
255  this field is set on return from X interface and may be
256  used by caller as hint when deciding what to do with data
257  (if it was ACT_UNCHANGED or ACT_SAME_LOCATION, no array
258  reallocation or copying is required).
259 
260  ptr pointer to the actual data
261 
262 Members of this structure are ae_int64_t to avoid alignment problems.
263 ************************************************************************/
264 typedef struct
265 {
266  ALIGNED ae_int64_t cnt;
267  ALIGNED ae_int64_t datatype;
268  ALIGNED ae_int64_t owner;
269  ALIGNED ae_int64_t last_action;
270  ALIGNED void *ptr;
271 } x_vector;
272 
273 
274 /************************************************************************
275 x-matrix:
276  rows number of rows. may be zero only when cols is zero too.
277 
278  cols number of columns. may be zero only when rows is zero too.
279 
280  stride stride, i.e. distance between first elements of rows (in bytes)
281 
282  datatype one of the DT_XXXX values
283 
284  owner OWN_CALLER or OWN_AE. Determines what to do on realloc().
285  If vector is owned by caller, X-interface will just set
286  ptr to NULL before realloc(). If it is owned by X, it
287  will call ae_free/x_free/aligned_free family functions.
288 
289  last_action ACT_UNCHANGED, ACT_SAME_LOCATION, ACT_NEW_LOCATION
290  contents is either: unchanged, stored at the same location,
291  stored at the new location.
292  this field is set on return from X interface and may be
293  used by caller as hint when deciding what to do with data
294  (if it was ACT_UNCHANGED or ACT_SAME_LOCATION, no array
295  reallocation or copying is required).
296 
297  ptr pointer to the actual data, stored rowwise
298 
299 Members of this structure are ae_int64_t to avoid alignment problems.
300 ************************************************************************/
301 typedef struct
302 {
303  ALIGNED ae_int64_t rows;
304  ALIGNED ae_int64_t cols;
305  ALIGNED ae_int64_t stride;
306  ALIGNED ae_int64_t datatype;
307  ALIGNED ae_int64_t owner;
308  ALIGNED ae_int64_t last_action;
309  ALIGNED void *ptr;
310 } x_matrix;
311 
312 
313 /************************************************************************
314 dynamic block which may be automatically deallocated during stack unwinding
315 
316 p_next next block in the stack unwinding list.
317  NULL means that this block is not in the list
318 deallocator deallocator function which should be used to deallocate block.
319  NULL for "special" blocks (frame/stack boundaries)
320 ptr pointer which should be passed to the deallocator.
321  may be null (for zero-size block), DYN_BOTTOM or DYN_FRAME
322  for "special" blocks (frame/stack boundaries).
323 
324 ************************************************************************/
325 typedef struct ae_dyn_block
326 {
327  struct ae_dyn_block * volatile p_next;
328  /* void *deallocator; */
329  void (*deallocator)(void*);
330  void * volatile ptr;
332 
333 typedef void(*ae_deallocator)(void*);
334 
335 /************************************************************************
336 frame marker
337 ************************************************************************/
338 typedef struct ae_frame
339 {
342 
343 /************************************************************************
344 ALGLIB environment state
345 ************************************************************************/
346 typedef struct ae_state
347 {
348  /*
349  * endianness type: AE_LITTLE_ENDIAN or AE_BIG_ENDIAN
350  */
352 
353  /*
354  * double value for NAN
355  */
356  double v_nan;
357 
358  /*
359  * double value for +INF
360  */
361  double v_posinf;
362 
363  /*
364  * double value for -INF
365  */
366  double v_neginf;
367 
368  /*
369  * pointer to the top block in a stack of frames
370  * which hold dynamically allocated objects
371  */
372  ae_dyn_block * volatile p_top_block;
374 
375  /*
376  * jmp_buf for cases when C-style exception handling is used
377  */
378 #ifndef AE_USE_CPP_ERROR_HANDLING
379  jmp_buf * volatile break_jump;
380 #endif
381 
382  /*
383  * ae_error_type of the last error (filled when exception is thrown)
384  */
385  ae_error_type volatile last_error;
386 
387  /*
388  * human-readable message (filled when exception is thrown)
389  */
390  const char* volatile error_msg;
391 
392  /*
393  * threading information:
394  * a) current thread pool
395  * b) current worker thread
396  * c) parent task (one we are solving right now)
397  * d) thread exception handler (function which must be called
398  * by ae_assert before raising exception).
399  *
400  * NOTE: we use void* to store pointers in order to avoid explicit dependency on smp.h
401  */
402  void *worker_thread;
403  void *parent_task;
404  void (*thread_exception_handler)(void*);
405 
407 
408 /************************************************************************
409 Serializer:
410 
411 * ae_stream_writer type is a function pointer for stream writer method;
412  this pointer is used by X-core for out-of-core serialization (say, to
413  serialize ALGLIB structure directly to managed C# stream).
414 
415  This function accepts two parameters: pointer to ANSI (7-bit) string
416  and pointer-sized integer passed to serializer during initialization.
417  String being passed is a part of the data stream; aux paramerer may be
418  arbitrary value intended to be used by actual implementation of stream
419  writer. String parameter may include spaces and linefeed symbols, it
420  should be written to stream as is.
421 
422  Return value must be zero for success or non-zero for failure.
423 
424 * ae_stream_reader type is a function pointer for stream reader method;
425  this pointer is used by X-core for out-of-core unserialization (say, to
426  unserialize ALGLIB structure directly from managed C# stream).
427 
428  This function accepts three parameters: pointer-sized integer passed to
429  serializer during initialization; number of symbols to read from
430  stream; pointer to buffer used to store next token read from stream
431  (ANSI encoding is used, buffer is large enough to store all symbols and
432  trailing zero symbol).
433 
434  Number of symbols to read is always positive.
435 
436  After being called by X-core, this function must:
437  * skip all space and linefeed characters from the current position at
438  the stream and until first non-space non-linefeed character is found
439  * read exactly cnt symbols from stream to buffer; check that all
440  symbols being read are non-space non-linefeed ones
441  * append trailing zero symbol to buffer
442  * return value must be zero on success, non-zero if even one of the
443  conditions above fails. When reader returns non-zero value, contents
444  of buf is not used.
445 ************************************************************************/
446 typedef char(*ae_stream_writer)(const char *p_string, ae_int_t aux);
447 typedef char(*ae_stream_reader)(ae_int_t aux, ae_int_t cnt, char *p_buf);
448 
449 typedef struct
450 {
456 
457 #ifdef AE_USE_CPP_SERIALIZATION
458  std::string *out_cppstr;
459 #endif
460  char *out_str; /* pointer to the current position at the output buffer; advanced with each write operation */
461  const char *in_str; /* pointer to the current position at the input buffer; advanced with each read operation */
465 } ae_serializer;
466 
467 
468 typedef struct ae_vector
469 {
470  /*
471  * Number of elements in array, cnt>=0
472  */
474 
475  /*
476  * Either DT_BOOL, DT_INT, DT_REAL or DT_COMPLEX
477  */
479 
480  /*
481  * If ptr points to memory owned and managed by ae_vector itself,
482  * this field is ae_false. If vector was attached to x_vector structure
483  * with ae_vector_attach_to_x(), this field is ae_true.
484  */
486 
487  /*
488  * ae_dyn_block structure which manages data in ptr. This structure
489  * is responsible for automatic deletion of object when its frame
490  * is destroyed.
491  */
493 
494  /*
495  * Pointer to data.
496  * User usually works with this field.
497  */
498  union
499  {
500  void *p_ptr;
503  double *p_double;
505  } ptr;
507 
508 typedef struct ae_matrix
509 {
514 
515  /*
516  * If ptr points to memory owned and managed by ae_vector itself,
517  * this field is ae_false. If vector was attached to x_vector structure
518  * with ae_vector_attach_to_x(), this field is ae_true.
519  */
521 
523  union
524  {
525  void *p_ptr;
526  void **pp_void;
529  double **pp_double;
531  } ptr;
533 
534 typedef struct ae_smart_ptr
535 {
536  /* pointer to subscriber; all changes in ptr are translated to subscriber */
537  void **subscriber;
538 
539  /* pointer to object */
540  void *ptr;
541 
542  /* whether smart pointer owns ptr */
544 
545  /* whether object pointed by ptr is dynamic - clearing such object requires BOTH
546  calling destructor function AND calling ae_free for memory occupied by object. */
548 
549  /* destructor function for pointer; clears all dynamically allocated memory */
550  void (*destroy)(void*);
551 
552  /* frame entry; used to ensure automatic deallocation of smart pointer in case of exception/exit */
555 
556 
557 /*************************************************************************
558 Lock.
559 
560 This structure provides OS-independent non-reentrant lock:
561 * under Windows/Posix systems it uses system-provided locks
562 * under Boost it uses OS-independent lock provided by Boost package
563 * when no OS is defined, it uses "fake lock" (just stub which is not thread-safe):
564  a) "fake lock" can be in locked or free mode
565  b) "fake lock" can be used only from one thread - one which created lock
566  c) when thread acquires free lock, it immediately returns
567  d) when thread acquires busy lock, program is terminated
568  (because lock is already acquired and no one else can free it)
569 *************************************************************************/
570 typedef struct
571 {
572  /*
573  * Pointer to _lock structure. This pointer has type void* in order to
574  * make header file OS-independent (lock declaration depends on OS).
575  */
576  void *ptr;
577 } ae_lock;
578 
579 
580 /*************************************************************************
581 Shared pool: data structure used to provide thread-safe access to pool of
582 temporary variables.
583 *************************************************************************/
584 typedef struct ae_shared_pool_entry
585 {
586  void * volatile obj;
587  void * volatile next_entry;
589 
590 typedef struct ae_shared_pool
591 {
592  /* lock object which protects pool */
594 
595  /* seed object (used to create new instances of temporaries) */
596  void * volatile seed_object;
597 
598  /*
599  * list of recycled OBJECTS:
600  * 1. entries in this list store pointers to recycled objects
601  * 2. every time we retrieve object, we retrieve first entry from this list,
602  * move it to recycled_entries and return its obj field to caller/
603  */
605 
606  /*
607  * list of recycled ENTRIES:
608  * 1. this list holds entries which are not used to store recycled objects;
609  * every time recycled object is retrieved, its entry is moved to this list.
610  * 2. every time object is recycled, we try to fetch entry for him from this list
611  * before allocating it with malloc()
612  */
614 
615  /* enumeration pointer, points to current recycled object*/
617 
618  /* size of object; this field is used when we call malloc() for new objects */
620 
621  /* initializer function; accepts pointer to malloc'ed object, initializes its fields */
622  void (*init)(void* dst, ae_state* state);
623 
624  /* copy constructor; accepts pointer to malloc'ed, but not initialized object */
625  void (*init_copy)(void* dst, void* src, ae_state* state);
626 
627  /* destructor function; */
628  void (*destroy)(void* ptr);
629 
630  /* frame entry; contains pointer to the pool object itself */
633 
634 ae_int_t ae_misalignment(const void *ptr, size_t alignment);
635 void* ae_align(void *ptr, size_t alignment);
636 void* aligned_malloc(size_t size, size_t alignment);
637 void aligned_free(void *block);
638 
639 void* ae_malloc(size_t size, ae_state *state);
640 void ae_free(void *p);
642 void ae_touch_ptr(void *p);
643 
644 void ae_state_init(ae_state *state);
646 #ifndef AE_USE_CPP_ERROR_HANDLING
647 void ae_state_set_break_jump(ae_state *state, jmp_buf *buf);
648 #endif
649 void ae_break(ae_state *state, ae_error_type error_type, const char *msg);
650 
651 void ae_frame_make(ae_state *state, ae_frame *tmp);
653 
654 void ae_db_attach(ae_dyn_block *block, ae_state *state);
655 ae_bool ae_db_malloc(ae_dyn_block *block, ae_int_t size, ae_state *state, ae_bool make_automatic);
658 void ae_db_swap(ae_dyn_block *block1, ae_dyn_block *block2);
659 
660 void ae_vector_init(ae_vector *dst, ae_int_t size, ae_datatype datatype, ae_state *state);
668 
669 void ae_matrix_init(ae_matrix *dst, ae_int_t rows, ae_int_t cols, ae_datatype datatype, ae_state *state);
677 
678 void ae_smart_ptr_init(ae_smart_ptr *dst, void **subscriber, ae_state *state);
679 void ae_smart_ptr_clear(void *_dst); /* accepts ae_smart_ptr* */
680 void ae_smart_ptr_destroy(void *_dst);
681 void ae_smart_ptr_assign(ae_smart_ptr *dst, void *new_ptr, ae_bool is_owner, ae_bool is_dynamic, void (*destroy)(void*));
683 
684 void ae_yield();
685 void ae_init_lock(ae_lock *lock);
688 void ae_free_lock(ae_lock *lock);
689 
690 void ae_shared_pool_init(void *_dst, ae_state *state);
691 void ae_shared_pool_init_copy(void *_dst, void *_src, ae_state *state);
692 void ae_shared_pool_clear(void *dst);
693 void ae_shared_pool_destroy(void *dst);
696  ae_shared_pool *dst,
697  void *seed_object,
698  ae_int_t size_of_object,
699  void (*init)(void* dst, ae_state* state),
700  void (*init_copy)(void* dst, void* src, ae_state* state),
701  void (*destroy)(void* ptr),
702  ae_state *state);
704  ae_shared_pool *pool,
705  ae_smart_ptr *pptr,
706  ae_state *state);
708  ae_shared_pool *pool,
709  ae_smart_ptr *pptr,
710  ae_state *state);
712  ae_shared_pool *pool,
713  ae_state *state);
715  ae_shared_pool *pool,
716  ae_smart_ptr *pptr,
717  ae_state *state);
719  ae_shared_pool *pool,
720  ae_smart_ptr *pptr,
721  ae_state *state);
723  ae_shared_pool *pool,
724  ae_state *state);
725 
726 void ae_x_set_vector(x_vector *dst, ae_vector *src, ae_state *state);
727 void ae_x_set_matrix(x_matrix *dst, ae_matrix *src, ae_state *state);
730 
732 
741 
744 
748 
749 #ifdef AE_USE_CPP_SERIALIZATION
750 void ae_serializer_sstart_str(ae_serializer *serializer, std::string *buf);
751 void ae_serializer_ustart_str(ae_serializer *serializer, const std::string *buf);
752 void ae_serializer_sstart_stream(ae_serializer *serializer, std::ostream *stream);
753 void ae_serializer_ustart_stream(ae_serializer *serializer, const std::istream *stream);
754 #endif
755 void ae_serializer_sstart_str(ae_serializer *serializer, char *buf);
756 void ae_serializer_ustart_str(ae_serializer *serializer, const char *buf);
759 
762 void ae_serializer_serialize_double(ae_serializer *serializer, double v, ae_state *state);
765 void ae_serializer_unserialize_double(ae_serializer *serializer, double *v, ae_state *state);
766 
767 void ae_serializer_stop(ae_serializer *serializer, ae_state *state);
768 
769 /************************************************************************
770 Service functions
771 ************************************************************************/
772 void ae_assert(ae_bool cond, const char *msg, ae_state *state);
774 
775 /************************************************************************
776 Real math functions:
777 * IEEE-compliant floating point comparisons
778 * standard functions
779 ************************************************************************/
780 ae_bool ae_fp_eq(double v1, double v2);
781 ae_bool ae_fp_neq(double v1, double v2);
782 ae_bool ae_fp_less(double v1, double v2);
783 ae_bool ae_fp_less_eq(double v1, double v2);
784 ae_bool ae_fp_greater(double v1, double v2);
785 ae_bool ae_fp_greater_eq(double v1, double v2);
786 
792 
794 
795 ae_bool ae_isfinite(double x,ae_state *state);
796 ae_bool ae_isnan(double x, ae_state *state);
797 ae_bool ae_isinf(double x, ae_state *state);
798 ae_bool ae_isposinf(double x,ae_state *state);
799 ae_bool ae_isneginf(double x,ae_state *state);
800 
801 double ae_fabs(double x, ae_state *state);
803 double ae_sqr(double x, ae_state *state);
804 double ae_sqrt(double x, ae_state *state);
805 
806 ae_int_t ae_sign(double x, ae_state *state);
807 ae_int_t ae_round(double x, ae_state *state);
808 ae_int_t ae_trunc(double x, ae_state *state);
809 ae_int_t ae_ifloor(double x, ae_state *state);
810 ae_int_t ae_iceil(double x, ae_state *state);
811 
814 double ae_maxreal(double m1, double m2, ae_state *state);
815 double ae_minreal(double m1, double m2, ae_state *state);
816 double ae_randomreal(ae_state *state);
818 
819 double ae_sin(double x, ae_state *state);
820 double ae_cos(double x, ae_state *state);
821 double ae_tan(double x, ae_state *state);
822 double ae_sinh(double x, ae_state *state);
823 double ae_cosh(double x, ae_state *state);
824 double ae_tanh(double x, ae_state *state);
825 double ae_asin(double x, ae_state *state);
826 double ae_acos(double x, ae_state *state);
827 double ae_atan(double x, ae_state *state);
828 double ae_atan2(double y, double x, ae_state *state);
829 
830 double ae_log(double x, ae_state *state);
831 double ae_pow(double x, double y, ae_state *state);
832 double ae_exp(double x, ae_state *state);
833 
834 /************************************************************************
835 Complex math functions:
836 * basic arithmetic operations
837 * standard functions
838 ************************************************************************/
841 
849 ae_bool ae_c_eq_d(ae_complex lhs, double rhs);
850 ae_bool ae_c_neq_d(ae_complex lhs, double rhs);
857 
860 double ae_c_abs(ae_complex z, ae_state *state);
861 
862 /************************************************************************
863 Complex BLAS operations
864 ************************************************************************/
865 ae_complex ae_v_cdotproduct(const ae_complex *v0, ae_int_t stride0, const char *conj0, const ae_complex *v1, ae_int_t stride1, const char *conj1, ae_int_t n);
866 void ae_v_cmove(ae_complex *vdst, ae_int_t stride_dst, const ae_complex* vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n);
867 void ae_v_cmoveneg(ae_complex *vdst, ae_int_t stride_dst, const ae_complex* vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n);
868 void ae_v_cmoved(ae_complex *vdst, ae_int_t stride_dst, const ae_complex* vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, double alpha);
869 void ae_v_cmovec(ae_complex *vdst, ae_int_t stride_dst, const ae_complex* vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, ae_complex alpha);
870 void ae_v_cadd(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n);
871 void ae_v_caddd(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, double alpha);
872 void ae_v_caddc(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, ae_complex alpha);
873 void ae_v_csub(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n);
874 void ae_v_csubd(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, double alpha);
875 void ae_v_csubc(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, ae_complex alpha);
876 void ae_v_cmuld(ae_complex *vdst, ae_int_t stride_dst, ae_int_t n, double alpha);
877 void ae_v_cmulc(ae_complex *vdst, ae_int_t stride_dst, ae_int_t n, ae_complex alpha);
878 
879 /************************************************************************
880 Real BLAS operations
881 ************************************************************************/
882 double ae_v_dotproduct(const double *v0, ae_int_t stride0, const double *v1, ae_int_t stride1, ae_int_t n);
883 void ae_v_move(double *vdst, ae_int_t stride_dst, const double* vsrc, ae_int_t stride_src, ae_int_t n);
884 void ae_v_moveneg(double *vdst, ae_int_t stride_dst, const double* vsrc, ae_int_t stride_src, ae_int_t n);
885 void ae_v_moved(double *vdst, ae_int_t stride_dst, const double* vsrc, ae_int_t stride_src, ae_int_t n, double alpha);
886 void ae_v_add(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n);
887 void ae_v_addd(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n, double alpha);
888 void ae_v_sub(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n);
889 void ae_v_subd(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n, double alpha);
890 void ae_v_muld(double *vdst, ae_int_t stride_dst, ae_int_t n, double alpha);
891 
892 /************************************************************************
893 Other functions
894 ************************************************************************/
896 
897 /*
898 extern const double ae_machineepsilon;
899 extern const double ae_maxrealnumber;
900 extern const double ae_minrealnumber;
901 extern const double ae_pi;
902 */
903 #define ae_machineepsilon 5E-16
904 #define ae_maxrealnumber 1E300
905 #define ae_minrealnumber 1E-300
906 #define ae_pi 3.1415926535897932384626433832795
907 
908 
909 /************************************************************************
910 RComm functions
911 ************************************************************************/
912 typedef struct rcommstate
913 {
914  int stage;
915  ae_vector ia;
924 
925 /************************************************************************
926 Allocation counter, inactive by default.
927 Turned on when needed for debugging purposes.
928 ************************************************************************/
931 
932 
933 /************************************************************************
934 debug functions (must be turned on by preprocessor definitions):
935 * tickcount(), which is wrapper around GetTickCount()
936 * flushconsole(), fluches console
937 * ae_debugrng(), returns random number generated with high-quality random numbers generator
938 * ae_set_seed(), sets seed of the debug RNG (NON-THREAD-SAFE!!!)
939 * ae_get_seed(), returns two seed values of the debug RNG (NON-THREAD-SAFE!!!)
940 ************************************************************************/
941 #ifdef AE_DEBUG4WINDOWS
942 #define flushconsole(s) fflush(stdout)
943 #define tickcount(s) _tickcount()
944 int _tickcount();
945 #endif
946 #ifdef AE_DEBUG4POSIX
947 #define flushconsole(s) fflush(stdout)
948 #define tickcount(s) _tickcount()
949 int _tickcount();
950 #endif
951 
952 
953 }
954 
955 
957 //
958 // THIS SECTION CONTAINS DECLARATIONS FOR C++ RELATED FUNCTIONALITY
959 //
961 
962 namespace alglib
963 {
964 
966 
967 /********************************************************************
968 Class forwards
969 ********************************************************************/
970 class complex;
971 
973 
974 /********************************************************************
975 Exception class.
976 ********************************************************************/
977 class ap_error
978 {
979 public:
980  std::string msg;
981 
983  ap_error(const char *s);
984  static void make_assertion(bool bClause);
985  static void make_assertion(bool bClause, const char *p_msg);
986 private:
987 };
988 
989 /********************************************************************
990 Complex number with double precision.
991 ********************************************************************/
992 class complex
993 {
994 public:
995  complex();
996  complex(const double &_x);
997  complex(const double &_x, const double &_y);
998  complex(const complex &z);
999 
1000  complex& operator= (const double& v);
1001  complex& operator+=(const double& v);
1002  complex& operator-=(const double& v);
1003  complex& operator*=(const double& v);
1004  complex& operator/=(const double& v);
1007  complex& operator+=(const complex& z);
1013  const alglib_impl::ae_complex* c_ptr() const;
1015  std::string tostring(int dps) const;
1016 
1017  double x, y;
1018 };
1021 const bool operator==(const alglib::complex& lhs, const alglib::complex& rhs);
1022 const bool operator!=(const alglib::complex& lhs, const alglib::complex& rhs);
1026 const alglib::complex operator+(const alglib::complex& lhs, const double& rhs);
1027 const alglib::complex operator+(const double& lhs, const alglib::complex& rhs);
1029 const alglib::complex operator-(const alglib::complex& lhs, const double& rhs);
1030 const alglib::complex operator-(const double& lhs, const alglib::complex& rhs);
1032 const alglib::complex operator*(const alglib::complex& lhs, const double& rhs);
1033 const alglib::complex operator*(const double& lhs, const alglib::complex& rhs);
1034 const alglib::complex operator/(const alglib::complex& lhs, const alglib::complex& rhs);
1035 const alglib::complex operator/(const double& lhs, const alglib::complex& rhs);
1036 const alglib::complex operator/(const alglib::complex& lhs, const double& rhs);
1037 double abscomplex(const alglib::complex &z);
1041 
1042 /********************************************************************
1043 Level 1 BLAS functions
1044 
1045 NOTES:
1046 * destination and source should NOT overlap
1047 * stride is assumed to be positive, but it is not
1048  assert'ed within function
1049 * conj_src parameter specifies whether complex source is conjugated
1050  before processing or not. Pass string which starts with 'N' or 'n'
1051  ("No conj", for example) to use unmodified parameter. All other
1052  values will result in conjugation of input, but it is recommended
1053  to use "Conj" in such cases.
1054 ********************************************************************/
1055 double vdotproduct(const double *v0, ae_int_t stride0, const double *v1, ae_int_t stride1, ae_int_t n);
1056 double vdotproduct(const double *v1, const double *v2, ae_int_t N);
1057 
1058 alglib::complex vdotproduct(const alglib::complex *v0, ae_int_t stride0, const char *conj0, const alglib::complex *v1, ae_int_t stride1, const char *conj1, ae_int_t n);
1060 
1061 void vmove(double *vdst, ae_int_t stride_dst, const double* vsrc, ae_int_t stride_src, ae_int_t n);
1062 void vmove(double *vdst, const double* vsrc, ae_int_t N);
1063 
1064 void vmove(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex* vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n);
1065 void vmove(alglib::complex *vdst, const alglib::complex* vsrc, ae_int_t N);
1066 
1067 void vmoveneg(double *vdst, ae_int_t stride_dst, const double* vsrc, ae_int_t stride_src, ae_int_t n);
1068 void vmoveneg(double *vdst, const double *vsrc, ae_int_t N);
1069 
1070 void vmoveneg(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex* vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n);
1071 void vmoveneg(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N);
1072 
1073 void vmove(double *vdst, ae_int_t stride_dst, const double* vsrc, ae_int_t stride_src, ae_int_t n, double alpha);
1074 void vmove(double *vdst, const double *vsrc, ae_int_t N, double alpha);
1075 
1076 void vmove(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex* vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, double alpha);
1077 void vmove(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N, double alpha);
1078 
1079 void vmove(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex* vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, alglib::complex alpha);
1080 void vmove(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N, alglib::complex alpha);
1081 
1082 void vadd(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n);
1083 void vadd(double *vdst, const double *vsrc, ae_int_t N);
1084 
1085 void vadd(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n);
1086 void vadd(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N);
1087 
1088 void vadd(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n, double alpha);
1089 void vadd(double *vdst, const double *vsrc, ae_int_t N, double alpha);
1090 
1091 void vadd(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, double alpha);
1092 void vadd(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N, double alpha);
1093 
1094 void vadd(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, alglib::complex alpha);
1095 void vadd(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N, alglib::complex alpha);
1096 
1097 void vsub(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n);
1098 void vsub(double *vdst, const double *vsrc, ae_int_t N);
1099 
1100 void vsub(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n);
1101 void vsub(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N);
1102 
1103 void vsub(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n, double alpha);
1104 void vsub(double *vdst, const double *vsrc, ae_int_t N, double alpha);
1105 
1106 void vsub(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, double alpha);
1107 void vsub(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N, double alpha);
1108 
1109 void vsub(alglib::complex *vdst, ae_int_t stride_dst, const alglib::complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, alglib::complex alpha);
1110 void vsub(alglib::complex *vdst, const alglib::complex *vsrc, ae_int_t N, alglib::complex alpha);
1111 
1112 void vmul(double *vdst, ae_int_t stride_dst, ae_int_t n, double alpha);
1113 void vmul(double *vdst, ae_int_t N, double alpha);
1114 
1115 void vmul(alglib::complex *vdst, ae_int_t stride_dst, ae_int_t n, double alpha);
1116 void vmul(alglib::complex *vdst, ae_int_t N, double alpha);
1117 
1118 void vmul(alglib::complex *vdst, ae_int_t stride_dst, ae_int_t n, alglib::complex alpha);
1120 
1121 
1122 
1123 /********************************************************************
1124 string conversion functions !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
1125 ********************************************************************/
1126 
1127 /********************************************************************
1128 1- and 2-dimensional arrays
1129 ********************************************************************/
1131 {
1132 public:
1134  virtual ~ae_vector_wrapper();
1135 
1136  void setlength(ae_int_t iLen);
1137  ae_int_t length() const;
1139  void attach_to(alglib_impl::ae_vector *ptr);
1143 private:
1146 protected:
1147  //
1148  // Copies source vector RHS into current object.
1149  //
1150  // Current object is considered empty (this function should be
1151  // called from copy constructor).
1152  //
1153  void create(const ae_vector_wrapper &rhs);
1154 
1155  //
1156  // Copies array given by string into current object. Additional
1157  // parameter DATATYPE contains information about type of the data
1158  // in S and type of the array to create.
1159  //
1160  // Current object is considered empty (this function should be
1161  // called from copy constructor).
1162  //
1163  void create(const char *s, alglib_impl::ae_datatype datatype);
1164 
1165  //
1166  // Assigns RHS to current object.
1167  //
1168  // It has several branches depending on target object status:
1169  // * in case it is proxy object, data are copied into memory pointed by
1170  // proxy. Function checks that source has exactly same size as target
1171  // (exception is thrown on failure).
1172  // * in case it is non-proxy object, data allocated by object are cleared
1173  // and a copy of RHS is created in target.
1174  //
1175  // NOTE: this function correctly handles assignments of the object to itself.
1176  //
1177  void assign(const ae_vector_wrapper &rhs);
1178 
1181 };
1182 
1185 public:
1187  boolean_1d_array(const char *s);
1191  virtual ~boolean_1d_array() ;
1192 
1193  const ae_bool& operator()(ae_int_t i) const;
1195 
1196  const ae_bool& operator[](ae_int_t i) const;
1198 
1199  void setcontent(ae_int_t iLen, const bool *pContent );
1201  const ae_bool* getcontent() const;
1202 
1203  std::string tostring() const;
1204 };
1205 
1207 {
1208 public:
1210  integer_1d_array(const char *s);
1215 
1216  const ae_int_t& operator()(ae_int_t i) const;
1218 
1219  const ae_int_t& operator[](ae_int_t i) const;
1221 
1222  void setcontent(ae_int_t iLen, const ae_int_t *pContent );
1223 
1225  const ae_int_t* getcontent() const;
1226 
1227  std::string tostring() const;
1228 };
1229 
1231 {
1232 public:
1234  real_1d_array(const char *s);
1238  virtual ~real_1d_array();
1239 
1240  const double& operator()(ae_int_t i) const;
1241  double& operator()(ae_int_t i);
1242 
1243  const double& operator[](ae_int_t i) const;
1244  double& operator[](ae_int_t i);
1245 
1246  void setcontent(ae_int_t iLen, const double *pContent );
1247  double* getcontent();
1248  const double* getcontent() const;
1249 
1250  std::string tostring(int dps) const;
1251 };
1252 
1254 {
1255 public:
1257  complex_1d_array(const char *s);
1262 
1265 
1268 
1269  void setcontent(ae_int_t iLen, const alglib::complex *pContent );
1271  const alglib::complex* getcontent() const;
1272 
1273  std::string tostring(int dps) const;
1274 };
1275 
1277 {
1278 public:
1282 
1284  ae_int_t rows() const;
1285  ae_int_t cols() const;
1286  bool isempty() const;
1288 
1293 private:
1295 protected:
1296  //
1297  // Copies source matrix RHS into current object.
1298  //
1299  // Current object is considered empty (this function should be
1300  // called from copy constructor).
1301  //
1302  void create(const ae_matrix_wrapper &rhs);
1303 
1304  //
1305  // Copies array given by string into current object. Additional
1306  // parameter DATATYPE contains information about type of the data
1307  // in S and type of the array to create.
1308  //
1309  // Current object is considered empty (this function should be
1310  // called from copy constructor).
1311  //
1312  void create(const char *s, alglib_impl::ae_datatype datatype);
1313 
1314  //
1315  // Assigns RHS to current object.
1316  //
1317  // It has several branches depending on target object status:
1318  // * in case it is proxy object, data are copied into memory pointed by
1319  // proxy. Function checks that source has exactly same size as target
1320  // (exception is thrown on failure).
1321  // * in case it is non-proxy object, data allocated by object are cleared
1322  // and a copy of RHS is created in target.
1323  //
1324  // NOTE: this function correctly handles assignments of the object to itself.
1325  //
1326  void assign(const ae_matrix_wrapper &rhs);
1327 
1330 };
1331 
1333 {
1334 public:
1338  boolean_2d_array(const char *s);
1340 
1341  const ae_bool& operator()(ae_int_t i, ae_int_t j) const;
1343 
1344  const ae_bool* operator[](ae_int_t i) const;
1346 
1347  void setcontent(ae_int_t irows, ae_int_t icols, const bool *pContent );
1348 
1349  std::string tostring() const ;
1350 };
1351 
1353 {
1354 public:
1358  integer_2d_array(const char *s);
1360 
1361  const ae_int_t& operator()(ae_int_t i, ae_int_t j) const;
1363 
1364  const ae_int_t* operator[](ae_int_t i) const;
1366 
1367  void setcontent(ae_int_t irows, ae_int_t icols, const ae_int_t *pContent );
1368 
1369  std::string tostring() const;
1370 };
1371 
1373 {
1374 public:
1378  real_2d_array(const char *s);
1379  virtual ~real_2d_array();
1380 
1381  const double& operator()(ae_int_t i, ae_int_t j) const;
1383 
1384  const double* operator[](ae_int_t i) const;
1385  double* operator[](ae_int_t i);
1386 
1387  void setcontent(ae_int_t irows, ae_int_t icols, const double *pContent );
1388 
1389  std::string tostring(int dps) const;
1390 };
1391 
1393 {
1394 public:
1398  complex_2d_array(const char *s);
1400 
1403 
1406 
1407  void setcontent(ae_int_t irows, ae_int_t icols, const alglib::complex *pContent );
1408 
1409  std::string tostring(int dps) const;
1410 };
1411 
1412 /********************************************************************
1413 CSV operations: reading CSV file to real matrix.
1414 
1415 This function reads CSV file and stores its contents to double
1416 precision 2D array. Format of the data file must conform to RFC 4180
1417 specification, with additional notes:
1418 * file size should be less than 2GB
1419 * ASCI encoding, UTF-8 without BOM (in header names) are supported
1420 * any character (comma/tab/space) may be used as field separator, as
1421  long as it is distinct from one used for decimal point
1422 * multiple subsequent field separators (say, two spaces) are treated
1423  as MULTIPLE separators, not one big separator
1424 * both comma and full stop may be used as decimal point. Parser will
1425  automatically determine specific character being used. Both fixed
1426  and exponential number formats are allowed. Thousand separators
1427  are NOT allowed.
1428 * line may end with \n (Unix style) or \r\n (Windows style), parser
1429  will automatically adapt to chosen convention
1430 * escaped fields (ones in double quotes) are not supported
1431 
1432 INPUT PARAMETERS:
1433  filename relative/absolute path
1434  separator character used to separate fields. May be ' ',
1435  ',', '\t'. Other separators are possible too.
1436  flags several values combined with bitwise OR:
1437  * alglib::CSV_SKIP_HEADERS - if present, first row
1438  contains headers and will be skipped. Its
1439  contents is used to determine fields count, and
1440  that's all.
1441  If no flags are specified, default value 0x0 (or
1442  alglib::CSV_DEFAULT, which is same) should be used.
1443 
1444 OUTPUT PARAMETERS:
1445  out 2D matrix, CSV file parsed with atof()
1446 
1447 HANDLING OF SPECIAL CASES:
1448 * file does not exist - alglib::ap_error exception is thrown
1449 * empty file - empty array is returned (no exception)
1450 * skip_first_row=true, only one row in file - empty array is returned
1451 * field contents is not recognized by atof() - field value is replaced
1452  by 0.0
1453 ********************************************************************/
1454 void read_csv(const char *filename, char separator, int flags, alglib::real_2d_array &out);
1455 
1456 
1457 /********************************************************************
1458 dataset information.
1459 
1460 can store regression dataset, classification dataset, or non-labeled
1461 task:
1462 * nout==0 means non-labeled task (clustering, for example)
1463 * nout>0 && nclasses==0 means regression task
1464 * nout>0 && nclasses>0 means classification task
1465 ********************************************************************/
1466 /*class dataset
1467 {
1468 public:
1469  dataset():nin(0), nout(0), nclasses(0), trnsize(0), valsize(0), tstsize(0), totalsize(0){};
1470 
1471  int nin, nout, nclasses;
1472 
1473  int trnsize;
1474  int valsize;
1475  int tstsize;
1476  int totalsize;
1477 
1478  alglib::real_2d_array trn;
1479  alglib::real_2d_array val;
1480  alglib::real_2d_array tst;
1481  alglib::real_2d_array all;
1482 };
1483 
1484 bool opendataset(std::string file, dataset *pdataset);
1485 
1486 //
1487 // internal functions
1488 //
1489 std::string strtolower(const std::string &s);
1490 bool readstrings(std::string file, std::list<std::string> *pOutput);
1491 bool readstrings(std::string file, std::list<std::string> *pOutput, std::string comment);
1492 void explodestring(std::string s, char sep, std::vector<std::string> *pOutput);
1493 std::string xtrim(std::string s);*/
1494 
1495 /********************************************************************
1496 Constants and functions introduced for compatibility with AlgoPascal
1497 ********************************************************************/
1498 extern const double machineepsilon;
1499 extern const double maxrealnumber;
1500 extern const double minrealnumber;
1501 extern const double fp_nan;
1502 extern const double fp_posinf;
1503 extern const double fp_neginf;
1504 extern const ae_int_t endianness;
1505 static const int CSV_DEFAULT = 0x0;
1506 static const int CSV_SKIP_HEADERS = 0x1;
1507 
1508 int sign(double x);
1509 double randomreal();
1511 int round(double x);
1512 int trunc(double x);
1513 int ifloor(double x);
1514 int iceil(double x);
1515 double pi();
1516 double sqr(double x);
1517 int maxint(int m1, int m2);
1518 int minint(int m1, int m2);
1519 double maxreal(double m1, double m2);
1520 double minreal(double m1, double m2);
1521 
1522 bool fp_eq(double v1, double v2);
1523 bool fp_neq(double v1, double v2);
1524 bool fp_less(double v1, double v2);
1525 bool fp_less_eq(double v1, double v2);
1526 bool fp_greater(double v1, double v2);
1527 bool fp_greater_eq(double v1, double v2);
1528 
1529 bool fp_isnan(double x);
1530 bool fp_isposinf(double x);
1531 bool fp_isneginf(double x);
1532 bool fp_isinf(double x);
1533 bool fp_isfinite(double x);
1534 
1535 
1536 }//namespace alglib
1537 
1538 
1540 //
1541 // THIS SECTIONS CONTAINS DECLARATIONS FOR OPTIMIZED LINEAR ALGEBRA CODES
1542 // IT IS SHARED BETWEEN C++ AND PURE C LIBRARIES
1543 //
1545 
1546 namespace alglib_impl
1547 {
1548 #define ALGLIB_INTERCEPTS_ABLAS
1549 void _ialglib_vzero(ae_int_t n, double *p, ae_int_t stride);
1551 void _ialglib_vcopy(ae_int_t n, const double *a, ae_int_t stridea, double *b, ae_int_t strideb);
1552 void _ialglib_vcopy_complex(ae_int_t n, const ae_complex *a, ae_int_t stridea, double *b, ae_int_t strideb, const char *conj);
1553 void _ialglib_vcopy_dcomplex(ae_int_t n, const double *a, ae_int_t stridea, double *b, ae_int_t strideb, const char *conj);
1554 void _ialglib_mcopyblock(ae_int_t m, ae_int_t n, const double *a, ae_int_t op, ae_int_t stride, double *b);
1555 void _ialglib_mcopyunblock(ae_int_t m, ae_int_t n, const double *a, ae_int_t op, double *b, ae_int_t stride);
1556 void _ialglib_mcopyblock_complex(ae_int_t m, ae_int_t n, const ae_complex *a, ae_int_t op, ae_int_t stride, double *b);
1557 void _ialglib_mcopyunblock_complex(ae_int_t m, ae_int_t n, const double *a, ae_int_t op, ae_complex* b, ae_int_t stride);
1558 
1560  ae_int_t n,
1561  ae_int_t k,
1562  double alpha,
1563  ae_matrix *a,
1564  ae_int_t ia,
1565  ae_int_t ja,
1566  ae_int_t optypea,
1567  ae_matrix *b,
1568  ae_int_t ib,
1569  ae_int_t jb,
1570  ae_int_t optypeb,
1571  double beta,
1572  ae_matrix *c,
1573  ae_int_t ic,
1574  ae_int_t jc);
1576  ae_int_t n,
1577  ae_int_t k,
1578  ae_complex alpha,
1579  ae_matrix *a,
1580  ae_int_t ia,
1581  ae_int_t ja,
1582  ae_int_t optypea,
1583  ae_matrix *b,
1584  ae_int_t ib,
1585  ae_int_t jb,
1586  ae_int_t optypeb,
1587  ae_complex beta,
1588  ae_matrix *c,
1589  ae_int_t ic,
1590  ae_int_t jc);
1592  ae_int_t n,
1593  ae_matrix *a,
1594  ae_int_t i1,
1595  ae_int_t j1,
1596  ae_bool isupper,
1597  ae_bool isunit,
1598  ae_int_t optype,
1599  ae_matrix *x,
1600  ae_int_t i2,
1601  ae_int_t j2);
1603  ae_int_t n,
1604  ae_matrix *a,
1605  ae_int_t i1,
1606  ae_int_t j1,
1607  ae_bool isupper,
1608  ae_bool isunit,
1609  ae_int_t optype,
1610  ae_matrix *x,
1611  ae_int_t i2,
1612  ae_int_t j2);
1614  ae_int_t n,
1615  ae_matrix *a,
1616  ae_int_t i1,
1617  ae_int_t j1,
1618  ae_bool isupper,
1619  ae_bool isunit,
1620  ae_int_t optype,
1621  ae_matrix *x,
1622  ae_int_t i2,
1623  ae_int_t j2);
1625  ae_int_t n,
1626  ae_matrix *a,
1627  ae_int_t i1,
1628  ae_int_t j1,
1629  ae_bool isupper,
1630  ae_bool isunit,
1631  ae_int_t optype,
1632  ae_matrix *x,
1633  ae_int_t i2,
1634  ae_int_t j2);
1636  ae_int_t k,
1637  double alpha,
1638  ae_matrix *a,
1639  ae_int_t ia,
1640  ae_int_t ja,
1641  ae_int_t optypea,
1642  double beta,
1643  ae_matrix *c,
1644  ae_int_t ic,
1645  ae_int_t jc,
1646  ae_bool isupper);
1648  ae_int_t k,
1649  double alpha,
1650  ae_matrix *a,
1651  ae_int_t ia,
1652  ae_int_t ja,
1653  ae_int_t optypea,
1654  double beta,
1655  ae_matrix *c,
1656  ae_int_t ic,
1657  ae_int_t jc,
1658  ae_bool isupper);
1660  ae_int_t n,
1661  ae_matrix *a,
1662  ae_int_t ia,
1663  ae_int_t ja,
1664  ae_vector *u,
1665  ae_int_t uoffs,
1666  ae_vector *v,
1667  ae_int_t voffs);
1669  ae_int_t n,
1670  ae_matrix *a,
1671  ae_int_t ia,
1672  ae_int_t ja,
1673  ae_vector *u,
1674  ae_int_t uoffs,
1675  ae_vector *v,
1676  ae_int_t voffs);
1677 
1678 
1679 
1680 }
1681 
1682 
1684 //
1685 // THIS SECTION CONTAINS PARALLEL SUBROUTINES
1686 //
1688 
1689 namespace alglib_impl
1690 {
1691 
1692 }
1693 
1694 
1695 #endif
1696 
integer_2d_array(const integer_2d_array &rhs)
ae_bool ae_fp_greater_eq(double v1, double v2)
ae_bool ae_isneginf_stateless(double x, ae_int_t endianness)
static void make_assertion(bool bClause)
complex & operator+=(const double &v)
ae_bool ae_isfinite_stateless(double x, ae_int_t endianness)
ae_complex ae_c_sub_d(ae_complex lhs, double rhs)
const double fp_nan
double & operator()(ae_int_t i)
ae_int_t entries_needed
Definition: ap.h:452
ae_bool & operator()(ae_int_t i)
int maxint(int m1, int m2)
complex & operator-=(const double &v)
ae_dyn_block data
Definition: ap.h:522
int minint(int m1, int m2)
ae_complex ae_c_div_d(ae_complex lhs, double rhs)
ae_int_t cols
Definition: ap.h:511
@ OWN_CALLER
Definition: ap.h:213
ae_bool is_attached
Definition: ap.h:520
void read_csv(const char *filename, char separator, int flags, alglib::real_2d_array &out)
integer_1d_array(const integer_1d_array &rhs)
complex_1d_array(const complex_1d_array &rhs)
ae_bool is_dynamic
Definition: ap.h:547
int trunc(double x)
void setcontent(ae_int_t iLen, const double *pContent)
ae_int_t entries_saved
Definition: ap.h:453
void ae_serializer_serialize_bool(ae_serializer *serializer, ae_bool v, ae_state *state)
ae_shared_pool_entry *volatile enumeration_counter
Definition: ap.h:616
#define ALIGNED
Definition: ap.h:80
const double fp_neginf
ae_int_t cnt
Definition: ap.h:473
void ae_shared_pool_clear_recycled(ae_shared_pool *pool, ae_state *state)
alglib_impl::ae_matrix mat
Definition: ap.h:1329
boolean_2d_array(const boolean_2d_array &rhs)
void _rcommstate_clear(rcommstate *p)
ae_bool ae_is_symmetric(ae_matrix *a)
ae_bool ae_matrix_set_length(ae_matrix *dst, ae_int_t rows, ae_int_t cols, ae_state *state)
std::string tostring() const
void ae_x_set_vector(x_vector *dst, ae_vector *src, ae_state *state)
void ae_free_lock(ae_lock *lock)
void ae_shared_pool_init_copy(void *_dst, void *_src, ae_state *state)
const ae_int_t * operator[](ae_int_t i) const
std::string tostring(int dps) const
double ae_tan(double x, ae_state *state)
double ae_c_abs(ae_complex z, ae_state *state)
ae_int_t & operator()(ae_int_t i)
const real_1d_array & operator=(const real_1d_array &rhs)
double ae_sqr(double x, ae_state *state)
const double maxrealnumber
void aligned_free(void *block)
void *volatile obj
Definition: ap.h:589
void ae_swap_matrices(ae_matrix *mat1, ae_matrix *mat2)
ae_int_t ae_trunc(double x, ae_state *state)
const ae_bool & operator()(ae_int_t i, ae_int_t j) const
const complex_1d_array & operator=(const complex_1d_array &rhs)
struct alglib_impl::ae_shared_pool ae_shared_pool
double v_neginf
Definition: ap.h:368
alglib::complex csqr(const alglib::complex &z)
void ae_v_cmove(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n)
const alglib::complex * operator[](ae_int_t i) const
double v_nan
Definition: ap.h:358
ae_complex ae_c_div(ae_complex lhs, ae_complex rhs)
const ae_int_t & operator[](ae_int_t i) const
ae_datatype datatype
Definition: ap.h:478
void _ialglib_vcopy_dcomplex(ae_int_t n, const double *a, ae_int_t stridea, double *b, ae_int_t strideb, const char *conj)
void ae_v_csubd(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, double alpha)
void init()
Before using conceptspy make sure to call this routine.
boolean_2d_array(alglib_impl::ae_matrix *p)
const alglib::complex operator*(const alglib::complex &lhs, const alglib::complex &rhs)
double ae_randomreal(ae_state *state)
bool fp_isnan(double x)
ae_int_t size_of_object
Definition: ap.h:619
ae_error_type volatile last_error
Definition: ap.h:387
const alglib::complex & operator()(ae_int_t i, ae_int_t j) const
void ae_smart_ptr_assign(ae_smart_ptr *dst, void *new_ptr, ae_bool is_owner, ae_bool is_dynamic, void(*destroy)(void *))
void vadd(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n)
const alglib::complex operator+(const alglib::complex &lhs)
@ OWN_AE
Definition: ap.h:213
ae_bool & operator()(ae_int_t i, ae_int_t j)
double * p_double
Definition: ap.h:503
ae_complex ae_c_sqr(ae_complex lhs, ae_state *state)
std::string * out_cppstr
Definition: ap.h:458
void create(const char *s, alglib_impl::ae_datatype datatype)
void ae_x_set_matrix(x_matrix *dst, ae_matrix *src, ae_state *state)
double ae_sin(double x, ae_state *state)
int ae_int32_t
Definition: ap.h:165
ae_int_t rows() const
struct alglib_impl::rcommstate rcommstate
void _ialglib_mcopyblock_complex(ae_int_t m, ae_int_t n, const ae_complex *a, ae_int_t op, ae_int_t stride, double *b)
struct alglib_impl::ae_dyn_block ae_dyn_block
double ae_cos(double x, ae_state *state)
ae_int_t getstride() const
double ** pp_double
Definition: ap.h:529
ae_int_t ae_serializer_get_alloc_size(ae_serializer *serializer)
ae_complex ae_c_sub(ae_complex lhs, ae_complex rhs)
const double & operator()(ae_int_t i, ae_int_t j) const
void ae_v_move(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n)
std::string tostring() const
ae_int_t length() const
ae_dyn_block frame_entry
Definition: ap.h:631
const ae_bool & operator[](ae_int_t i) const
const bool operator==(const alglib::complex &lhs, const alglib::complex &rhs)
void setcontent(ae_int_t irows, ae_int_t icols, const alglib::complex *pContent)
ae_bool ae_isneginf(double x, ae_state *state)
ae_int_t bytes_written
Definition: ap.h:455
void * ae_malloc(size_t size, ae_state *state)
ae_bool x_force_symmetric(x_matrix *a)
alglib_impl::ae_matrix * p_mat
Definition: ap.h:1328
ae_int_t ae_misalignment(const void *ptr, size_t alignment)
boolean_1d_array(const boolean_1d_array &rhs)
ae_bool ae_c_neq(ae_complex lhs, ae_complex rhs)
ae_complex ae_v_cdotproduct(const ae_complex *v0, ae_int_t stride0, const char *conj0, const ae_complex *v1, ae_int_t stride1, const char *conj1, ae_int_t n)
const double & operator()(ae_int_t i) const
bool fp_isposinf(double x)
const double * operator[](ae_int_t i) const
ae_bool ae_fp_less_eq(double v1, double v2)
void setcontent(ae_int_t iLen, const ae_int_t *pContent)
double ae_v_dotproduct(const double *v0, ae_int_t stride0, const double *v1, ae_int_t stride1, ae_int_t n)
double minreal(double m1, double m2)
ae_bool ae_isposinf_stateless(double x, ae_int_t endianness)
void(* destroy)(void *ptr)
Definition: ap.h:628
double abscomplex(const alglib::complex &z)
complex & operator=(const double &v)
void ** subscriber
Definition: ap.h:537
ae_bool ae_vector_set_length(ae_vector *dst, ae_int_t newsize, ae_state *state)
void ae_db_swap(ae_dyn_block *block1, ae_dyn_block *block2)
void ae_vector_init_copy(ae_vector *dst, ae_vector *src, ae_state *state)
void ae_x_attach_to_vector(x_vector *dst, ae_vector *src)
ae_vector ra
Definition: ap.h:919
struct alglib_impl::ae_smart_ptr ae_smart_ptr
ae_int_t ae_get_endianness()
complex_2d_array(const complex_2d_array &rhs)
union alglib_impl::ae_vector::@4 ptr
void(* destroy)(void *)
Definition: ap.h:550
const double & operator[](ae_int_t i) const
bool fp_isneginf(double x)
ae_bool ae_isposinf(double x, ae_state *state)
struct alglib_impl::ae_frame ae_frame
void attach_to(alglib_impl::ae_vector *ptr)
void ae_shared_pool_recycle(ae_shared_pool *pool, ae_smart_ptr *pptr, ae_state *state)
const ae_int_t & operator()(ae_int_t i, ae_int_t j) const
ae_bool ae_c_neq_d(ae_complex lhs, double rhs)
const ae_vector_wrapper & operator=(const ae_vector_wrapper &rhs)
void ae_frame_make(ae_state *state, ae_frame *tmp)
alglib::complex & operator()(ae_int_t i, ae_int_t j)
ae_bool ae_fp_eq(double v1, double v2)
void ae_v_moved(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n, double alpha)
alglib::complex & operator()(ae_int_t i)
void ae_matrix_destroy(ae_matrix *dst)
void ae_matrix_init_copy(ae_matrix *dst, ae_matrix *src, ae_state *state)
void ae_acquire_lock(ae_lock *lock)
alglib::complex conj(const alglib::complex &z)
bool fp_less_eq(double v1, double v2)
const ae_int_t endianness
ae_int_t & operator[](ae_int_t i)
std::string tostring(int dps) const
ae_int_t endianness
Definition: ap.h:353
double * operator[](ae_int_t i)
double ae_atan2(double y, double x, ae_state *state)
ae_int_t ** pp_int
Definition: ap.h:528
void setlength(ae_int_t iLen)
integer_1d_array(alglib_impl::ae_vector *p)
void ae_swap_vectors(ae_vector *vec1, ae_vector *vec2)
ae_bool ** pp_bool
Definition: ap.h:527
ae_int_t bytes_asked
Definition: ap.h:454
void allocate_own(ae_int_t rows, ae_int_t cols, alglib_impl::ae_datatype datatype)
@ ERR_ASSERTION_FAILED
Definition: ap.h:205
bool fp_neq(double v1, double v2)
void ae_vector_clear(ae_vector *dst)
ae_complex ae_c_add(ae_complex lhs, ae_complex rhs)
void ae_assert(ae_bool cond, const char *msg, ae_state *state)
void ae_smart_ptr_release(ae_smart_ptr *dst)
void ae_smart_ptr_init(ae_smart_ptr *dst, void **subscriber, ae_state *state)
const double machineepsilon
ae_bool _use_alloc_counter
ae_int_t ae_v_len(ae_int_t a, ae_int_t b)
const alglib::complex & operator()(ae_int_t i) const
integer_1d_array(const char *s)
complex_1d_array(const char *s)
ae_bool ae_shared_pool_is_initialized(void *_dst)
ae_int_t ae_sizeof(ae_datatype datatype)
real_1d_array(alglib_impl::ae_vector *p)
#define ae_bool
Definition: ap.h:193
std::string msg
Definition: ap.h:982
double ae_asin(double x, ae_state *state)
bool fp_less(double v1, double v2)
ae_vector ca
Definition: ap.h:920
void ae_v_csub(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n)
alglib_impl::ae_complex * c_ptr()
@ ACT_NEW_LOCATION
Definition: ap.h:214
ae_bool ae_c_eq(ae_complex lhs, ae_complex rhs)
ae_bool * p_bool
Definition: ap.h:501
void ae_v_cmulc(ae_complex *vdst, ae_int_t stride_dst, ae_int_t n, ae_complex alpha)
double ae_cosh(double x, ae_state *state)
void ae_vector_destroy(ae_vector *dst)
void ae_serializer_serialize_int(ae_serializer *serializer, ae_int_t v, ae_state *state)
ae_complex ae_c_mul(ae_complex lhs, ae_complex rhs)
ae_bool ae_fp_neq(double v1, double v2)
void *volatile ptr
Definition: ap.h:341
double ae_tanh(double x, ae_state *state)
const ae_bool * getcontent() const
ae_bool ae_isnan(double x, ae_state *state)
double & operator[](ae_int_t i)
void x_vector_clear(x_vector *dst)
void setcontent(ae_int_t irows, ae_int_t icols, const ae_int_t *pContent)
@ DT_BOOL
Definition: ap.h:215
const alglib::complex operator-(const alglib::complex &lhs)
void ae_v_muld(double *vdst, ae_int_t stride_dst, ae_int_t n, double alpha)
ae_shared_pool_entry *volatile recycled_entries
Definition: ap.h:613
ae_complex ae_c_mul_d(ae_complex lhs, double rhs)
alglib_impl::ae_vector * p_vec
Definition: ap.h:1183
int round(double x)
ae_bool ae_force_symmetric(ae_matrix *a)
void ae_serializer_unserialize_bool(ae_serializer *serializer, ae_bool *v, ae_state *state)
double ae_fabs(double x, ae_state *state)
ae_error_type
Definition: ap.h:201
ae_bool _ialglib_i_cmatrixrank1f(ae_int_t m, ae_int_t n, ae_matrix *a, ae_int_t ia, ae_int_t ja, ae_vector *u, ae_int_t uoffs, ae_vector *v, ae_int_t voffs)
void ae_v_add(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n)
void(* thread_exception_handler)(void *)
Definition: ap.h:406
void setnworkers(alglib::ae_int_t nworkers)
void setcontent(ae_int_t irows, ae_int_t icols, const bool *pContent)
double vdotproduct(const double *v0, ae_int_t stride0, const double *v1, ae_int_t stride1, ae_int_t n)
integer_2d_array(alglib_impl::ae_matrix *p)
ae_bool ae_isnan_stateless(double x, ae_int_t endianness)
void ae_serializer_clear(ae_serializer *serializer)
void ae_break(ae_state *state, ae_error_type error_type, const char *msg)
void ae_init_lock(ae_lock *lock)
ae_bool ae_isinf(double x, ae_state *state)
void ae_v_csubc(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, ae_complex alpha)
void _ialglib_mcopyblock(ae_int_t m, ae_int_t n, const double *a, ae_int_t op, ae_int_t stride, double *b)
const double * getcontent() const
real_2d_array(const char *s)
ae_int_t ae_datatype
Definition: ap.h:208
ae_bool ae_fp_less(double v1, double v2)
ae_int_t & operator()(ae_int_t i, ae_int_t j)
struct alglib_impl::ae_vector ae_vector
void ae_v_caddd(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, double alpha)
void *volatile next_entry
Definition: ap.h:590
void _rcommstate_destroy(rcommstate *p)
alglib::complex * operator[](ae_int_t i)
const alglib_impl::ae_vector * c_ptr() const
void * worker_thread
Definition: ap.h:404
ae_bool _ialglib_i_rmatrixrank1f(ae_int_t m, ae_int_t n, ae_matrix *a, ae_int_t ia, ae_int_t ja, ae_vector *u, ae_int_t uoffs, ae_vector *v, ae_int_t voffs)
void ae_state_clear(ae_state *state)
ae_int_t ae_iceil(double x, ae_state *state)
void ae_smart_ptr_clear(void *_dst)
const alglib::complex operator/(const alglib::complex &lhs, const alglib::complex &rhs)
std::string tostring(int dps) const
ae_complex ae_c_d_div(double lhs, ae_complex rhs)
ae_int_t rows
Definition: ap.h:510
ae_int_t vlen(ae_int_t n1, ae_int_t n2)
void ae_shared_pool_next_recycled(ae_shared_pool *pool, ae_smart_ptr *pptr, ae_state *state)
void _ialglib_vcopy(ae_int_t n, const double *a, ae_int_t stridea, double *b, ae_int_t strideb)
double maxreal(double m1, double m2)
ae_complex ae_complex_from_d(double v)
void ae_v_subd(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n, double alpha)
ae_bool ae_c_eq_d(ae_complex lhs, double rhs)
void ae_v_caddc(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, ae_complex alpha)
integer_2d_array(const char *s)
ae_bool ae_db_malloc(ae_dyn_block *block, ae_int_t size, ae_state *state, ae_bool make_automatic)
@ ERR_OK
Definition: ap.h:202
std::string tostring() const
ae_int_t ae_iabs(ae_int_t x, ae_state *state)
real_2d_array(const real_2d_array &rhs)
@ DT_COMPLEX
Definition: ap.h:215
void ae_v_cadd(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n)
void ae_shared_pool_set_seed(ae_shared_pool *dst, void *seed_object, ae_int_t size_of_object, void(*init)(void *dst, ae_state *state), void(*init_copy)(void *dst, void *src, ae_state *state), void(*destroy)(void *ptr), ae_state *state)
void _ialglib_vcopy_complex(ae_int_t n, const ae_complex *a, ae_int_t stridea, double *b, ae_int_t strideb, const char *conj)
ae_bool x_force_hermitian(x_matrix *a)
@ ERR_XARRAY_TOO_LARGE
Definition: ap.h:204
void ae_db_attach(ae_dyn_block *block, ae_state *state)
void ae_v_addd(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n, double alpha)
ae_bool x_is_symmetric(x_matrix *a)
complex_2d_array(alglib_impl::ae_matrix *p)
void ae_free(void *p)
real_2d_array(alglib_impl::ae_matrix *p)
double ae_log(double x, ae_state *state)
void setcontent(ae_int_t iLen, const alglib::complex *pContent)
void ae_v_cmuld(ae_complex *vdst, ae_int_t stride_dst, ae_int_t n, double alpha)
void ae_yield()
ae_int_t ae_round(double x, ae_state *state)
double ae_maxreal(double m1, double m2, ae_state *state)
void ae_serializer_serialize_double(ae_serializer *serializer, double v, ae_state *state)
void _ialglib_vzero(ae_int_t n, double *p, ae_int_t stride)
ae_bool ae_is_hermitian(ae_matrix *a)
void ae_serializer_unserialize_int(ae_serializer *serializer, ae_int_t *v, ae_state *state)
void setcontent(ae_int_t iLen, const bool *pContent)
@ CPU_SSE2
Definition: ap.h:216
struct alglib_impl::ae_state ae_state
void ae_matrix_attach_to_x(ae_matrix *dst, x_matrix *src, ae_state *state)
ae_int_t ae_randominteger(ae_int_t maxv, ae_state *state)
alglib_impl::ae_int_t ae_int_t
Definition: ap.h:965
struct alglib_impl::ae_shared_pool_entry ae_shared_pool_entry
ae_int_t stream_aux
Definition: ap.h:462
ae_bool is_attached
Definition: ap.h:485
const ae_int_t & operator()(ae_int_t i) const
ae_vector ia
Definition: ap.h:917
ae_bool ae_fp_greater(double v1, double v2)
void ae_matrix_init_from_x(ae_matrix *dst, x_matrix *src, ae_state *state)
void *volatile seed_object
Definition: ap.h:596
double pi()
double ae_acos(double x, ae_state *state)
void vsub(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n)
ae_complex ae_c_add_d(ae_complex lhs, double rhs)
Definition: ap.h:585
void ae_serializer_sstart_stream(ae_serializer *serializer, std::ostream *stream)
signed long long ae_int64_t
Definition: ap.h:180
void * aligned_malloc(size_t size, size_t alignment)
ae_dyn_block *volatile p_top_block
Definition: ap.h:374
real_1d_array(const char *s)
double randomreal()
const bool operator!=(const alglib::complex &lhs, const alglib::complex &rhs)
ae_bool ae_isfinite(double x, ae_state *state)
void attach_to(alglib_impl::ae_matrix *ptr)
ae_bool _ialglib_i_rmatrixrighttrsmf(ae_int_t m, ae_int_t n, ae_matrix *a, ae_int_t i1, ae_int_t j1, ae_bool isupper, ae_bool isunit, ae_int_t optype, ae_matrix *x, ae_int_t i2, ae_int_t j2)
ae_int_t ae_ifloor(double x, ae_state *state)
void ae_serializer_sstart_str(ae_serializer *serializer, std::string *buf)
int sign(double x)
void(* deallocator)(void *)
Definition: ap.h:340
double ae_sinh(double x, ae_state *state)
void ae_state_init(ae_state *state)
void ae_shared_pool_first_recycled(ae_shared_pool *pool, ae_smart_ptr *pptr, ae_state *state)
void * parent_task
Definition: ap.h:405
void assign(const ae_vector_wrapper &rhs)
ae_int_t ae_cpuid()
ae_complex ae_c_neg(ae_complex lhs)
ae_dyn_block data
Definition: ap.h:492
double ae_atan(double x, ae_state *state)
void ae_vector_init(ae_vector *dst, ae_int_t size, ae_datatype datatype, ae_state *state)
void ae_vector_init_from_x(ae_vector *dst, x_vector *src, ae_state *state)
void vmoveneg(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n)
void ae_v_sub(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n)
void _ialglib_vzero_complex(ae_int_t n, ae_complex *p, ae_int_t stride)
@ ACT_SAME_LOCATION
Definition: ap.h:214
ae_dyn_block frame_entry
Definition: ap.h:553
double ae_exp(double x, ae_state *state)
double beta(double a, double b, ae_state *_state)
void ** pp_void
Definition: ap.h:526
void _rcommstate_init_copy(rcommstate *dst, rcommstate *src, ae_state *_state)
bool fp_isinf(double x)
ae_int_t stride
Definition: ap.h:512
bool fp_isfinite(double x)
ae_int_t randominteger(ae_int_t maxv)
@ ERR_OUT_OF_MEMORY
Definition: ap.h:203
void _ialglib_mcopyunblock(ae_int_t m, ae_int_t n, const double *a, ae_int_t op, double *b, ae_int_t stride)
alglib::complex & operator[](ae_int_t i)
complex_2d_array(const char *s)
alglib::complex * getcontent()
double ae_pow(double x, double y, ae_state *state)
void(* init)(void *dst, ae_state *state)
Definition: ap.h:622
void ae_v_cmoveneg(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n)
std::string tostring(int dps) const
int iceil(double x)
struct alglib_impl::ae_matrix ae_matrix
bool fp_eq(double v1, double v2)
ae_complex * p_complex
Definition: ap.h:504
complex & operator/=(const double &v)
double & operator()(ae_int_t i, ae_int_t j)
ae_datatype datatype
Definition: ap.h:513
ae_bool _ialglib_i_cmatrixgemmf(ae_int_t m, ae_int_t n, ae_int_t k, ae_complex alpha, ae_matrix *a, ae_int_t ia, ae_int_t ja, ae_int_t optypea, ae_matrix *b, ae_int_t ib, ae_int_t jb, ae_int_t optypeb, ae_complex beta, ae_matrix *c, ae_int_t ic, ae_int_t jc)
ae_dyn_block last_block
Definition: ap.h:375
const ae_bool & operator()(ae_int_t i) const
ae_int_t * operator[](ae_int_t i)
ae_dyn_block db_marker
Definition: ap.h:342
ae_complex ae_c_d_sub(double lhs, ae_complex rhs)
ae_shared_pool_entry *volatile recycled_objects
Definition: ap.h:604
void ae_shared_pool_init(void *_dst, ae_state *state)
ae_bool _ialglib_i_rmatrixlefttrsmf(ae_int_t m, ae_int_t n, ae_matrix *a, ae_int_t i1, ae_int_t j1, ae_bool isupper, ae_bool isunit, ae_int_t optype, ae_matrix *x, ae_int_t i2, ae_int_t j2)
double v_posinf
Definition: ap.h:363
void ae_release_lock(ae_lock *lock)
double ae_sqrt(double x, ae_state *state)
const ae_matrix_wrapper & operator=(const ae_matrix_wrapper &rhs)
static const int CSV_SKIP_HEADERS
Definition: ap.h:1506
void(* ae_deallocator)(void *)
Definition: ap.h:333
void ae_shared_pool_retrieve(ae_shared_pool *pool, ae_smart_ptr *pptr, ae_state *state)
ae_bool _ialglib_i_rmatrixsyrkf(ae_int_t n, ae_int_t k, double alpha, ae_matrix *a, ae_int_t ia, ae_int_t ja, ae_int_t optypea, double beta, ae_matrix *c, ae_int_t ic, ae_int_t jc, ae_bool isupper)
const double minrealnumber
boolean_1d_array(const char *s)
void ae_v_cmoved(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, double alpha)
void ae_touch_ptr(void *p)
ae_bool ae_isinf_stateless(double x, ae_int_t endianness)
double sqr(double x)
const alglib::complex & operator[](ae_int_t i) const
void assign(const ae_matrix_wrapper &rhs)
ae_int_t ae_minint(ae_int_t m1, ae_int_t m2, ae_state *state)
ae_int64_t _alloc_counter
void setcontent(ae_int_t irows, ae_int_t icols, const double *pContent)
ae_int_t ae_maxint(ae_int_t m1, ae_int_t m2, ae_state *state)
ae_bool ae_db_realloc(ae_dyn_block *block, ae_int_t size, ae_state *state)
const char *volatile error_msg
Definition: ap.h:392
ae_bool ae_force_hermitian(ae_matrix *a)
void ae_serializer_alloc_start(ae_serializer *serializer)
int ifloor(double x)
ae_bool _ialglib_i_cmatrixherkf(ae_int_t n, ae_int_t k, double alpha, ae_matrix *a, ae_int_t ia, ae_int_t ja, ae_int_t optypea, double beta, ae_matrix *c, ae_int_t ic, ae_int_t jc, ae_bool isupper)
void ae_serializer_unserialize_double(ae_serializer *serializer, double *v, ae_state *state)
void allocate_own(ae_int_t size, alglib_impl::ae_datatype datatype)
void ae_shared_pool_destroy(void *dst)
void ae_v_cmovec(ae_complex *vdst, ae_int_t stride_dst, const ae_complex *vsrc, ae_int_t stride_src, const char *conj_src, ae_int_t n, ae_complex alpha)
const alglib_impl::ae_matrix * c_ptr() const
complex_1d_array(alglib_impl::ae_vector *p)
ae_bool _ialglib_i_cmatrixrighttrsmf(ae_int_t m, ae_int_t n, ae_matrix *a, ae_int_t i1, ae_int_t j1, ae_bool isupper, ae_bool isunit, ae_int_t optype, ae_matrix *x, ae_int_t i2, ae_int_t j2)
static const int CSV_DEFAULT
Definition: ap.h:1505
const ae_int_t * getcontent() const
void vmul(double *vdst, ae_int_t stride_dst, ae_int_t n, double alpha)
void(* init_copy)(void *dst, void *src, ae_state *state)
Definition: ap.h:625
const alglib::complex * getcontent() const
@ DT_REAL
Definition: ap.h:215
std::string tostring(int dps) const
real_1d_array(const real_1d_array &rhs)
boolean_2d_array(const char *s)
void ae_db_free(ae_dyn_block *block)
ae_complex ** pp_complex
Definition: ap.h:530
void vmove(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n)
ae_complex ae_complex_from_i(ae_int_t v)
void ae_x_attach_to_matrix(x_matrix *dst, ae_matrix *src)
void ae_serializer_ustart_stream(ae_serializer *serializer, const std::istream *stream)
void ae_serializer_init(ae_serializer *serializer)
struct ae_dyn_block *volatile p_next
Definition: ap.h:338
double ae_minreal(double m1, double m2, ae_state *state)
void ae_shared_pool_clear(void *dst)
std::string tostring() const
char(* ae_stream_reader)(ae_int_t aux, ae_int_t cnt, char *p_buf)
Definition: ap.h:447
void ae_matrix_init(ae_matrix *dst, ae_int_t rows, ae_int_t cols, ae_datatype datatype, ae_state *state)
void create(const ae_vector_wrapper &rhs)
ae_bool & operator[](ae_int_t i)
bool fp_greater_eq(double v1, double v2)
ptrdiff_t ae_int_t
Definition: ap.h:185
alglib_impl::ae_vector vec
Definition: ap.h:1184
complex(const double &_x)
const char * in_str
Definition: ap.h:461
void ae_vector_attach_to_x(ae_vector *dst, x_vector *src, ae_state *state)
ae_stream_reader stream_reader
Definition: ap.h:464
bool fp_greater(double v1, double v2)
ae_int_t * p_int
Definition: ap.h:502
void ae_frame_leave(ae_state *state)
const boolean_1d_array & operator=(const boolean_1d_array &rhs)
ae_vector ba
Definition: ap.h:918
ae_int_t ae_sign(double x, ae_state *state)
const ae_bool * operator[](ae_int_t i) const
void ae_matrix_clear(ae_matrix *dst)
ae_complex ae_c_conj(ae_complex lhs, ae_state *state)
ae_bool _ialglib_i_rmatrixgemmf(ae_int_t m, ae_int_t n, ae_int_t k, double alpha, ae_matrix *a, ae_int_t ia, ae_int_t ja, ae_int_t optypea, ae_matrix *b, ae_int_t ib, ae_int_t jb, ae_int_t optypeb, double beta, ae_matrix *c, ae_int_t ic, ae_int_t jc)
const double fp_posinf
ae_bool * operator[](ae_int_t i)
ae_matrix_wrapper(const ae_matrix_wrapper &rhs)
@ ACT_UNCHANGED
Definition: ap.h:214
void ae_smart_ptr_destroy(void *_dst)
complex & operator*=(const double &v)
void ae_serializer_stop(ae_serializer *serializer, ae_state *state)
void ae_serializer_alloc_entry(ae_serializer *serializer)
void ae_shared_pool_reset(ae_shared_pool *pool, ae_state *state)
ae_int_t cols() const
void ae_serializer_ustart_str(ae_serializer *serializer, const std::string *buf)
union alglib_impl::ae_matrix::@5 ptr
void _ialglib_mcopyunblock_complex(ae_int_t m, ae_int_t n, const double *a, ae_int_t op, ae_complex *b, ae_int_t stride)
boolean_1d_array(alglib_impl::ae_vector *p)
void * ae_align(void *ptr, size_t alignment)
alglib_impl::ae_matrix * c_ptr()
double y
Definition: ap.h:1019
void create(const ae_matrix_wrapper &rhs)
ae_bool _ialglib_i_cmatrixlefttrsmf(ae_int_t m, ae_int_t n, ae_matrix *a, ae_int_t i1, ae_int_t j1, ae_bool isupper, ae_bool isunit, ae_int_t optype, ae_matrix *x, ae_int_t i2, ae_int_t j2)
void setlength(ae_int_t rows, ae_int_t cols)
@ DT_INT
Definition: ap.h:215
void _rcommstate_init(rcommstate *p, ae_state *_state)
ae_stream_writer stream_writer
Definition: ap.h:463
void ae_v_moveneg(double *vdst, ae_int_t stride_dst, const double *vsrc, ae_int_t stride_src, ae_int_t n)
ae_bool x_is_hermitian(x_matrix *a)
char(* ae_stream_writer)(const char *p_string, ae_int_t aux)
Definition: ap.h:446
double x
Definition: ap.h:1019
const integer_1d_array & operator=(const integer_1d_array &rhs)
Page URL: http://wiki.math.ethz.ch/bin/view/Concepts/WebHome
21 August 2020
© 2020 Eidgenössische Technische Hochschule Zürich