alglib 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +7 -0
- data/Manifest.txt +253 -0
- data/README.txt +33 -0
- data/Rakefile +27 -0
- data/ext/Rakefile +24 -0
- data/ext/alglib.i +24 -0
- data/ext/alglib/Makefile +157 -0
- data/ext/alglib/airyf.cpp +372 -0
- data/ext/alglib/airyf.h +81 -0
- data/ext/alglib/alglib.cpp +8558 -0
- data/ext/alglib/alglib_util.cpp +19 -0
- data/ext/alglib/alglib_util.h +14 -0
- data/ext/alglib/ap.cpp +877 -0
- data/ext/alglib/ap.english.html +364 -0
- data/ext/alglib/ap.h +666 -0
- data/ext/alglib/ap.russian.html +442 -0
- data/ext/alglib/apvt.h +754 -0
- data/ext/alglib/bdss.cpp +1500 -0
- data/ext/alglib/bdss.h +251 -0
- data/ext/alglib/bdsvd.cpp +1339 -0
- data/ext/alglib/bdsvd.h +164 -0
- data/ext/alglib/bessel.cpp +1226 -0
- data/ext/alglib/bessel.h +331 -0
- data/ext/alglib/betaf.cpp +105 -0
- data/ext/alglib/betaf.h +74 -0
- data/ext/alglib/bidiagonal.cpp +1328 -0
- data/ext/alglib/bidiagonal.h +350 -0
- data/ext/alglib/binomialdistr.cpp +247 -0
- data/ext/alglib/binomialdistr.h +153 -0
- data/ext/alglib/blas.cpp +576 -0
- data/ext/alglib/blas.h +132 -0
- data/ext/alglib/cblas.cpp +226 -0
- data/ext/alglib/cblas.h +57 -0
- data/ext/alglib/cdet.cpp +138 -0
- data/ext/alglib/cdet.h +92 -0
- data/ext/alglib/chebyshev.cpp +216 -0
- data/ext/alglib/chebyshev.h +76 -0
- data/ext/alglib/chisquaredistr.cpp +157 -0
- data/ext/alglib/chisquaredistr.h +144 -0
- data/ext/alglib/cholesky.cpp +285 -0
- data/ext/alglib/cholesky.h +86 -0
- data/ext/alglib/cinverse.cpp +298 -0
- data/ext/alglib/cinverse.h +111 -0
- data/ext/alglib/clu.cpp +337 -0
- data/ext/alglib/clu.h +120 -0
- data/ext/alglib/correlation.cpp +280 -0
- data/ext/alglib/correlation.h +77 -0
- data/ext/alglib/correlationtests.cpp +726 -0
- data/ext/alglib/correlationtests.h +134 -0
- data/ext/alglib/crcond.cpp +826 -0
- data/ext/alglib/crcond.h +148 -0
- data/ext/alglib/creflections.cpp +310 -0
- data/ext/alglib/creflections.h +165 -0
- data/ext/alglib/csolve.cpp +312 -0
- data/ext/alglib/csolve.h +99 -0
- data/ext/alglib/ctrinverse.cpp +387 -0
- data/ext/alglib/ctrinverse.h +98 -0
- data/ext/alglib/ctrlinsolve.cpp +297 -0
- data/ext/alglib/ctrlinsolve.h +81 -0
- data/ext/alglib/dawson.cpp +234 -0
- data/ext/alglib/dawson.h +74 -0
- data/ext/alglib/descriptivestatistics.cpp +436 -0
- data/ext/alglib/descriptivestatistics.h +112 -0
- data/ext/alglib/det.cpp +140 -0
- data/ext/alglib/det.h +94 -0
- data/ext/alglib/dforest.cpp +1819 -0
- data/ext/alglib/dforest.h +316 -0
- data/ext/alglib/elliptic.cpp +497 -0
- data/ext/alglib/elliptic.h +217 -0
- data/ext/alglib/estnorm.cpp +429 -0
- data/ext/alglib/estnorm.h +107 -0
- data/ext/alglib/expintegrals.cpp +422 -0
- data/ext/alglib/expintegrals.h +108 -0
- data/ext/alglib/faq.english.html +258 -0
- data/ext/alglib/faq.russian.html +272 -0
- data/ext/alglib/fdistr.cpp +202 -0
- data/ext/alglib/fdistr.h +163 -0
- data/ext/alglib/fresnel.cpp +211 -0
- data/ext/alglib/fresnel.h +91 -0
- data/ext/alglib/gammaf.cpp +338 -0
- data/ext/alglib/gammaf.h +104 -0
- data/ext/alglib/gqgengauss.cpp +235 -0
- data/ext/alglib/gqgengauss.h +92 -0
- data/ext/alglib/gqgenhermite.cpp +268 -0
- data/ext/alglib/gqgenhermite.h +63 -0
- data/ext/alglib/gqgenjacobi.cpp +297 -0
- data/ext/alglib/gqgenjacobi.h +72 -0
- data/ext/alglib/gqgenlaguerre.cpp +265 -0
- data/ext/alglib/gqgenlaguerre.h +69 -0
- data/ext/alglib/gqgenlegendre.cpp +300 -0
- data/ext/alglib/gqgenlegendre.h +62 -0
- data/ext/alglib/gqgenlobatto.cpp +305 -0
- data/ext/alglib/gqgenlobatto.h +97 -0
- data/ext/alglib/gqgenradau.cpp +232 -0
- data/ext/alglib/gqgenradau.h +95 -0
- data/ext/alglib/hbisinv.cpp +480 -0
- data/ext/alglib/hbisinv.h +183 -0
- data/ext/alglib/hblas.cpp +228 -0
- data/ext/alglib/hblas.h +64 -0
- data/ext/alglib/hcholesky.cpp +339 -0
- data/ext/alglib/hcholesky.h +91 -0
- data/ext/alglib/hermite.cpp +114 -0
- data/ext/alglib/hermite.h +49 -0
- data/ext/alglib/hessenberg.cpp +370 -0
- data/ext/alglib/hessenberg.h +152 -0
- data/ext/alglib/hevd.cpp +247 -0
- data/ext/alglib/hevd.h +107 -0
- data/ext/alglib/hsschur.cpp +1316 -0
- data/ext/alglib/hsschur.h +108 -0
- data/ext/alglib/htridiagonal.cpp +734 -0
- data/ext/alglib/htridiagonal.h +180 -0
- data/ext/alglib/ialglib.cpp +6 -0
- data/ext/alglib/ialglib.h +9 -0
- data/ext/alglib/ibetaf.cpp +960 -0
- data/ext/alglib/ibetaf.h +125 -0
- data/ext/alglib/igammaf.cpp +430 -0
- data/ext/alglib/igammaf.h +157 -0
- data/ext/alglib/inv.cpp +274 -0
- data/ext/alglib/inv.h +115 -0
- data/ext/alglib/inverseupdate.cpp +480 -0
- data/ext/alglib/inverseupdate.h +185 -0
- data/ext/alglib/jacobianelliptic.cpp +164 -0
- data/ext/alglib/jacobianelliptic.h +94 -0
- data/ext/alglib/jarquebera.cpp +2271 -0
- data/ext/alglib/jarquebera.h +80 -0
- data/ext/alglib/kmeans.cpp +356 -0
- data/ext/alglib/kmeans.h +76 -0
- data/ext/alglib/laguerre.cpp +94 -0
- data/ext/alglib/laguerre.h +48 -0
- data/ext/alglib/lbfgs.cpp +1167 -0
- data/ext/alglib/lbfgs.h +218 -0
- data/ext/alglib/lda.cpp +434 -0
- data/ext/alglib/lda.h +133 -0
- data/ext/alglib/ldlt.cpp +1130 -0
- data/ext/alglib/ldlt.h +124 -0
- data/ext/alglib/leastsquares.cpp +1252 -0
- data/ext/alglib/leastsquares.h +290 -0
- data/ext/alglib/legendre.cpp +107 -0
- data/ext/alglib/legendre.h +49 -0
- data/ext/alglib/linreg.cpp +1185 -0
- data/ext/alglib/linreg.h +380 -0
- data/ext/alglib/logit.cpp +1523 -0
- data/ext/alglib/logit.h +333 -0
- data/ext/alglib/lq.cpp +399 -0
- data/ext/alglib/lq.h +160 -0
- data/ext/alglib/lu.cpp +462 -0
- data/ext/alglib/lu.h +119 -0
- data/ext/alglib/mannwhitneyu.cpp +4490 -0
- data/ext/alglib/mannwhitneyu.h +115 -0
- data/ext/alglib/minlm.cpp +918 -0
- data/ext/alglib/minlm.h +312 -0
- data/ext/alglib/mlpbase.cpp +3375 -0
- data/ext/alglib/mlpbase.h +589 -0
- data/ext/alglib/mlpe.cpp +1369 -0
- data/ext/alglib/mlpe.h +552 -0
- data/ext/alglib/mlptrain.cpp +1056 -0
- data/ext/alglib/mlptrain.h +283 -0
- data/ext/alglib/nearunityunit.cpp +91 -0
- data/ext/alglib/nearunityunit.h +17 -0
- data/ext/alglib/normaldistr.cpp +377 -0
- data/ext/alglib/normaldistr.h +175 -0
- data/ext/alglib/nsevd.cpp +1869 -0
- data/ext/alglib/nsevd.h +140 -0
- data/ext/alglib/pca.cpp +168 -0
- data/ext/alglib/pca.h +87 -0
- data/ext/alglib/poissondistr.cpp +143 -0
- data/ext/alglib/poissondistr.h +130 -0
- data/ext/alglib/polinterpolation.cpp +685 -0
- data/ext/alglib/polinterpolation.h +206 -0
- data/ext/alglib/psif.cpp +173 -0
- data/ext/alglib/psif.h +88 -0
- data/ext/alglib/qr.cpp +414 -0
- data/ext/alglib/qr.h +168 -0
- data/ext/alglib/ratinterpolation.cpp +134 -0
- data/ext/alglib/ratinterpolation.h +72 -0
- data/ext/alglib/rcond.cpp +705 -0
- data/ext/alglib/rcond.h +140 -0
- data/ext/alglib/reflections.cpp +504 -0
- data/ext/alglib/reflections.h +165 -0
- data/ext/alglib/rotations.cpp +473 -0
- data/ext/alglib/rotations.h +128 -0
- data/ext/alglib/rsolve.cpp +221 -0
- data/ext/alglib/rsolve.h +99 -0
- data/ext/alglib/sbisinv.cpp +217 -0
- data/ext/alglib/sbisinv.h +171 -0
- data/ext/alglib/sblas.cpp +185 -0
- data/ext/alglib/sblas.h +64 -0
- data/ext/alglib/schur.cpp +156 -0
- data/ext/alglib/schur.h +102 -0
- data/ext/alglib/sdet.cpp +193 -0
- data/ext/alglib/sdet.h +101 -0
- data/ext/alglib/sevd.cpp +116 -0
- data/ext/alglib/sevd.h +99 -0
- data/ext/alglib/sinverse.cpp +672 -0
- data/ext/alglib/sinverse.h +138 -0
- data/ext/alglib/spddet.cpp +138 -0
- data/ext/alglib/spddet.h +96 -0
- data/ext/alglib/spdgevd.cpp +842 -0
- data/ext/alglib/spdgevd.h +200 -0
- data/ext/alglib/spdinverse.cpp +509 -0
- data/ext/alglib/spdinverse.h +122 -0
- data/ext/alglib/spdrcond.cpp +421 -0
- data/ext/alglib/spdrcond.h +118 -0
- data/ext/alglib/spdsolve.cpp +275 -0
- data/ext/alglib/spdsolve.h +105 -0
- data/ext/alglib/spline2d.cpp +1192 -0
- data/ext/alglib/spline2d.h +301 -0
- data/ext/alglib/spline3.cpp +1264 -0
- data/ext/alglib/spline3.h +290 -0
- data/ext/alglib/srcond.cpp +595 -0
- data/ext/alglib/srcond.h +127 -0
- data/ext/alglib/ssolve.cpp +895 -0
- data/ext/alglib/ssolve.h +139 -0
- data/ext/alglib/stdafx.h +0 -0
- data/ext/alglib/stest.cpp +131 -0
- data/ext/alglib/stest.h +94 -0
- data/ext/alglib/studenttdistr.cpp +222 -0
- data/ext/alglib/studenttdistr.h +115 -0
- data/ext/alglib/studentttests.cpp +377 -0
- data/ext/alglib/studentttests.h +178 -0
- data/ext/alglib/svd.cpp +620 -0
- data/ext/alglib/svd.h +126 -0
- data/ext/alglib/tdbisinv.cpp +2608 -0
- data/ext/alglib/tdbisinv.h +228 -0
- data/ext/alglib/tdevd.cpp +1229 -0
- data/ext/alglib/tdevd.h +115 -0
- data/ext/alglib/tridiagonal.cpp +594 -0
- data/ext/alglib/tridiagonal.h +171 -0
- data/ext/alglib/trigintegrals.cpp +490 -0
- data/ext/alglib/trigintegrals.h +131 -0
- data/ext/alglib/trinverse.cpp +345 -0
- data/ext/alglib/trinverse.h +98 -0
- data/ext/alglib/trlinsolve.cpp +926 -0
- data/ext/alglib/trlinsolve.h +73 -0
- data/ext/alglib/tsort.cpp +405 -0
- data/ext/alglib/tsort.h +54 -0
- data/ext/alglib/variancetests.cpp +245 -0
- data/ext/alglib/variancetests.h +134 -0
- data/ext/alglib/wsr.cpp +6285 -0
- data/ext/alglib/wsr.h +96 -0
- data/ext/ap.i +97 -0
- data/ext/correlation.i +24 -0
- data/ext/extconf.rb +6 -0
- data/ext/logit.i +89 -0
- data/lib/alglib.rb +71 -0
- data/lib/alglib/correlation.rb +26 -0
- data/lib/alglib/linearregression.rb +63 -0
- data/lib/alglib/logit.rb +42 -0
- data/test/test_alglib.rb +52 -0
- data/test/test_correlation.rb +44 -0
- data/test/test_correlationtest.rb +45 -0
- data/test/test_linreg.rb +35 -0
- data/test/test_logit.rb +43 -0
- data/test/test_pca.rb +27 -0
- metadata +326 -0
@@ -0,0 +1,316 @@
|
|
1
|
+
/*************************************************************************
|
2
|
+
Copyright (c) 2009, Sergey Bochkanov (ALGLIB project).
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are
|
6
|
+
met:
|
7
|
+
|
8
|
+
- Redistributions of source code must retain the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer.
|
10
|
+
|
11
|
+
- Redistributions in binary form must reproduce the above copyright
|
12
|
+
notice, this list of conditions and the following disclaimer listed
|
13
|
+
in this license in the documentation and/or other materials
|
14
|
+
provided with the distribution.
|
15
|
+
|
16
|
+
- Neither the name of the copyright holders nor the names of its
|
17
|
+
contributors may be used to endorse or promote products derived from
|
18
|
+
this software without specific prior written permission.
|
19
|
+
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
21
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
22
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
23
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
24
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
25
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
26
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
27
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
28
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
29
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
30
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
*************************************************************************/
|
32
|
+
|
33
|
+
#ifndef _dforest_h
|
34
|
+
#define _dforest_h
|
35
|
+
|
36
|
+
#include "ap.h"
|
37
|
+
#include "ialglib.h"
|
38
|
+
|
39
|
+
#include "tsort.h"
|
40
|
+
#include "descriptivestatistics.h"
|
41
|
+
#include "bdss.h"
|
42
|
+
|
43
|
+
|
44
|
+
struct decisionforest
|
45
|
+
{
|
46
|
+
int nvars;
|
47
|
+
int nclasses;
|
48
|
+
int ntrees;
|
49
|
+
int bufsize;
|
50
|
+
ap::real_1d_array trees;
|
51
|
+
};
|
52
|
+
struct dfreport
|
53
|
+
{
|
54
|
+
double relclserror;
|
55
|
+
double avgce;
|
56
|
+
double rmserror;
|
57
|
+
double avgerror;
|
58
|
+
double avgrelerror;
|
59
|
+
double oobrelclserror;
|
60
|
+
double oobavgce;
|
61
|
+
double oobrmserror;
|
62
|
+
double oobavgerror;
|
63
|
+
double oobavgrelerror;
|
64
|
+
};
|
65
|
+
struct dfinternalbuffers
|
66
|
+
{
|
67
|
+
ap::real_1d_array treebuf;
|
68
|
+
ap::integer_1d_array idxbuf;
|
69
|
+
ap::real_1d_array tmpbufr;
|
70
|
+
ap::real_1d_array tmpbufr2;
|
71
|
+
ap::integer_1d_array tmpbufi;
|
72
|
+
ap::integer_1d_array classibuf;
|
73
|
+
ap::integer_1d_array varpool;
|
74
|
+
ap::boolean_1d_array evsbin;
|
75
|
+
ap::real_1d_array evssplits;
|
76
|
+
};
|
77
|
+
|
78
|
+
|
79
|
+
/*************************************************************************
|
80
|
+
This subroutine builds random decision forest.
|
81
|
+
|
82
|
+
INPUT PARAMETERS:
|
83
|
+
XY - training set
|
84
|
+
NPoints - training set size, NPoints>=1
|
85
|
+
NVars - number of independent variables, NVars>=1
|
86
|
+
NClasses - task type:
|
87
|
+
* NClasses=1 - regression task with one
|
88
|
+
dependent variable
|
89
|
+
* NClasses>1 - classification task with
|
90
|
+
NClasses classes.
|
91
|
+
NTrees - number of trees in a forest, NTrees>=1.
|
92
|
+
recommended values: 50-100.
|
93
|
+
R - percent of a training set used to build
|
94
|
+
individual trees. 0<R<=1.
|
95
|
+
recommended values: 0.1 <= R <= 0.66.
|
96
|
+
|
97
|
+
OUTPUT PARAMETERS:
|
98
|
+
Info - return code:
|
99
|
+
* -2, if there is a point with class number
|
100
|
+
outside of [0..NClasses-1].
|
101
|
+
* -1, if incorrect parameters was passed
|
102
|
+
(NPoints<1, NVars<1, NClasses<1, NTrees<1, R<=0
|
103
|
+
or R>1).
|
104
|
+
* 1, if task has been solved
|
105
|
+
DF - model built
|
106
|
+
Rep - training report, contains error on a training set
|
107
|
+
and out-of-bag estimates of generalization error.
|
108
|
+
|
109
|
+
-- ALGLIB --
|
110
|
+
Copyright 19.02.2009 by Bochkanov Sergey
|
111
|
+
*************************************************************************/
|
112
|
+
void dfbuildrandomdecisionforest(const ap::real_2d_array& xy,
|
113
|
+
int npoints,
|
114
|
+
int nvars,
|
115
|
+
int nclasses,
|
116
|
+
int ntrees,
|
117
|
+
double r,
|
118
|
+
int& info,
|
119
|
+
decisionforest& df,
|
120
|
+
dfreport& rep);
|
121
|
+
|
122
|
+
|
123
|
+
/*************************************************************************
|
124
|
+
Internal decision forest building subroutine,
|
125
|
+
should not be called by user.
|
126
|
+
|
127
|
+
-- ALGLIB --
|
128
|
+
Copyright 19.02.2009 by Bochkanov Sergey
|
129
|
+
*************************************************************************/
|
130
|
+
void dfbuildinternal(const ap::real_2d_array& xy,
|
131
|
+
int npoints,
|
132
|
+
int nvars,
|
133
|
+
int nclasses,
|
134
|
+
int ntrees,
|
135
|
+
int samplesize,
|
136
|
+
int nfeatures,
|
137
|
+
int flags,
|
138
|
+
int& info,
|
139
|
+
decisionforest& df,
|
140
|
+
dfreport& rep);
|
141
|
+
|
142
|
+
|
143
|
+
/*************************************************************************
|
144
|
+
Procesing
|
145
|
+
|
146
|
+
INPUT PARAMETERS:
|
147
|
+
DF - decision forest model
|
148
|
+
X - input vector, array[0..NVars-1].
|
149
|
+
|
150
|
+
OUTPUT PARAMETERS:
|
151
|
+
Y - result. Regression estimate when solving regression task,
|
152
|
+
vector of posterior probabilities for classification task.
|
153
|
+
Subroutine does not allocate memory for this vector, it is
|
154
|
+
responsibility of a caller to allocate it. Array must be
|
155
|
+
at least [0..NClasses-1].
|
156
|
+
|
157
|
+
-- ALGLIB --
|
158
|
+
Copyright 16.02.2009 by Bochkanov Sergey
|
159
|
+
*************************************************************************/
|
160
|
+
void dfprocess(const decisionforest& df,
|
161
|
+
const ap::real_1d_array& x,
|
162
|
+
ap::real_1d_array& y);
|
163
|
+
|
164
|
+
|
165
|
+
/*************************************************************************
|
166
|
+
Relative classification error on the test set
|
167
|
+
|
168
|
+
INPUT PARAMETERS:
|
169
|
+
DF - decision forest model
|
170
|
+
XY - test set
|
171
|
+
NPoints - test set size
|
172
|
+
|
173
|
+
RESULT:
|
174
|
+
percent of incorrectly classified cases.
|
175
|
+
Zero if model solves regression task.
|
176
|
+
|
177
|
+
-- ALGLIB --
|
178
|
+
Copyright 16.02.2009 by Bochkanov Sergey
|
179
|
+
*************************************************************************/
|
180
|
+
double dfrelclserror(const decisionforest& df,
|
181
|
+
const ap::real_2d_array& xy,
|
182
|
+
int npoints);
|
183
|
+
|
184
|
+
|
185
|
+
/*************************************************************************
|
186
|
+
Average cross-entropy (in bits per element) on the test set
|
187
|
+
|
188
|
+
INPUT PARAMETERS:
|
189
|
+
DF - decision forest model
|
190
|
+
XY - test set
|
191
|
+
NPoints - test set size
|
192
|
+
|
193
|
+
RESULT:
|
194
|
+
CrossEntropy/(NPoints*LN(2)).
|
195
|
+
Zero if model solves regression task.
|
196
|
+
|
197
|
+
-- ALGLIB --
|
198
|
+
Copyright 16.02.2009 by Bochkanov Sergey
|
199
|
+
*************************************************************************/
|
200
|
+
double dfavgce(const decisionforest& df,
|
201
|
+
const ap::real_2d_array& xy,
|
202
|
+
int npoints);
|
203
|
+
|
204
|
+
|
205
|
+
/*************************************************************************
|
206
|
+
RMS error on the test set
|
207
|
+
|
208
|
+
INPUT PARAMETERS:
|
209
|
+
DF - decision forest model
|
210
|
+
XY - test set
|
211
|
+
NPoints - test set size
|
212
|
+
|
213
|
+
RESULT:
|
214
|
+
root mean square error.
|
215
|
+
Its meaning for regression task is obvious. As for
|
216
|
+
classification task, RMS error means error when estimating posterior
|
217
|
+
probabilities.
|
218
|
+
|
219
|
+
-- ALGLIB --
|
220
|
+
Copyright 16.02.2009 by Bochkanov Sergey
|
221
|
+
*************************************************************************/
|
222
|
+
double dfrmserror(const decisionforest& df,
|
223
|
+
const ap::real_2d_array& xy,
|
224
|
+
int npoints);
|
225
|
+
|
226
|
+
|
227
|
+
/*************************************************************************
|
228
|
+
Average error on the test set
|
229
|
+
|
230
|
+
INPUT PARAMETERS:
|
231
|
+
DF - decision forest model
|
232
|
+
XY - test set
|
233
|
+
NPoints - test set size
|
234
|
+
|
235
|
+
RESULT:
|
236
|
+
Its meaning for regression task is obvious. As for
|
237
|
+
classification task, it means average error when estimating posterior
|
238
|
+
probabilities.
|
239
|
+
|
240
|
+
-- ALGLIB --
|
241
|
+
Copyright 16.02.2009 by Bochkanov Sergey
|
242
|
+
*************************************************************************/
|
243
|
+
double dfavgerror(const decisionforest& df,
|
244
|
+
const ap::real_2d_array& xy,
|
245
|
+
int npoints);
|
246
|
+
|
247
|
+
|
248
|
+
/*************************************************************************
|
249
|
+
Average relative error on the test set
|
250
|
+
|
251
|
+
INPUT PARAMETERS:
|
252
|
+
DF - decision forest model
|
253
|
+
XY - test set
|
254
|
+
NPoints - test set size
|
255
|
+
|
256
|
+
RESULT:
|
257
|
+
Its meaning for regression task is obvious. As for
|
258
|
+
classification task, it means average relative error when estimating
|
259
|
+
posterior probability of belonging to the correct class.
|
260
|
+
|
261
|
+
-- ALGLIB --
|
262
|
+
Copyright 16.02.2009 by Bochkanov Sergey
|
263
|
+
*************************************************************************/
|
264
|
+
double dfavgrelerror(const decisionforest& df,
|
265
|
+
const ap::real_2d_array& xy,
|
266
|
+
int npoints);
|
267
|
+
|
268
|
+
|
269
|
+
/*************************************************************************
|
270
|
+
Copying of DecisionForest strucure
|
271
|
+
|
272
|
+
INPUT PARAMETERS:
|
273
|
+
DF1 - original
|
274
|
+
|
275
|
+
OUTPUT PARAMETERS:
|
276
|
+
DF2 - copy
|
277
|
+
|
278
|
+
-- ALGLIB --
|
279
|
+
Copyright 13.02.2009 by Bochkanov Sergey
|
280
|
+
*************************************************************************/
|
281
|
+
void dfcopy(const decisionforest& df1, decisionforest& df2);
|
282
|
+
|
283
|
+
|
284
|
+
/*************************************************************************
|
285
|
+
Serialization of DecisionForest strucure
|
286
|
+
|
287
|
+
INPUT PARAMETERS:
|
288
|
+
DF - original
|
289
|
+
|
290
|
+
OUTPUT PARAMETERS:
|
291
|
+
RA - array of real numbers which stores decision forest,
|
292
|
+
array[0..RLen-1]
|
293
|
+
RLen - RA lenght
|
294
|
+
|
295
|
+
-- ALGLIB --
|
296
|
+
Copyright 13.02.2009 by Bochkanov Sergey
|
297
|
+
*************************************************************************/
|
298
|
+
void dfserialize(const decisionforest& df, ap::real_1d_array& ra, int& rlen);
|
299
|
+
|
300
|
+
|
301
|
+
/*************************************************************************
|
302
|
+
Unserialization of DecisionForest strucure
|
303
|
+
|
304
|
+
INPUT PARAMETERS:
|
305
|
+
RA - real array which stores decision forest
|
306
|
+
|
307
|
+
OUTPUT PARAMETERS:
|
308
|
+
DF - restored structure
|
309
|
+
|
310
|
+
-- ALGLIB --
|
311
|
+
Copyright 13.02.2009 by Bochkanov Sergey
|
312
|
+
*************************************************************************/
|
313
|
+
void dfunserialize(const ap::real_1d_array& ra, decisionforest& df);
|
314
|
+
|
315
|
+
|
316
|
+
#endif
|
@@ -0,0 +1,497 @@
|
|
1
|
+
/*************************************************************************
|
2
|
+
Cephes Math Library Release 2.8: June, 2000
|
3
|
+
Copyright 1984, 1987, 1995, 2000 by Stephen L. Moshier
|
4
|
+
|
5
|
+
Contributors:
|
6
|
+
* Sergey Bochkanov (ALGLIB project). Translation from C to
|
7
|
+
pseudocode.
|
8
|
+
|
9
|
+
See subroutines comments for additional copyrights.
|
10
|
+
|
11
|
+
Redistribution and use in source and binary forms, with or without
|
12
|
+
modification, are permitted provided that the following conditions are
|
13
|
+
met:
|
14
|
+
|
15
|
+
- Redistributions of source code must retain the above copyright
|
16
|
+
notice, this list of conditions and the following disclaimer.
|
17
|
+
|
18
|
+
- Redistributions in binary form must reproduce the above copyright
|
19
|
+
notice, this list of conditions and the following disclaimer listed
|
20
|
+
in this license in the documentation and/or other materials
|
21
|
+
provided with the distribution.
|
22
|
+
|
23
|
+
- Neither the name of the copyright holders nor the names of its
|
24
|
+
contributors may be used to endorse or promote products derived from
|
25
|
+
this software without specific prior written permission.
|
26
|
+
|
27
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
28
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
29
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
30
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
31
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
32
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
33
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
34
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
35
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
36
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
37
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
38
|
+
*************************************************************************/
|
39
|
+
|
40
|
+
#include <stdafx.h>
|
41
|
+
#include "elliptic.h"
|
42
|
+
|
43
|
+
/*************************************************************************
|
44
|
+
Complete elliptic integral of the first kind
|
45
|
+
|
46
|
+
Approximates the integral
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
pi/2
|
51
|
+
-
|
52
|
+
| |
|
53
|
+
| dt
|
54
|
+
K(m) = | ------------------
|
55
|
+
| 2
|
56
|
+
| | sqrt( 1 - m sin t )
|
57
|
+
-
|
58
|
+
0
|
59
|
+
|
60
|
+
using the approximation
|
61
|
+
|
62
|
+
P(x) - log x Q(x).
|
63
|
+
|
64
|
+
ACCURACY:
|
65
|
+
|
66
|
+
Relative error:
|
67
|
+
arithmetic domain # trials peak rms
|
68
|
+
IEEE 0,1 30000 2.5e-16 6.8e-17
|
69
|
+
|
70
|
+
Cephes Math Library, Release 2.8: June, 2000
|
71
|
+
Copyright 1984, 1987, 2000 by Stephen L. Moshier
|
72
|
+
*************************************************************************/
|
73
|
+
double ellipticintegralk(double m)
|
74
|
+
{
|
75
|
+
double result;
|
76
|
+
|
77
|
+
result = ellipticintegralkhighprecision(1.0-m);
|
78
|
+
return result;
|
79
|
+
}
|
80
|
+
|
81
|
+
|
82
|
+
/*************************************************************************
|
83
|
+
Complete elliptic integral of the first kind
|
84
|
+
|
85
|
+
Approximates the integral
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
pi/2
|
90
|
+
-
|
91
|
+
| |
|
92
|
+
| dt
|
93
|
+
K(m) = | ------------------
|
94
|
+
| 2
|
95
|
+
| | sqrt( 1 - m sin t )
|
96
|
+
-
|
97
|
+
0
|
98
|
+
|
99
|
+
where m = 1 - m1, using the approximation
|
100
|
+
|
101
|
+
P(x) - log x Q(x).
|
102
|
+
|
103
|
+
The argument m1 is used rather than m so that the logarithmic
|
104
|
+
singularity at m = 1 will be shifted to the origin; this
|
105
|
+
preserves maximum accuracy.
|
106
|
+
|
107
|
+
K(0) = pi/2.
|
108
|
+
|
109
|
+
ACCURACY:
|
110
|
+
|
111
|
+
Relative error:
|
112
|
+
arithmetic domain # trials peak rms
|
113
|
+
IEEE 0,1 30000 2.5e-16 6.8e-17
|
114
|
+
|
115
|
+
�������� ���� �� ���������� Cephes
|
116
|
+
*************************************************************************/
|
117
|
+
double ellipticintegralkhighprecision(double m1)
|
118
|
+
{
|
119
|
+
double result;
|
120
|
+
double p;
|
121
|
+
double q;
|
122
|
+
|
123
|
+
if( m1<=ap::machineepsilon )
|
124
|
+
{
|
125
|
+
result = 1.3862943611198906188E0-0.5*log(m1);
|
126
|
+
}
|
127
|
+
else
|
128
|
+
{
|
129
|
+
p = 1.37982864606273237150E-4;
|
130
|
+
p = p*m1+2.28025724005875567385E-3;
|
131
|
+
p = p*m1+7.97404013220415179367E-3;
|
132
|
+
p = p*m1+9.85821379021226008714E-3;
|
133
|
+
p = p*m1+6.87489687449949877925E-3;
|
134
|
+
p = p*m1+6.18901033637687613229E-3;
|
135
|
+
p = p*m1+8.79078273952743772254E-3;
|
136
|
+
p = p*m1+1.49380448916805252718E-2;
|
137
|
+
p = p*m1+3.08851465246711995998E-2;
|
138
|
+
p = p*m1+9.65735902811690126535E-2;
|
139
|
+
p = p*m1+1.38629436111989062502E0;
|
140
|
+
q = 2.94078955048598507511E-5;
|
141
|
+
q = q*m1+9.14184723865917226571E-4;
|
142
|
+
q = q*m1+5.94058303753167793257E-3;
|
143
|
+
q = q*m1+1.54850516649762399335E-2;
|
144
|
+
q = q*m1+2.39089602715924892727E-2;
|
145
|
+
q = q*m1+3.01204715227604046988E-2;
|
146
|
+
q = q*m1+3.73774314173823228969E-2;
|
147
|
+
q = q*m1+4.88280347570998239232E-2;
|
148
|
+
q = q*m1+7.03124996963957469739E-2;
|
149
|
+
q = q*m1+1.24999999999870820058E-1;
|
150
|
+
q = q*m1+4.99999999999999999821E-1;
|
151
|
+
result = p-q*log(m1);
|
152
|
+
}
|
153
|
+
return result;
|
154
|
+
}
|
155
|
+
|
156
|
+
|
157
|
+
/*************************************************************************
|
158
|
+
Incomplete elliptic integral of the first kind F(phi|m)
|
159
|
+
|
160
|
+
Approximates the integral
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
phi
|
165
|
+
-
|
166
|
+
| |
|
167
|
+
| dt
|
168
|
+
F(phi_\m) = | ------------------
|
169
|
+
| 2
|
170
|
+
| | sqrt( 1 - m sin t )
|
171
|
+
-
|
172
|
+
0
|
173
|
+
|
174
|
+
of amplitude phi and modulus m, using the arithmetic -
|
175
|
+
geometric mean algorithm.
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
ACCURACY:
|
181
|
+
|
182
|
+
Tested at random points with m in [0, 1] and phi as indicated.
|
183
|
+
|
184
|
+
Relative error:
|
185
|
+
arithmetic domain # trials peak rms
|
186
|
+
IEEE -10,10 200000 7.4e-16 1.0e-16
|
187
|
+
|
188
|
+
Cephes Math Library Release 2.8: June, 2000
|
189
|
+
Copyright 1984, 1987, 2000 by Stephen L. Moshier
|
190
|
+
*************************************************************************/
|
191
|
+
double incompleteellipticintegralk(double phi, double m)
|
192
|
+
{
|
193
|
+
double result;
|
194
|
+
double a;
|
195
|
+
double b;
|
196
|
+
double c;
|
197
|
+
double e;
|
198
|
+
double temp;
|
199
|
+
double pio2;
|
200
|
+
double t;
|
201
|
+
double k;
|
202
|
+
int d;
|
203
|
+
int md;
|
204
|
+
int s;
|
205
|
+
int npio2;
|
206
|
+
|
207
|
+
pio2 = 1.57079632679489661923;
|
208
|
+
if( m==0 )
|
209
|
+
{
|
210
|
+
result = phi;
|
211
|
+
return result;
|
212
|
+
}
|
213
|
+
a = 1-m;
|
214
|
+
if( a==0 )
|
215
|
+
{
|
216
|
+
result = log(tan(0.5*(pio2+phi)));
|
217
|
+
return result;
|
218
|
+
}
|
219
|
+
npio2 = ap::ifloor(phi/pio2);
|
220
|
+
if( npio2%2!=0 )
|
221
|
+
{
|
222
|
+
npio2 = npio2+1;
|
223
|
+
}
|
224
|
+
if( npio2!=0 )
|
225
|
+
{
|
226
|
+
k = ellipticintegralk(1-a);
|
227
|
+
phi = phi-npio2*pio2;
|
228
|
+
}
|
229
|
+
else
|
230
|
+
{
|
231
|
+
k = 0;
|
232
|
+
}
|
233
|
+
if( phi<0 )
|
234
|
+
{
|
235
|
+
phi = -phi;
|
236
|
+
s = -1;
|
237
|
+
}
|
238
|
+
else
|
239
|
+
{
|
240
|
+
s = 0;
|
241
|
+
}
|
242
|
+
b = sqrt(a);
|
243
|
+
t = tan(phi);
|
244
|
+
if( fabs(t)>10 )
|
245
|
+
{
|
246
|
+
e = 1.0/(b*t);
|
247
|
+
if( fabs(e)<10 )
|
248
|
+
{
|
249
|
+
e = atan(e);
|
250
|
+
if( npio2==0 )
|
251
|
+
{
|
252
|
+
k = ellipticintegralk(1-a);
|
253
|
+
}
|
254
|
+
temp = k-incompleteellipticintegralk(e, m);
|
255
|
+
if( s<0 )
|
256
|
+
{
|
257
|
+
temp = -temp;
|
258
|
+
}
|
259
|
+
result = temp+npio2*k;
|
260
|
+
return result;
|
261
|
+
}
|
262
|
+
}
|
263
|
+
a = 1.0;
|
264
|
+
c = sqrt(m);
|
265
|
+
d = 1;
|
266
|
+
md = 0;
|
267
|
+
while(fabs(c/a)>ap::machineepsilon)
|
268
|
+
{
|
269
|
+
temp = b/a;
|
270
|
+
phi = phi+atan(t*temp)+md*ap::pi();
|
271
|
+
md = ap::trunc((phi+pio2)/ap::pi());
|
272
|
+
t = t*(1.0+temp)/(1.0-temp*t*t);
|
273
|
+
c = 0.5*(a-b);
|
274
|
+
temp = sqrt(a*b);
|
275
|
+
a = 0.5*(a+b);
|
276
|
+
b = temp;
|
277
|
+
d = d+d;
|
278
|
+
}
|
279
|
+
temp = (atan(t)+md*ap::pi())/(d*a);
|
280
|
+
if( s<0 )
|
281
|
+
{
|
282
|
+
temp = -temp;
|
283
|
+
}
|
284
|
+
result = temp+npio2*k;
|
285
|
+
return result;
|
286
|
+
}
|
287
|
+
|
288
|
+
|
289
|
+
/*************************************************************************
|
290
|
+
Complete elliptic integral of the second kind
|
291
|
+
|
292
|
+
Approximates the integral
|
293
|
+
|
294
|
+
|
295
|
+
pi/2
|
296
|
+
-
|
297
|
+
| | 2
|
298
|
+
E(m) = | sqrt( 1 - m sin t ) dt
|
299
|
+
| |
|
300
|
+
-
|
301
|
+
0
|
302
|
+
|
303
|
+
using the approximation
|
304
|
+
|
305
|
+
P(x) - x log x Q(x).
|
306
|
+
|
307
|
+
ACCURACY:
|
308
|
+
|
309
|
+
Relative error:
|
310
|
+
arithmetic domain # trials peak rms
|
311
|
+
IEEE 0, 1 10000 2.1e-16 7.3e-17
|
312
|
+
|
313
|
+
Cephes Math Library, Release 2.8: June, 2000
|
314
|
+
Copyright 1984, 1987, 1989, 2000 by Stephen L. Moshier
|
315
|
+
*************************************************************************/
|
316
|
+
double ellipticintegrale(double m)
|
317
|
+
{
|
318
|
+
double result;
|
319
|
+
double p;
|
320
|
+
double q;
|
321
|
+
|
322
|
+
ap::ap_error::make_assertion(m>=0&&m<=1, "Domain error in EllipticIntegralE: m<0 or m>1");
|
323
|
+
m = 1-m;
|
324
|
+
if( m==0 )
|
325
|
+
{
|
326
|
+
result = 1;
|
327
|
+
return result;
|
328
|
+
}
|
329
|
+
p = 1.53552577301013293365E-4;
|
330
|
+
p = p*m+2.50888492163602060990E-3;
|
331
|
+
p = p*m+8.68786816565889628429E-3;
|
332
|
+
p = p*m+1.07350949056076193403E-2;
|
333
|
+
p = p*m+7.77395492516787092951E-3;
|
334
|
+
p = p*m+7.58395289413514708519E-3;
|
335
|
+
p = p*m+1.15688436810574127319E-2;
|
336
|
+
p = p*m+2.18317996015557253103E-2;
|
337
|
+
p = p*m+5.68051945617860553470E-2;
|
338
|
+
p = p*m+4.43147180560990850618E-1;
|
339
|
+
p = p*m+1.00000000000000000299E0;
|
340
|
+
q = 3.27954898576485872656E-5;
|
341
|
+
q = q*m+1.00962792679356715133E-3;
|
342
|
+
q = q*m+6.50609489976927491433E-3;
|
343
|
+
q = q*m+1.68862163993311317300E-2;
|
344
|
+
q = q*m+2.61769742454493659583E-2;
|
345
|
+
q = q*m+3.34833904888224918614E-2;
|
346
|
+
q = q*m+4.27180926518931511717E-2;
|
347
|
+
q = q*m+5.85936634471101055642E-2;
|
348
|
+
q = q*m+9.37499997197644278445E-2;
|
349
|
+
q = q*m+2.49999999999888314361E-1;
|
350
|
+
result = p-q*m*log(m);
|
351
|
+
return result;
|
352
|
+
}
|
353
|
+
|
354
|
+
|
355
|
+
/*************************************************************************
|
356
|
+
Incomplete elliptic integral of the second kind
|
357
|
+
|
358
|
+
Approximates the integral
|
359
|
+
|
360
|
+
|
361
|
+
phi
|
362
|
+
-
|
363
|
+
| |
|
364
|
+
| 2
|
365
|
+
E(phi_\m) = | sqrt( 1 - m sin t ) dt
|
366
|
+
|
|
367
|
+
| |
|
368
|
+
-
|
369
|
+
0
|
370
|
+
|
371
|
+
of amplitude phi and modulus m, using the arithmetic -
|
372
|
+
geometric mean algorithm.
|
373
|
+
|
374
|
+
ACCURACY:
|
375
|
+
|
376
|
+
Tested at random arguments with phi in [-10, 10] and m in
|
377
|
+
[0, 1].
|
378
|
+
Relative error:
|
379
|
+
arithmetic domain # trials peak rms
|
380
|
+
IEEE -10,10 150000 3.3e-15 1.4e-16
|
381
|
+
|
382
|
+
Cephes Math Library Release 2.8: June, 2000
|
383
|
+
Copyright 1984, 1987, 1993, 2000 by Stephen L. Moshier
|
384
|
+
*************************************************************************/
|
385
|
+
double incompleteellipticintegrale(double phi, double m)
|
386
|
+
{
|
387
|
+
double result;
|
388
|
+
double pio2;
|
389
|
+
double a;
|
390
|
+
double b;
|
391
|
+
double c;
|
392
|
+
double e;
|
393
|
+
double temp;
|
394
|
+
double lphi;
|
395
|
+
double t;
|
396
|
+
double ebig;
|
397
|
+
int d;
|
398
|
+
int md;
|
399
|
+
int npio2;
|
400
|
+
int s;
|
401
|
+
|
402
|
+
pio2 = 1.57079632679489661923;
|
403
|
+
if( m==0 )
|
404
|
+
{
|
405
|
+
result = phi;
|
406
|
+
return result;
|
407
|
+
}
|
408
|
+
lphi = phi;
|
409
|
+
npio2 = ap::ifloor(lphi/pio2);
|
410
|
+
if( npio2%2!=0 )
|
411
|
+
{
|
412
|
+
npio2 = npio2+1;
|
413
|
+
}
|
414
|
+
lphi = lphi-npio2*pio2;
|
415
|
+
if( lphi<0 )
|
416
|
+
{
|
417
|
+
lphi = -lphi;
|
418
|
+
s = -1;
|
419
|
+
}
|
420
|
+
else
|
421
|
+
{
|
422
|
+
s = 1;
|
423
|
+
}
|
424
|
+
a = 1.0-m;
|
425
|
+
ebig = ellipticintegrale(m);
|
426
|
+
if( a==0 )
|
427
|
+
{
|
428
|
+
temp = sin(lphi);
|
429
|
+
if( s<0 )
|
430
|
+
{
|
431
|
+
temp = -temp;
|
432
|
+
}
|
433
|
+
result = temp+npio2*ebig;
|
434
|
+
return result;
|
435
|
+
}
|
436
|
+
t = tan(lphi);
|
437
|
+
b = sqrt(a);
|
438
|
+
|
439
|
+
//
|
440
|
+
// Thanks to Brian Fitzgerald <fitzgb@mml0.meche.rpi.edu>
|
441
|
+
// for pointing out an instability near odd multiples of pi/2
|
442
|
+
//
|
443
|
+
if( fabs(t)>10 )
|
444
|
+
{
|
445
|
+
|
446
|
+
//
|
447
|
+
// Transform the amplitude
|
448
|
+
//
|
449
|
+
e = 1.0/(b*t);
|
450
|
+
|
451
|
+
//
|
452
|
+
// ... but avoid multiple recursions.
|
453
|
+
//
|
454
|
+
if( fabs(e)<10 )
|
455
|
+
{
|
456
|
+
e = atan(e);
|
457
|
+
temp = ebig+m*sin(lphi)*sin(e)-incompleteellipticintegrale(e, m);
|
458
|
+
if( s<0 )
|
459
|
+
{
|
460
|
+
temp = -temp;
|
461
|
+
}
|
462
|
+
result = temp+npio2*ebig;
|
463
|
+
return result;
|
464
|
+
}
|
465
|
+
}
|
466
|
+
c = sqrt(m);
|
467
|
+
a = 1.0;
|
468
|
+
d = 1;
|
469
|
+
e = 0.0;
|
470
|
+
md = 0;
|
471
|
+
while(fabs(c/a)>ap::machineepsilon)
|
472
|
+
{
|
473
|
+
temp = b/a;
|
474
|
+
lphi = lphi+atan(t*temp)+md*ap::pi();
|
475
|
+
md = ap::trunc((lphi+pio2)/ap::pi());
|
476
|
+
t = t*(1.0+temp)/(1.0-temp*t*t);
|
477
|
+
c = 0.5*(a-b);
|
478
|
+
temp = sqrt(a*b);
|
479
|
+
a = 0.5*(a+b);
|
480
|
+
b = temp;
|
481
|
+
d = d+d;
|
482
|
+
e = e+c*sin(lphi);
|
483
|
+
}
|
484
|
+
temp = ebig/ellipticintegralk(m);
|
485
|
+
temp = temp*((atan(t)+md*ap::pi())/(d*a));
|
486
|
+
temp = temp+e;
|
487
|
+
if( s<0 )
|
488
|
+
{
|
489
|
+
temp = -temp;
|
490
|
+
}
|
491
|
+
result = temp+npio2*ebig;
|
492
|
+
return result;
|
493
|
+
return result;
|
494
|
+
}
|
495
|
+
|
496
|
+
|
497
|
+
|