alglib4 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/README.md +47 -0
- data/ext/alglib/alglib.cpp +537 -0
- data/ext/alglib/alglib_array_converters.cpp +86 -0
- data/ext/alglib/alglib_array_converters.h +15 -0
- data/ext/alglib/alglib_utils.cpp +10 -0
- data/ext/alglib/alglib_utils.h +6 -0
- data/ext/alglib/alglibinternal.cpp +21749 -0
- data/ext/alglib/alglibinternal.h +2168 -0
- data/ext/alglib/alglibmisc.cpp +9106 -0
- data/ext/alglib/alglibmisc.h +2114 -0
- data/ext/alglib/ap.cpp +20094 -0
- data/ext/alglib/ap.h +7244 -0
- data/ext/alglib/dataanalysis.cpp +52588 -0
- data/ext/alglib/dataanalysis.h +10601 -0
- data/ext/alglib/diffequations.cpp +1342 -0
- data/ext/alglib/diffequations.h +282 -0
- data/ext/alglib/extconf.rb +5 -0
- data/ext/alglib/fasttransforms.cpp +4696 -0
- data/ext/alglib/fasttransforms.h +1018 -0
- data/ext/alglib/integration.cpp +4249 -0
- data/ext/alglib/integration.h +869 -0
- data/ext/alglib/interpolation.cpp +74502 -0
- data/ext/alglib/interpolation.h +12264 -0
- data/ext/alglib/kernels_avx2.cpp +2171 -0
- data/ext/alglib/kernels_avx2.h +201 -0
- data/ext/alglib/kernels_fma.cpp +1065 -0
- data/ext/alglib/kernels_fma.h +137 -0
- data/ext/alglib/kernels_sse2.cpp +735 -0
- data/ext/alglib/kernels_sse2.h +100 -0
- data/ext/alglib/linalg.cpp +65182 -0
- data/ext/alglib/linalg.h +9927 -0
- data/ext/alglib/optimization.cpp +135331 -0
- data/ext/alglib/optimization.h +19235 -0
- data/ext/alglib/solvers.cpp +20488 -0
- data/ext/alglib/solvers.h +4781 -0
- data/ext/alglib/specialfunctions.cpp +10672 -0
- data/ext/alglib/specialfunctions.h +2305 -0
- data/ext/alglib/statistics.cpp +19791 -0
- data/ext/alglib/statistics.h +1359 -0
- data/ext/alglib/stdafx.h +2 -0
- data/gpl2.txt +339 -0
- data/gpl3.txt +674 -0
- data/lib/alglib/version.rb +3 -0
- data/lib/alglib.rb +4 -0
- metadata +101 -0
@@ -0,0 +1,282 @@
|
|
1
|
+
/*************************************************************************
|
2
|
+
ALGLIB 4.04.0 (source code generated 2024-12-21)
|
3
|
+
Copyright (c) Sergey Bochkanov (ALGLIB project).
|
4
|
+
|
5
|
+
>>> SOURCE LICENSE >>>
|
6
|
+
This program is free software; you can redistribute it and/or modify
|
7
|
+
it under the terms of the GNU General Public License as published by
|
8
|
+
the Free Software Foundation (www.fsf.org); either version 2 of the
|
9
|
+
License, or (at your option) any later version.
|
10
|
+
|
11
|
+
This program is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14
|
+
GNU General Public License for more details.
|
15
|
+
|
16
|
+
A copy of the GNU General Public License is available at
|
17
|
+
http://www.fsf.org/licensing/licenses
|
18
|
+
>>> END OF LICENSE >>>
|
19
|
+
*************************************************************************/
|
20
|
+
#ifndef _diffequations_pkg_h
|
21
|
+
#define _diffequations_pkg_h
|
22
|
+
#include "ap.h"
|
23
|
+
#include "alglibinternal.h"
|
24
|
+
|
25
|
+
/////////////////////////////////////////////////////////////////////////
|
26
|
+
//
|
27
|
+
// THIS SECTION CONTAINS COMPUTATIONAL CORE DECLARATIONS (DATATYPES)
|
28
|
+
//
|
29
|
+
/////////////////////////////////////////////////////////////////////////
|
30
|
+
namespace alglib_impl
|
31
|
+
{
|
32
|
+
#if defined(AE_COMPILE_ODESOLVER) || !defined(AE_PARTIAL_BUILD)
|
33
|
+
typedef struct
|
34
|
+
{
|
35
|
+
ae_int_t n;
|
36
|
+
ae_int_t m;
|
37
|
+
double xscale;
|
38
|
+
double h;
|
39
|
+
double eps;
|
40
|
+
ae_bool fraceps;
|
41
|
+
ae_vector yc;
|
42
|
+
ae_vector escale;
|
43
|
+
ae_vector xg;
|
44
|
+
ae_int_t solvertype;
|
45
|
+
ae_bool needdy;
|
46
|
+
double x;
|
47
|
+
ae_vector y;
|
48
|
+
ae_vector dy;
|
49
|
+
ae_matrix ytbl;
|
50
|
+
ae_int_t repterminationtype;
|
51
|
+
ae_int_t repnfev;
|
52
|
+
ae_vector yn;
|
53
|
+
ae_vector yns;
|
54
|
+
ae_vector rka;
|
55
|
+
ae_vector rkc;
|
56
|
+
ae_vector rkcs;
|
57
|
+
ae_matrix rkb;
|
58
|
+
ae_matrix rkk;
|
59
|
+
rcommstate rstate;
|
60
|
+
} odesolverstate;
|
61
|
+
typedef struct
|
62
|
+
{
|
63
|
+
ae_int_t nfev;
|
64
|
+
ae_int_t terminationtype;
|
65
|
+
} odesolverreport;
|
66
|
+
#endif
|
67
|
+
|
68
|
+
}
|
69
|
+
|
70
|
+
/////////////////////////////////////////////////////////////////////////
|
71
|
+
//
|
72
|
+
// THIS SECTION CONTAINS C++ INTERFACE
|
73
|
+
//
|
74
|
+
/////////////////////////////////////////////////////////////////////////
|
75
|
+
namespace alglib
|
76
|
+
{
|
77
|
+
|
78
|
+
#if defined(AE_COMPILE_ODESOLVER) || !defined(AE_PARTIAL_BUILD)
|
79
|
+
/*************************************************************************
|
80
|
+
|
81
|
+
*************************************************************************/
|
82
|
+
class _odesolverstate_owner
|
83
|
+
{
|
84
|
+
public:
|
85
|
+
_odesolverstate_owner();
|
86
|
+
_odesolverstate_owner(alglib_impl::odesolverstate *attach_to);
|
87
|
+
_odesolverstate_owner(const _odesolverstate_owner &rhs);
|
88
|
+
_odesolverstate_owner& operator=(const _odesolverstate_owner &rhs);
|
89
|
+
virtual ~_odesolverstate_owner();
|
90
|
+
alglib_impl::odesolverstate* c_ptr();
|
91
|
+
const alglib_impl::odesolverstate* c_ptr() const;
|
92
|
+
protected:
|
93
|
+
alglib_impl::odesolverstate *p_struct;
|
94
|
+
bool is_attached;
|
95
|
+
};
|
96
|
+
class odesolverstate : public _odesolverstate_owner
|
97
|
+
{
|
98
|
+
public:
|
99
|
+
odesolverstate();
|
100
|
+
odesolverstate(alglib_impl::odesolverstate *attach_to);
|
101
|
+
odesolverstate(const odesolverstate &rhs);
|
102
|
+
odesolverstate& operator=(const odesolverstate &rhs);
|
103
|
+
virtual ~odesolverstate();
|
104
|
+
ae_bool &needdy;
|
105
|
+
real_1d_array y;
|
106
|
+
real_1d_array dy;
|
107
|
+
double &x;
|
108
|
+
|
109
|
+
};
|
110
|
+
|
111
|
+
|
112
|
+
/*************************************************************************
|
113
|
+
|
114
|
+
*************************************************************************/
|
115
|
+
class _odesolverreport_owner
|
116
|
+
{
|
117
|
+
public:
|
118
|
+
_odesolverreport_owner();
|
119
|
+
_odesolverreport_owner(alglib_impl::odesolverreport *attach_to);
|
120
|
+
_odesolverreport_owner(const _odesolverreport_owner &rhs);
|
121
|
+
_odesolverreport_owner& operator=(const _odesolverreport_owner &rhs);
|
122
|
+
virtual ~_odesolverreport_owner();
|
123
|
+
alglib_impl::odesolverreport* c_ptr();
|
124
|
+
const alglib_impl::odesolverreport* c_ptr() const;
|
125
|
+
protected:
|
126
|
+
alglib_impl::odesolverreport *p_struct;
|
127
|
+
bool is_attached;
|
128
|
+
};
|
129
|
+
class odesolverreport : public _odesolverreport_owner
|
130
|
+
{
|
131
|
+
public:
|
132
|
+
odesolverreport();
|
133
|
+
odesolverreport(alglib_impl::odesolverreport *attach_to);
|
134
|
+
odesolverreport(const odesolverreport &rhs);
|
135
|
+
odesolverreport& operator=(const odesolverreport &rhs);
|
136
|
+
virtual ~odesolverreport();
|
137
|
+
ae_int_t &nfev;
|
138
|
+
ae_int_t &terminationtype;
|
139
|
+
|
140
|
+
};
|
141
|
+
#endif
|
142
|
+
|
143
|
+
#if defined(AE_COMPILE_ODESOLVER) || !defined(AE_PARTIAL_BUILD)
|
144
|
+
/*************************************************************************
|
145
|
+
Cash-Karp adaptive ODE solver.
|
146
|
+
|
147
|
+
This subroutine solves ODE Y'=f(Y,x) with initial conditions Y(xs)=Ys
|
148
|
+
(here Y may be single variable or vector of N variables).
|
149
|
+
|
150
|
+
INPUT PARAMETERS:
|
151
|
+
Y - initial conditions, array[0..N-1].
|
152
|
+
contains values of Y[] at X[0]
|
153
|
+
N - system size
|
154
|
+
X - points at which Y should be tabulated, array[0..M-1]
|
155
|
+
integrations starts at X[0], ends at X[M-1], intermediate
|
156
|
+
values at X[i] are returned too.
|
157
|
+
SHOULD BE ORDERED BY ASCENDING OR BY DESCENDING!
|
158
|
+
M - number of intermediate points + first point + last point:
|
159
|
+
* M>2 means that you need both Y(X[M-1]) and M-2 values at
|
160
|
+
intermediate points
|
161
|
+
* M=2 means that you want just to integrate from X[0] to
|
162
|
+
X[1] and don't interested in intermediate values.
|
163
|
+
* M=1 means that you don't want to integrate :)
|
164
|
+
it is degenerate case, but it will be handled correctly.
|
165
|
+
* M<1 means error
|
166
|
+
Eps - tolerance (absolute/relative error on each step will be
|
167
|
+
less than Eps). When passing:
|
168
|
+
* Eps>0, it means desired ABSOLUTE error
|
169
|
+
* Eps<0, it means desired RELATIVE error. Relative errors
|
170
|
+
are calculated with respect to maximum values of Y seen
|
171
|
+
so far. Be careful to use this criterion when starting
|
172
|
+
from Y[] that are close to zero.
|
173
|
+
H - initial step lenth, it will be adjusted automatically
|
174
|
+
after the first step. If H=0, step will be selected
|
175
|
+
automatically (usualy it will be equal to 0.001 of
|
176
|
+
min(x[i]-x[j])).
|
177
|
+
|
178
|
+
OUTPUT PARAMETERS
|
179
|
+
State - structure which stores algorithm state between subsequent
|
180
|
+
calls of OdeSolverIteration. Used for reverse communication.
|
181
|
+
This structure should be passed to the OdeSolverIteration
|
182
|
+
subroutine.
|
183
|
+
|
184
|
+
SEE ALSO
|
185
|
+
AutoGKSmoothW, AutoGKSingular, AutoGKIteration, AutoGKResults.
|
186
|
+
|
187
|
+
|
188
|
+
-- ALGLIB --
|
189
|
+
Copyright 01.09.2009 by Bochkanov Sergey
|
190
|
+
*************************************************************************/
|
191
|
+
void odesolverrkck(const real_1d_array &y, const ae_int_t n, const real_1d_array &x, const ae_int_t m, const double eps, const double h, odesolverstate &state, const xparams _xparams = alglib::xdefault);
|
192
|
+
void odesolverrkck(const real_1d_array &y, const real_1d_array &x, const double eps, const double h, odesolverstate &state, const xparams _xparams = alglib::xdefault);
|
193
|
+
|
194
|
+
|
195
|
+
/*************************************************************************
|
196
|
+
This function provides reverse communication interface
|
197
|
+
Reverse communication interface is not documented or recommended to use.
|
198
|
+
See below for functions which provide better documented API
|
199
|
+
*************************************************************************/
|
200
|
+
bool odesolveriteration(odesolverstate &state, const xparams _xparams = alglib::xdefault);
|
201
|
+
|
202
|
+
|
203
|
+
/*************************************************************************
|
204
|
+
This function is used to start iterations of the ODE solver
|
205
|
+
|
206
|
+
It accepts following parameters:
|
207
|
+
diff - callback which calculates dy/dx for given y and x
|
208
|
+
ptr - optional pointer which is passed to diff; can be NULL
|
209
|
+
|
210
|
+
|
211
|
+
-- ALGLIB --
|
212
|
+
Copyright 01.09.2009 by Bochkanov Sergey
|
213
|
+
|
214
|
+
*************************************************************************/
|
215
|
+
void odesolversolve(odesolverstate &state,
|
216
|
+
void (*diff)(const real_1d_array &y, double x, real_1d_array &dy, void *ptr),
|
217
|
+
void *ptr = NULL, const xparams _xparams = alglib::xdefault);
|
218
|
+
|
219
|
+
|
220
|
+
/*************************************************************************
|
221
|
+
ODE solver results
|
222
|
+
|
223
|
+
Called after OdeSolverIteration returned False.
|
224
|
+
|
225
|
+
INPUT PARAMETERS:
|
226
|
+
State - algorithm state (used by OdeSolverIteration).
|
227
|
+
|
228
|
+
OUTPUT PARAMETERS:
|
229
|
+
M - number of tabulated values, M>=1
|
230
|
+
XTbl - array[0..M-1], values of X
|
231
|
+
YTbl - array[0..M-1,0..N-1], values of Y in X[i]
|
232
|
+
Rep - solver report:
|
233
|
+
* Rep.TerminationType completetion code:
|
234
|
+
* -2 X is not ordered by ascending/descending or
|
235
|
+
there are non-distinct X[], i.e. X[i]=X[i+1]
|
236
|
+
* -1 incorrect parameters were specified
|
237
|
+
* 1 task has been solved
|
238
|
+
* Rep.NFEV contains number of function calculations
|
239
|
+
|
240
|
+
-- ALGLIB --
|
241
|
+
Copyright 01.09.2009 by Bochkanov Sergey
|
242
|
+
*************************************************************************/
|
243
|
+
void odesolverresults(const odesolverstate &state, ae_int_t &m, real_1d_array &xtbl, real_2d_array &ytbl, odesolverreport &rep, const xparams _xparams = alglib::xdefault);
|
244
|
+
#endif
|
245
|
+
}
|
246
|
+
|
247
|
+
/////////////////////////////////////////////////////////////////////////
|
248
|
+
//
|
249
|
+
// THIS SECTION CONTAINS COMPUTATIONAL CORE DECLARATIONS (FUNCTIONS)
|
250
|
+
//
|
251
|
+
/////////////////////////////////////////////////////////////////////////
|
252
|
+
namespace alglib_impl
|
253
|
+
{
|
254
|
+
#if defined(AE_COMPILE_ODESOLVER) || !defined(AE_PARTIAL_BUILD)
|
255
|
+
void odesolverrkck(/* Real */ const ae_vector* y,
|
256
|
+
ae_int_t n,
|
257
|
+
/* Real */ const ae_vector* x,
|
258
|
+
ae_int_t m,
|
259
|
+
double eps,
|
260
|
+
double h,
|
261
|
+
odesolverstate* state,
|
262
|
+
ae_state *_state);
|
263
|
+
ae_bool odesolveriteration(odesolverstate* state, ae_state *_state);
|
264
|
+
void odesolverresults(const odesolverstate* state,
|
265
|
+
ae_int_t* m,
|
266
|
+
/* Real */ ae_vector* xtbl,
|
267
|
+
/* Real */ ae_matrix* ytbl,
|
268
|
+
odesolverreport* rep,
|
269
|
+
ae_state *_state);
|
270
|
+
void _odesolverstate_init(void* _p, ae_state *_state, ae_bool make_automatic);
|
271
|
+
void _odesolverstate_init_copy(void* _dst, const void* _src, ae_state *_state, ae_bool make_automatic);
|
272
|
+
void _odesolverstate_clear(void* _p);
|
273
|
+
void _odesolverstate_destroy(void* _p);
|
274
|
+
void _odesolverreport_init(void* _p, ae_state *_state, ae_bool make_automatic);
|
275
|
+
void _odesolverreport_init_copy(void* _dst, const void* _src, ae_state *_state, ae_bool make_automatic);
|
276
|
+
void _odesolverreport_clear(void* _p);
|
277
|
+
void _odesolverreport_destroy(void* _p);
|
278
|
+
#endif
|
279
|
+
|
280
|
+
}
|
281
|
+
#endif
|
282
|
+
|