| alglibmisc.h | | alglibmisc.h | |
| | | | |
| skipping to change at line 643 | | skipping to change at line 643 | |
| and interactive mode of interpreter. | | and interactive mode of interpreter. | |
| | | | |
| This function allocates new array on each call, so it is significantly | | This function allocates new array on each call, so it is significantly | |
| slower than its 'non-interactive' counterpart, but it is more convenient | | slower than its 'non-interactive' counterpart, but it is more convenient | |
| when you call it from command line. | | when you call it from command line. | |
| | | | |
| -- ALGLIB -- | | -- ALGLIB -- | |
| Copyright 28.02.2010 by Bochkanov Sergey | | Copyright 28.02.2010 by Bochkanov Sergey | |
| *************************************************************************/ | | *************************************************************************/ | |
| void kdtreequeryresultsdistancesi(const kdtree &kdt, real_1d_array &r); | | void kdtreequeryresultsdistancesi(const kdtree &kdt, real_1d_array &r); | |
|
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Counts number of True values in the boolean 1D array. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | ae_int_t xdebugb1count(const boolean_1d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Replace all values in array by NOT(a[i]). | |
| | | Array is passed using "shared" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugb1not(const boolean_1d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Appends copy of array to itself. | |
| | | Array is passed using "var" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugb1appendcopy(boolean_1d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Generate N-element array with even-numbered elements set to True. | |
| | | Array is passed using "out" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugb1outeven(const ae_int_t n, boolean_1d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Returns sum of elements in the array. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | ae_int_t xdebugi1sum(const integer_1d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Replace all values in array by -A[I] | |
| | | Array is passed using "shared" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugi1neg(const integer_1d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Appends copy of array to itself. | |
| | | Array is passed using "var" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugi1appendcopy(integer_1d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Generate N-element array with even-numbered A[I] set to I, and odd-numbered | |
| | | ones set to 0. | |
| | | | |
| | | Array is passed using "out" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugi1outeven(const ae_int_t n, integer_1d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Returns sum of elements in the array. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | double xdebugr1sum(const real_1d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Replace all values in array by -A[I] | |
| | | Array is passed using "shared" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugr1neg(const real_1d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Appends copy of array to itself. | |
| | | Array is passed using "var" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugr1appendcopy(real_1d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Generate N-element array with even-numbered A[I] set to I*0.25, | |
| | | and odd-numbered ones are set to 0. | |
| | | | |
| | | Array is passed using "out" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugr1outeven(const ae_int_t n, real_1d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Returns sum of elements in the array. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | alglib::complex xdebugc1sum(const complex_1d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Replace all values in array by -A[I] | |
| | | Array is passed using "shared" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugc1neg(const complex_1d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Appends copy of array to itself. | |
| | | Array is passed using "var" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugc1appendcopy(complex_1d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Generate N-element array with even-numbered A[K] set to (x,y) = (K*0.25, K* | |
| | | 0.125) | |
| | | and odd-numbered ones are set to 0. | |
| | | | |
| | | Array is passed using "out" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugc1outeven(const ae_int_t n, complex_1d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Counts number of True values in the boolean 2D array. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | ae_int_t xdebugb2count(const boolean_2d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Replace all values in array by NOT(a[i]). | |
| | | Array is passed using "shared" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugb2not(const boolean_2d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Transposes array. | |
| | | Array is passed using "var" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugb2transpose(boolean_2d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Generate MxN matrix with elements set to "Sin(3*I+5*J)>0" | |
| | | Array is passed using "out" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugb2outsin(const ae_int_t m, const ae_int_t n, boolean_2d_array &a | |
| | | ); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Returns sum of elements in the array. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | ae_int_t xdebugi2sum(const integer_2d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Replace all values in array by -a[i,j] | |
| | | Array is passed using "shared" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugi2neg(const integer_2d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Transposes array. | |
| | | Array is passed using "var" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugi2transpose(integer_2d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Generate MxN matrix with elements set to "Sign(Sin(3*I+5*J))" | |
| | | Array is passed using "out" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugi2outsin(const ae_int_t m, const ae_int_t n, integer_2d_array &a | |
| | | ); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Returns sum of elements in the array. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | double xdebugr2sum(const real_2d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Replace all values in array by -a[i,j] | |
| | | Array is passed using "shared" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugr2neg(const real_2d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Transposes array. | |
| | | Array is passed using "var" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugr2transpose(real_2d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Generate MxN matrix with elements set to "Sin(3*I+5*J)" | |
| | | Array is passed using "out" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugr2outsin(const ae_int_t m, const ae_int_t n, real_2d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Returns sum of elements in the array. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | alglib::complex xdebugc2sum(const complex_2d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Replace all values in array by -a[i,j] | |
| | | Array is passed using "shared" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugc2neg(const complex_2d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Transposes array. | |
| | | Array is passed using "var" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugc2transpose(complex_2d_array &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Generate MxN matrix with elements set to "Sin(3*I+5*J),Cos(3*I+5*J)" | |
| | | Array is passed using "out" convention. | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | void xdebugc2outsincos(const ae_int_t m, const ae_int_t n, complex_2d_array | |
| | | &a); | |
| | | | |
| | | /************************************************************************* | |
| | | This is debug function intended for testing ALGLIB interface generator. | |
| | | Never use it in any real life project. | |
| | | | |
| | | Returns sum of a[i,j]*(1+b[i,j]) such that c[i,j] is True | |
| | | | |
| | | -- ALGLIB -- | |
| | | Copyright 11.10.2013 by Bochkanov Sergey | |
| | | *************************************************************************/ | |
| | | double xdebugmaskedbiasedproductsum(const ae_int_t m, const ae_int_t n, con | |
| | | st real_2d_array &a, const real_2d_array &b, const boolean_2d_array &c); | |
| } | | } | |
| | | | |
| ///////////////////////////////////////////////////////////////////////// | | ///////////////////////////////////////////////////////////////////////// | |
| // | | // | |
| // THIS SECTION CONTAINS COMPUTATIONAL CORE DECLARATIONS (FUNCTIONS) | | // THIS SECTION CONTAINS COMPUTATIONAL CORE DECLARATIONS (FUNCTIONS) | |
| // | | // | |
| ///////////////////////////////////////////////////////////////////////// | | ///////////////////////////////////////////////////////////////////////// | |
| namespace alglib_impl | | namespace alglib_impl | |
| { | | { | |
| void hqrndrandomize(hqrndstate* state, ae_state *_state); | | void hqrndrandomize(hqrndstate* state, ae_state *_state); | |
| | | | |
| skipping to change at line 742 | | skipping to change at line 1135 | |
| void kdtreequeryresultsdistancesi(kdtree* kdt, | | void kdtreequeryresultsdistancesi(kdtree* kdt, | |
| /* Real */ ae_vector* r, | | /* Real */ ae_vector* r, | |
| ae_state *_state); | | ae_state *_state); | |
| void kdtreealloc(ae_serializer* s, kdtree* tree, ae_state *_state); | | void kdtreealloc(ae_serializer* s, kdtree* tree, ae_state *_state); | |
| void kdtreeserialize(ae_serializer* s, kdtree* tree, ae_state *_state); | | void kdtreeserialize(ae_serializer* s, kdtree* tree, ae_state *_state); | |
| void kdtreeunserialize(ae_serializer* s, kdtree* tree, ae_state *_state); | | void kdtreeunserialize(ae_serializer* s, kdtree* tree, ae_state *_state); | |
| ae_bool _kdtree_init(void* _p, ae_state *_state, ae_bool make_automatic); | | ae_bool _kdtree_init(void* _p, ae_state *_state, ae_bool make_automatic); | |
| ae_bool _kdtree_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool
make_automatic); | | ae_bool _kdtree_init_copy(void* _dst, void* _src, ae_state *_state, ae_bool
make_automatic); | |
| void _kdtree_clear(void* _p); | | void _kdtree_clear(void* _p); | |
| void _kdtree_destroy(void* _p); | | void _kdtree_destroy(void* _p); | |
|
| | | ae_int_t xdebugb1count(/* Boolean */ ae_vector* a, ae_state *_state); | |
| | | void xdebugb1not(/* Boolean */ ae_vector* a, ae_state *_state); | |
| | | void xdebugb1appendcopy(/* Boolean */ ae_vector* a, ae_state *_state); | |
| | | void xdebugb1outeven(ae_int_t n, | |
| | | /* Boolean */ ae_vector* a, | |
| | | ae_state *_state); | |
| | | ae_int_t xdebugi1sum(/* Integer */ ae_vector* a, ae_state *_state); | |
| | | void xdebugi1neg(/* Integer */ ae_vector* a, ae_state *_state); | |
| | | void xdebugi1appendcopy(/* Integer */ ae_vector* a, ae_state *_state); | |
| | | void xdebugi1outeven(ae_int_t n, | |
| | | /* Integer */ ae_vector* a, | |
| | | ae_state *_state); | |
| | | double xdebugr1sum(/* Real */ ae_vector* a, ae_state *_state); | |
| | | void xdebugr1neg(/* Real */ ae_vector* a, ae_state *_state); | |
| | | void xdebugr1appendcopy(/* Real */ ae_vector* a, ae_state *_state); | |
| | | void xdebugr1outeven(ae_int_t n, | |
| | | /* Real */ ae_vector* a, | |
| | | ae_state *_state); | |
| | | ae_complex xdebugc1sum(/* Complex */ ae_vector* a, ae_state *_state); | |
| | | void xdebugc1neg(/* Complex */ ae_vector* a, ae_state *_state); | |
| | | void xdebugc1appendcopy(/* Complex */ ae_vector* a, ae_state *_state); | |
| | | void xdebugc1outeven(ae_int_t n, | |
| | | /* Complex */ ae_vector* a, | |
| | | ae_state *_state); | |
| | | ae_int_t xdebugb2count(/* Boolean */ ae_matrix* a, ae_state *_state); | |
| | | void xdebugb2not(/* Boolean */ ae_matrix* a, ae_state *_state); | |
| | | void xdebugb2transpose(/* Boolean */ ae_matrix* a, ae_state *_state); | |
| | | void xdebugb2outsin(ae_int_t m, | |
| | | ae_int_t n, | |
| | | /* Boolean */ ae_matrix* a, | |
| | | ae_state *_state); | |
| | | ae_int_t xdebugi2sum(/* Integer */ ae_matrix* a, ae_state *_state); | |
| | | void xdebugi2neg(/* Integer */ ae_matrix* a, ae_state *_state); | |
| | | void xdebugi2transpose(/* Integer */ ae_matrix* a, ae_state *_state); | |
| | | void xdebugi2outsin(ae_int_t m, | |
| | | ae_int_t n, | |
| | | /* Integer */ ae_matrix* a, | |
| | | ae_state *_state); | |
| | | double xdebugr2sum(/* Real */ ae_matrix* a, ae_state *_state); | |
| | | void xdebugr2neg(/* Real */ ae_matrix* a, ae_state *_state); | |
| | | void xdebugr2transpose(/* Real */ ae_matrix* a, ae_state *_state); | |
| | | void xdebugr2outsin(ae_int_t m, | |
| | | ae_int_t n, | |
| | | /* Real */ ae_matrix* a, | |
| | | ae_state *_state); | |
| | | ae_complex xdebugc2sum(/* Complex */ ae_matrix* a, ae_state *_state); | |
| | | void xdebugc2neg(/* Complex */ ae_matrix* a, ae_state *_state); | |
| | | void xdebugc2transpose(/* Complex */ ae_matrix* a, ae_state *_state); | |
| | | void xdebugc2outsincos(ae_int_t m, | |
| | | ae_int_t n, | |
| | | /* Complex */ ae_matrix* a, | |
| | | ae_state *_state); | |
| | | double xdebugmaskedbiasedproductsum(ae_int_t m, | |
| | | ae_int_t n, | |
| | | /* Real */ ae_matrix* a, | |
| | | /* Real */ ae_matrix* b, | |
| | | /* Boolean */ ae_matrix* c, | |
| | | ae_state *_state); | |
| | | | |
| } | | } | |
| #endif | | #endif | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 456 lines changed or added | |
|
| ap.h | | ap.h | |
| | | | |
| skipping to change at line 29 | | skipping to change at line 29 | |
| #ifndef _ap_h | | #ifndef _ap_h | |
| #define _ap_h | | #define _ap_h | |
| | | | |
| #include <stdio.h> | | #include <stdio.h> | |
| #include <stdlib.h> | | #include <stdlib.h> | |
| #include <stddef.h> | | #include <stddef.h> | |
| #include <string> | | #include <string> | |
| #include <cstring> | | #include <cstring> | |
| #include <math.h> | | #include <math.h> | |
| | | | |
|
| #ifdef __BORLANDC__ | | #if defined(__CODEGEARC__) | |
| | | #include <list> | |
| | | #include <vector> | |
| | | #elif defined(__BORLANDC__) | |
| #include <list.h> | | #include <list.h> | |
| #include <vector.h> | | #include <vector.h> | |
| #else | | #else | |
| #include <list> | | #include <list> | |
| #include <vector> | | #include <vector> | |
| #endif | | #endif | |
| | | | |
| #define AE_USE_CPP | | #define AE_USE_CPP | |
| /* Definitions */ | | /* Definitions */ | |
| #define AE_UNKNOWN 0 | | #define AE_UNKNOWN 0 | |
| | | | |
| skipping to change at line 69 | | skipping to change at line 72 | |
| #endif | | #endif | |
| #if defined(__SUNPRO_C)||defined(__SUNPRO_CC) | | #if defined(__SUNPRO_C)||defined(__SUNPRO_CC) | |
| #undef AE_COMPILER | | #undef AE_COMPILER | |
| #define AE_COMPILER AE_SUNC | | #define AE_COMPILER AE_SUNC | |
| #endif | | #endif | |
| #ifdef _MSC_VER | | #ifdef _MSC_VER | |
| #undef AE_COMPILER | | #undef AE_COMPILER | |
| #define AE_COMPILER AE_MSVC | | #define AE_COMPILER AE_MSVC | |
| #endif | | #endif | |
| | | | |
|
| | | /* compiler-specific definitions */ | |
| | | #if AE_COMPILER==AE_MSVC | |
| | | #define ALIGNED __declspec(align(8)) | |
| | | #elif AE_COMPILER==AE_GNUC | |
| | | #define ALIGNED __attribute__((aligned(8))) | |
| | | #else | |
| | | #define ALIGNED | |
| | | #endif | |
| | | | |
| /* now we are ready to include headers */ | | /* now we are ready to include headers */ | |
| #include <stdlib.h> | | #include <stdlib.h> | |
| #include <stdio.h> | | #include <stdio.h> | |
| #include <string.h> | | #include <string.h> | |
| #include <setjmp.h> | | #include <setjmp.h> | |
| #include <math.h> | | #include <math.h> | |
| #include <stddef.h> | | #include <stddef.h> | |
| | | | |
| #if AE_OS==AE_WINDOWS | | #if AE_OS==AE_WINDOWS | |
| #include <windows.h> | | #include <windows.h> | |
| | | | |
| skipping to change at line 235 | | skipping to change at line 247 | |
| contents is either: unchanged, stored at the same location, | | contents is either: unchanged, stored at the same location, | |
| stored at the new location. | | stored at the new location. | |
| this field is set on return from X. | | this field is set on return from X. | |
| | | | |
| ptr pointer to the actual data | | ptr pointer to the actual data | |
| | | | |
| Members of this structure are ae_int64_t to avoid alignment problems. | | Members of this structure are ae_int64_t to avoid alignment problems. | |
| ************************************************************************/ | | ************************************************************************/ | |
| typedef struct | | typedef struct | |
| { | | { | |
|
| ae_int64_t owner; | | ALIGNED ae_int64_t owner; | |
| ae_int64_t last_action; | | ALIGNED ae_int64_t last_action; | |
| char *ptr; | | ALIGNED char *ptr; | |
| } x_string; | | } x_string; | |
| | | | |
| /************************************************************************ | | /************************************************************************ | |
| x-vector: | | x-vector: | |
| cnt number of elements | | cnt number of elements | |
| | | | |
| datatype one of the DT_XXXX values | | datatype one of the DT_XXXX values | |
| | | | |
| owner OWN_CALLER or OWN_AE. Determines what to do on realloc(). | | owner OWN_CALLER or OWN_AE. Determines what to do on realloc(). | |
| If vector is owned by caller, X-interface will just set | | If vector is owned by caller, X-interface will just set | |
| | | | |
| skipping to change at line 265 | | skipping to change at line 277 | |
| used by caller as hint when deciding what to do with data | | used by caller as hint when deciding what to do with data | |
| (if it was ACT_UNCHANGED or ACT_SAME_LOCATION, no array | | (if it was ACT_UNCHANGED or ACT_SAME_LOCATION, no array | |
| reallocation or copying is required). | | reallocation or copying is required). | |
| | | | |
| ptr pointer to the actual data | | ptr pointer to the actual data | |
| | | | |
| Members of this structure are ae_int64_t to avoid alignment problems. | | Members of this structure are ae_int64_t to avoid alignment problems. | |
| ************************************************************************/ | | ************************************************************************/ | |
| typedef struct | | typedef struct | |
| { | | { | |
|
| ae_int64_t cnt; | | ALIGNED ae_int64_t cnt; | |
| ae_int64_t datatype; | | ALIGNED ae_int64_t datatype; | |
| ae_int64_t owner; | | ALIGNED ae_int64_t owner; | |
| ae_int64_t last_action; | | ALIGNED ae_int64_t last_action; | |
| void *ptr; | | ALIGNED void *ptr; | |
| } x_vector; | | } x_vector; | |
| | | | |
| /************************************************************************ | | /************************************************************************ | |
| x-matrix: | | x-matrix: | |
| rows number of rows. may be zero only when cols is zero too. | | rows number of rows. may be zero only when cols is zero too. | |
| | | | |
| cols number of columns. may be zero only when rows is zero too. | | cols number of columns. may be zero only when rows is zero too. | |
| | | | |
| stride stride, i.e. distance between first elements of rows (in by
tes) | | stride stride, i.e. distance between first elements of rows (in by
tes) | |
| | | | |
| | | | |
| skipping to change at line 301 | | skipping to change at line 313 | |
| used by caller as hint when deciding what to do with data | | used by caller as hint when deciding what to do with data | |
| (if it was ACT_UNCHANGED or ACT_SAME_LOCATION, no array | | (if it was ACT_UNCHANGED or ACT_SAME_LOCATION, no array | |
| reallocation or copying is required). | | reallocation or copying is required). | |
| | | | |
| ptr pointer to the actual data, stored rowwise | | ptr pointer to the actual data, stored rowwise | |
| | | | |
| Members of this structure are ae_int64_t to avoid alignment problems. | | Members of this structure are ae_int64_t to avoid alignment problems. | |
| ************************************************************************/ | | ************************************************************************/ | |
| typedef struct | | typedef struct | |
| { | | { | |
|
| ae_int64_t rows; | | ALIGNED ae_int64_t rows; | |
| ae_int64_t cols; | | ALIGNED ae_int64_t cols; | |
| ae_int64_t stride; | | ALIGNED ae_int64_t stride; | |
| ae_int64_t datatype; | | ALIGNED ae_int64_t datatype; | |
| ae_int64_t owner; | | ALIGNED ae_int64_t owner; | |
| ae_int64_t last_action; | | ALIGNED ae_int64_t last_action; | |
| void *ptr; | | ALIGNED void *ptr; | |
| } x_matrix; | | } x_matrix; | |
| | | | |
| /************************************************************************ | | /************************************************************************ | |
| dynamic block which may be automatically deallocated during stack unwinding | | dynamic block which may be automatically deallocated during stack unwinding | |
| | | | |
| p_next next block in the stack unwinding list. | | p_next next block in the stack unwinding list. | |
| NULL means that this block is not in the list | | NULL means that this block is not in the list | |
| deallocator deallocator function which should be used to deallocate blo
ck. | | deallocator deallocator function which should be used to deallocate blo
ck. | |
| NULL for "special" blocks (frame/stack boundaries) | | NULL for "special" blocks (frame/stack boundaries) | |
| ptr pointer which should be passed to the deallocator. | | ptr pointer which should be passed to the deallocator. | |
| | | | |
| skipping to change at line 493 | | skipping to change at line 505 | |
| * under Boost it uses OS-independent lock provided by Boost package | | * under Boost it uses OS-independent lock provided by Boost package | |
| * when no OS is defined, it uses "fake lock" (just stub which is not thread
-safe): | | * when no OS is defined, it uses "fake lock" (just stub which is not thread
-safe): | |
| a) "fake lock" can be in locked or free mode | | a) "fake lock" can be in locked or free mode | |
| b) "fake lock" can be used only from one thread - one which created lock | | b) "fake lock" can be used only from one thread - one which created lock | |
| c) when thread acquires free lock, it immediately returns | | c) when thread acquires free lock, it immediately returns | |
| d) when thread acquires busy lock, program is terminated | | d) when thread acquires busy lock, program is terminated | |
| (because lock is already acquired and no one else can free it) | | (because lock is already acquired and no one else can free it) | |
| *************************************************************************/ | | *************************************************************************/ | |
| typedef struct | | typedef struct | |
| { | | { | |
|
| #if AE_OS==AE_WINDOWS | | /* | |
| volatile ae_int_t * volatile p_lock; | | * Pointer to _lock structure. This pointer has type void* in order to | |
| char buf[sizeof(ae_int_t)+AE_LOCK_ALIGNMENT]; | | * make header file OS-independent (lock declaration depends on OS). | |
| #elif AE_OS==AE_POSIX | | */ | |
| pthread_mutex_t mutex; | | void *ptr; | |
| #else | | | |
| ae_bool is_locked; | | | |
| #endif | | | |
| } ae_lock; | | } ae_lock; | |
| | | | |
| /************************************************************************* | | /************************************************************************* | |
| Shared pool: data structure used to provide thread-safe access to pool of | | Shared pool: data structure used to provide thread-safe access to pool of | |
| temporary variables. | | temporary variables. | |
| *************************************************************************/ | | *************************************************************************/ | |
| typedef struct ae_shared_pool_entry | | typedef struct ae_shared_pool_entry | |
| { | | { | |
| void * volatile obj; | | void * volatile obj; | |
| void * volatile next_entry; | | void * volatile next_entry; | |
| | | | |
| skipping to change at line 594 | | skipping to change at line 603 | |
| ae_bool ae_vector_init_copy(ae_vector *dst, ae_vector *src, ae_state *state
, ae_bool make_automatic); | | ae_bool ae_vector_init_copy(ae_vector *dst, ae_vector *src, ae_state *state
, ae_bool make_automatic); | |
| void ae_vector_init_from_x(ae_vector *dst, x_vector *src, ae_state *state,
ae_bool make_automatic); | | void ae_vector_init_from_x(ae_vector *dst, x_vector *src, ae_state *state,
ae_bool make_automatic); | |
| ae_bool ae_vector_set_length(ae_vector *dst, ae_int_t newsize, ae_state *st
ate); | | ae_bool ae_vector_set_length(ae_vector *dst, ae_int_t newsize, ae_state *st
ate); | |
| void ae_vector_clear(ae_vector *dst); | | void ae_vector_clear(ae_vector *dst); | |
| void ae_vector_destroy(ae_vector *dst); | | void ae_vector_destroy(ae_vector *dst); | |
| void ae_swap_vectors(ae_vector *vec1, ae_vector *vec2); | | void ae_swap_vectors(ae_vector *vec1, ae_vector *vec2); | |
| | | | |
| ae_bool ae_matrix_init(ae_matrix *dst, ae_int_t rows, ae_int_t cols, ae_dat
atype datatype, ae_state *state, ae_bool make_automatic); | | ae_bool ae_matrix_init(ae_matrix *dst, ae_int_t rows, ae_int_t cols, ae_dat
atype datatype, ae_state *state, ae_bool make_automatic); | |
| ae_bool ae_matrix_init_copy(ae_matrix *dst, ae_matrix *src, ae_state *state
, ae_bool make_automatic); | | ae_bool ae_matrix_init_copy(ae_matrix *dst, ae_matrix *src, ae_state *state
, ae_bool make_automatic); | |
| void ae_matrix_init_from_x(ae_matrix *dst, x_matrix *src, ae_state *state,
ae_bool make_automatic); | | void ae_matrix_init_from_x(ae_matrix *dst, x_matrix *src, ae_state *state,
ae_bool make_automatic); | |
|
| | | void ae_matrix_attach_to_x(ae_matrix *dst, x_matrix *src, ae_state *state,
ae_bool make_automatic); | |
| ae_bool ae_matrix_set_length(ae_matrix *dst, ae_int_t rows, ae_int_t cols,
ae_state *state); | | ae_bool ae_matrix_set_length(ae_matrix *dst, ae_int_t rows, ae_int_t cols,
ae_state *state); | |
| void ae_matrix_clear(ae_matrix *dst); | | void ae_matrix_clear(ae_matrix *dst); | |
| void ae_matrix_destroy(ae_matrix *dst); | | void ae_matrix_destroy(ae_matrix *dst); | |
| void ae_swap_matrices(ae_matrix *mat1, ae_matrix *mat2); | | void ae_swap_matrices(ae_matrix *mat1, ae_matrix *mat2); | |
| | | | |
| ae_bool ae_smart_ptr_init(ae_smart_ptr *dst, void **subscriber, ae_state *s
tate, ae_bool make_automatic); | | ae_bool ae_smart_ptr_init(ae_smart_ptr *dst, void **subscriber, ae_state *s
tate, ae_bool make_automatic); | |
| void ae_smart_ptr_clear(void *_dst); /* accepts ae_smart_ptr* */ | | void ae_smart_ptr_clear(void *_dst); /* accepts ae_smart_ptr* */ | |
| void ae_smart_ptr_destroy(void *_dst); | | void ae_smart_ptr_destroy(void *_dst); | |
| void ae_smart_ptr_assign(ae_smart_ptr *dst, void *new_ptr, ae_bool is_owner
, ae_bool is_dynamic, void (*destroy)(void*)); | | void ae_smart_ptr_assign(ae_smart_ptr *dst, void *new_ptr, ae_bool is_owner
, ae_bool is_dynamic, void (*destroy)(void*)); | |
| void ae_smart_ptr_release(ae_smart_ptr *dst); | | void ae_smart_ptr_release(ae_smart_ptr *dst); | |
| | | | |
| skipping to change at line 840 | | skipping to change at line 850 | |
| ae_vector ia; | | ae_vector ia; | |
| ae_vector ba; | | ae_vector ba; | |
| ae_vector ra; | | ae_vector ra; | |
| ae_vector ca; | | ae_vector ca; | |
| } rcommstate; | | } rcommstate; | |
| ae_bool _rcommstate_init(rcommstate* p, ae_state *_state, ae_bool make_auto
matic); | | ae_bool _rcommstate_init(rcommstate* p, ae_state *_state, ae_bool make_auto
matic); | |
| ae_bool _rcommstate_init_copy(rcommstate* dst, rcommstate* src, ae_state *_
state, ae_bool make_automatic); | | ae_bool _rcommstate_init_copy(rcommstate* dst, rcommstate* src, ae_state *_
state, ae_bool make_automatic); | |
| void _rcommstate_clear(rcommstate* p); | | void _rcommstate_clear(rcommstate* p); | |
| void _rcommstate_destroy(rcommstate* p); | | void _rcommstate_destroy(rcommstate* p); | |
| | | | |
|
| #ifdef AE_USE_ALLOC_COUNTER | | /************************************************************************ | |
| | | Allocation counter, inactive by default. | |
| | | Turned on when needed for debugging purposes. | |
| | | ************************************************************************/ | |
| extern ae_int64_t _alloc_counter; | | extern ae_int64_t _alloc_counter; | |
|
| #endif | | extern ae_bool _use_alloc_counter; | |
| | | | |
| /************************************************************************ | | /************************************************************************ | |
| debug functions (must be turned on by preprocessor definitions): | | debug functions (must be turned on by preprocessor definitions): | |
| * tickcount(), which is wrapper around GetTickCount() | | * tickcount(), which is wrapper around GetTickCount() | |
| * flushconsole(), fluches console | | * flushconsole(), fluches console | |
| * ae_debugrng(), returns random number generated with high-quality random n
umbers generator | | * ae_debugrng(), returns random number generated with high-quality random n
umbers generator | |
| * ae_set_seed(), sets seed of the debug RNG (NON-THREAD-SAFE!!!) | | * ae_set_seed(), sets seed of the debug RNG (NON-THREAD-SAFE!!!) | |
| * ae_get_seed(), returns two seed values of the debug RNG (NON-THREAD-SAFE!
!!) | | * ae_get_seed(), returns two seed values of the debug RNG (NON-THREAD-SAFE!
!!) | |
| ************************************************************************/ | | ************************************************************************/ | |
| #ifdef AE_DEBUG4WINDOWS | | #ifdef AE_DEBUG4WINDOWS | |
| #define flushconsole(s) fflush(stdout) | | #define flushconsole(s) fflush(stdout) | |
| #define tickcount(s) _tickcount() | | #define tickcount(s) _tickcount() | |
| int _tickcount(); | | int _tickcount(); | |
| #endif | | #endif | |
| #ifdef AE_DEBUG4POSIX | | #ifdef AE_DEBUG4POSIX | |
| #define flushconsole(s) fflush(stdout) | | #define flushconsole(s) fflush(stdout) | |
| #define tickcount(s) _tickcount() | | #define tickcount(s) _tickcount() | |
| int _tickcount(); | | int _tickcount(); | |
| #endif | | #endif | |
|
| #ifdef AE_DEBUGRNG | | | |
| ae_int_t ae_debugrng(); | | | |
| void ae_set_seed(ae_int_t s0, ae_int_t s1); | | | |
| void ae_get_seed(ae_int_t *s0, ae_int_t *s1); | | | |
| #endif | | | |
| | | | |
| } | | } | |
| | | | |
| ///////////////////////////////////////////////////////////////////////// | | ///////////////////////////////////////////////////////////////////////// | |
| // | | // | |
| // THIS SECTION CONTAINS DECLARATIONS FOR C++ RELATED FUNCTIONALITY | | // THIS SECTION CONTAINS DECLARATIONS FOR C++ RELATED FUNCTIONALITY | |
| // | | // | |
| ///////////////////////////////////////////////////////////////////////// | | ///////////////////////////////////////////////////////////////////////// | |
| | | | |
| namespace alglib | | namespace alglib | |
| | | | |
End of changes. 10 change blocks. |
| 31 lines changed or deleted | | 39 lines changed or added | |
|
| interpolation.h | | interpolation.h | |
| | | | |
| skipping to change at line 2232 | | skipping to change at line 2232 | |
| * AvgRelError average relative error on the non-zero Y | | * AvgRelError average relative error on the non-zero Y | |
| * MaxError maximum error | | * MaxError maximum error | |
| NON-WEIGHTED ERRORS ARE CALCULATED | | NON-WEIGHTED ERRORS ARE CALCULATED | |
| | | | |
| -- ALGLIB PROJECT -- | | -- ALGLIB PROJECT -- | |
| Copyright 18.08.2009 by Bochkanov Sergey | | Copyright 18.08.2009 by Bochkanov Sergey | |
| *************************************************************************/ | | *************************************************************************/ | |
| void barycentricfitfloaterhormann(const real_1d_array &x, const real_1d_arr
ay &y, const ae_int_t n, const ae_int_t m, ae_int_t &info, barycentricinter
polant &b, barycentricfitreport &rep); | | void barycentricfitfloaterhormann(const real_1d_array &x, const real_1d_arr
ay &y, const ae_int_t n, const ae_int_t m, ae_int_t &info, barycentricinter
polant &b, barycentricfitreport &rep); | |
| | | | |
| /************************************************************************* | | /************************************************************************* | |
|
| Rational least squares fitting using Floater-Hormann rational functions | | Fitting by penalized cubic spline. | |
| with optimal D chosen from [0,9]. | | | |
| | | | |
|
| Equidistant grid with M node on [min(x),max(x)] is used to build basis | | Equidistant grid with M nodes on [min(x,xc),max(x,xc)] is used to build | |
| functions. Different values of D are tried, optimal D (least root mean | | basis functions. Basis functions are cubic splines with natural boundary | |
| square error) is chosen. Task is linear, so linear least squares solver | | conditions. Problem is regularized by adding non-linearity penalty to the | |
| is used. Complexity of this computational scheme is O(N*M^2) (mostly | | usual least squares penalty function: | |
| dominated by the least squares solver). | | | |
| | | S(x) = arg min { LS + P }, where | |
| | | LS = SUM { w[i]^2*(y[i] - S(x[i]))^2 } - least squares penalty | |
| | | P = C*10^rho*integral{ S''(x)^2*dx } - non-linearity penalty | |
| | | rho - tunable constant given by user | |
| | | C - automatically determined scale parameter, | |
| | | makes penalty invariant with respect to scaling of X, Y, W. | |
| | | | |
| INPUT PARAMETERS: | | INPUT PARAMETERS: | |
| X - points, array[0..N-1]. | | X - points, array[0..N-1]. | |
| Y - function values, array[0..N-1]. | | Y - function values, array[0..N-1]. | |
|
| N - number of points, N>0. | | N - number of points (optional): | |
| M - number of basis functions ( = number_of_nodes), M>=2. | | * N>0 | |
| | | * if given, only first N elements of X/Y are processed | |
| | | * if not given, automatically determined from X/Y sizes | |
| | | M - number of basis functions ( = number_of_nodes), M>=4. | |
| | | Rho - regularization constant passed by user. It penalizes | |
| | | nonlinearity in the regression spline. It is logarithmically | |
| | | scaled, i.e. actual value of regularization constant is | |
| | | calculated as 10^Rho. It is automatically scaled so that: | |
| | | * Rho=2.0 corresponds to moderate amount of nonlinearity | |
| | | * generally, it should be somewhere in the [-8.0,+8.0] | |
| | | If you do not want to penalize nonlineary, | |
| | | pass small Rho. Values as low as -15 should work. | |
| | | | |
| OUTPUT PARAMETERS: | | OUTPUT PARAMETERS: | |
| Info- same format as in LSFitLinearWC() subroutine. | | Info- same format as in LSFitLinearWC() subroutine. | |
| * Info>0 task is solved | | * Info>0 task is solved | |
| * Info<=0 an error occured: | | * Info<=0 an error occured: | |
|
| -4 means inconvergence of internal SVD | | -4 means inconvergence of internal SVD or | |
| -3 means inconsistent constraints | | Cholesky decomposition; problem may be | |
| B - barycentric interpolant. | | too ill-conditioned (very rare) | |
| Rep - report, same format as in LSFitLinearWC() subroutine. | | S - spline interpolant. | |
| Following fields are set: | | Rep - Following fields are set: | |
| * DBest best value of the D parameter | | | |
| * RMSError rms error on the (X,Y). | | * RMSError rms error on the (X,Y). | |
| * AvgError average error on the (X,Y). | | * AvgError average error on the (X,Y). | |
| * AvgRelError average relative error on the non-zero Y | | * AvgRelError average relative error on the non-zero Y | |
| * MaxError maximum error | | * MaxError maximum error | |
| NON-WEIGHTED ERRORS ARE CALCULATED | | NON-WEIGHTED ERRORS ARE CALCULATED | |
| | | | |
|
| | | IMPORTANT: | |
| | | this subroitine doesn't calculate task's condition number for K<>0. | |
| | | | |
| | | NOTE 1: additional nodes are added to the spline outside of the fitting | |
| | | interval to force linearity when x<min(x,xc) or x>max(x,xc). It is done | |
| | | for consistency - we penalize non-linearity at [min(x,xc),max(x,xc)], so | |
| | | it is natural to force linearity outside of this interval. | |
| | | | |
| | | NOTE 2: function automatically sorts points, so caller may pass unsorted | |
| | | array. | |
| | | | |
| -- ALGLIB PROJECT -- | | -- ALGLIB PROJECT -- | |
| Copyright 18.08.2009 by Bochkanov Sergey | | Copyright 18.08.2009 by Bochkanov Sergey | |
| *************************************************************************/ | | *************************************************************************/ | |
| void spline1dfitpenalized(const real_1d_array &x, const real_1d_array &y, c
onst ae_int_t n, const ae_int_t m, const double rho, ae_int_t &info, spline
1dinterpolant &s, spline1dfitreport &rep); | | void spline1dfitpenalized(const real_1d_array &x, const real_1d_array &y, c
onst ae_int_t n, const ae_int_t m, const double rho, ae_int_t &info, spline
1dinterpolant &s, spline1dfitreport &rep); | |
| void spline1dfitpenalized(const real_1d_array &x, const real_1d_array &y, c
onst ae_int_t m, const double rho, ae_int_t &info, spline1dinterpolant &s,
spline1dfitreport &rep); | | void spline1dfitpenalized(const real_1d_array &x, const real_1d_array &y, c
onst ae_int_t m, const double rho, ae_int_t &info, spline1dinterpolant &s,
spline1dfitreport &rep); | |
| | | | |
| /************************************************************************* | | /************************************************************************* | |
| Weighted fitting by penalized cubic spline. | | Weighted fitting by penalized cubic spline. | |
| | | | |
| Equidistant grid with M nodes on [min(x,xc),max(x,xc)] is used to build | | Equidistant grid with M nodes on [min(x,xc),max(x,xc)] is used to build | |
| | | | |
End of changes. 5 change blocks. |
| 15 lines changed or deleted | | 41 lines changed or added | |
|