Skip to content
Newer
Older
100644 405 lines (325 sloc) 13.8 KB
72ac9cd @schwehr cleanup and LGPL license
authored Sep 25, 2004
1 // $Revision$ $Author$ $Date$
2 /*
3 Copyright (C) 2004 Kurt Schwehr
4
ed3f455 @schwehr switched from LGPL to GPL
authored Nov 3, 2004
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
72ac9cd @schwehr cleanup and LGPL license
authored Sep 25, 2004
9
ed3f455 @schwehr switched from LGPL to GPL
authored Nov 3, 2004
10 This program is distributed in the hope that it will be useful,
72ac9cd @schwehr cleanup and LGPL license
authored Sep 25, 2004
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
ed3f455 @schwehr switched from LGPL to GPL
authored Nov 3, 2004
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
72ac9cd @schwehr cleanup and LGPL license
authored Sep 25, 2004
14
ed3f455 @schwehr switched from LGPL to GPL
authored Nov 3, 2004
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
72ac9cd @schwehr cleanup and LGPL license
authored Sep 25, 2004
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 */
b155d68 @schwehr Initial revision
authored Sep 9, 2004
20
ac50ca3 @schwehr doxygen file list
authored Oct 28, 2004
21 /// \file
22 /// \brief Command line program to do paleomag s data processing into xyz.
23
24
25
b155d68 @schwehr Initial revision
authored Sep 9, 2004
26 /*
27
28 Random: double gsl_ran_gaussian (const gsl_rng * r, double sigma)
29
30 This function returns a Gaussian random variate, with mean zero and
31 standard deviation sigma. The probability distribution for Gaussian
32 random variates is,
33
34 p(x) dx = {1 \over \sqrt{2 \pi \sigma^2}} \exp (-x^2 / 2\sigma^2) dx
35
36 for x in the range -\infty to +\infty. Use the transformation z = \mu
37 + x on the numbers returned by gsl_ran_gaussian to obtain a Gaussian
38 distribution with mean \mu. This function uses the Box-Mueller
39 algorithm which requires two calls to the random number generator r.
40
41 */
42
8299295 @schwehr Much improved LoadS
authored Nov 4, 2004
43 // c library includes
b155d68 @schwehr Initial revision
authored Sep 9, 2004
44 #include <gsl/gsl_rng.h>
45 #include <gsl/gsl_randist.h>
46
8299295 @schwehr Much improved LoadS
authored Nov 4, 2004
47 // c++ includes
b155d68 @schwehr Initial revision
authored Sep 9, 2004
48 #include <iostream>
20d9616 @schwehr major cleanup. Moved code to BootStrap
authored Sep 13, 2004
49 #include <iomanip>
d290f0c @schwehr Starting to get Test1() going. Only does sitesigma so far.
authored Sep 9, 2004
50 #include <fstream>
20d9616 @schwehr major cleanup. Moved code to BootStrap
authored Sep 13, 2004
51 #include <string>
8299295 @schwehr Much improved LoadS
authored Nov 4, 2004
52 #include <sstream> // string stream
d290f0c @schwehr Starting to get Test1() going. Only does sitesigma so far.
authored Sep 9, 2004
53
8299295 @schwehr Much improved LoadS
authored Nov 4, 2004
54 // local includes
d290f0c @schwehr Starting to get Test1() going. Only does sitesigma so far.
authored Sep 9, 2004
55 #include "kdsPmagL.H" // L is for local
56 #include "SiteSigma.H"
e6fae9e @schwehr Pulled a lot of code out to Bootstrap.[CH]
authored Sep 10, 2004
57 #include "Bootstrap.H"
cd6223e @schwehr Removed isEqual. Now in VecAngle.H
authored Oct 26, 2004
58 #include "VecAngle.H" // ldi2xyz() and xyz2tpr()
b155d68 @schwehr Initial revision
authored Sep 9, 2004
59
60 using namespace std;
61
815f89e @schwehr Version 0.4. Now has verbosity and debug.H
authored Oct 8, 2004
62
63 /***************************************************************************
64 * LOCAL MACROS and DEFINES
65 ***************************************************************************/
66
67 #include "debug.H" // provides FAILED_HERE, UNUSED, DebugPrintf
c352d90 @schwehr Allows verbosity to control ticks every so many samples drawn
authored Oct 16, 2004
68 //#ifndef NDEBUG
69 // Can be used even in non-debug mode for huge runs
815f89e @schwehr Version 0.4. Now has verbosity and debug.H
authored Oct 8, 2004
70 int debug_level;
c352d90 @schwehr Allows verbosity to control ticks every so many samples drawn
authored Oct 16, 2004
71 //#endif
815f89e @schwehr Version 0.4. Now has verbosity and debug.H
authored Oct 8, 2004
72
73 /***************************************************************************
74 * GLOBALS
75 ***************************************************************************/
76
77 /// Let the debugger find out which version is being used.
78 static const UNUSED char* RCSid ="@(#) $Id$";
79
80 /***************************************************************************
81 * LOCAL FUNCTIONS
82 ***************************************************************************/
83
84
d290f0c @schwehr Starting to get Test1() going. Only does sitesigma so far.
authored Sep 9, 2004
85
6a68b67 @schwehr Fixed doxygen compaints
authored Oct 13, 2004
86 /// \brief load ascii whitespace delimited text into vectors.
87 /// \return \a true if all went well. \a false if trouble of any kind
88 /// \param filename File to open and read data from
89 /// \param s Return vector of data. The \a s diagonalized matrix parameters. See s_eigs
b7b7606 @schwehr fixups of DebugPrintf
authored Oct 16, 2004
90 /// \param sigmas Return vector of sigma errors
6a68b67 @schwehr Fixed doxygen compaints
authored Oct 13, 2004
91 ///
92 /// Unlike Lisa's code, this one does NOT alter the sigmas on loading
93 /// which is what the adread subroutine did.`
94 /// You must call SiteSigma if doing a Site based Parametric Bootstrap
d290f0c @schwehr Starting to get Test1() going. Only does sitesigma so far.
authored Sep 9, 2004
95 bool
96 LoadS(const string filename,vector <SVec> &s,vector<float> &sigmas) {
97 ifstream in(filename.c_str(),ios::in);
98 if (!bool(in)) {cerr << "failed to open file: " << filename << endl; return false; }
99
100 // FIX: detect formats - {s[6]}, {s[6],sigma}, {name, sigma, s[6]}
101 // FIX: only do {s[6],sigma} for now
e6fae9e @schwehr Pulled a lot of code out to Bootstrap.[CH]
authored Sep 10, 2004
102 SVec tmp(6,0.); float tmpSigma;
8299295 @schwehr Much improved LoadS
authored Nov 4, 2004
103
104 #if 1
105 char buf[1024];
106 while (in.getline(buf,1024)) {
107 if ('#'==buf[0]) continue; // Comment
108 istringstream istr(buf);
109 istr >> tmp[0] >> tmp[1] >> tmp[2] >> tmp[3] >> tmp[4] >> tmp[5] >> tmpSigma;
110 // FIX: add better error checking
111 assert (1.0>tmp[0]); assert (1.0>tmp[1]); assert (1.0>tmp[2]);
112 assert(1.01>tmp[0]+tmp[1]+tmp[2]);
113 s.push_back(tmp);
114 sigmas.push_back(tmpSigma);
115 }
116 #else
117 // This fails when there is a name in the last position
d290f0c @schwehr Starting to get Test1() going. Only does sitesigma so far.
authored Sep 9, 2004
118 while (in >> tmp[0] >> tmp[1] >> tmp[2] >> tmp[3] >> tmp[4] >> tmp[5] >> tmpSigma) {
c0bf75d @schwehr Aggressive naming of 1-Vmax 2-Vint 3-Vmin
authored Oct 15, 2004
119 s.push_back(tmp);
120 sigmas.push_back(tmpSigma);
d290f0c @schwehr Starting to get Test1() going. Only does sitesigma so far.
authored Sep 9, 2004
121 }
8299295 @schwehr Much improved LoadS
authored Nov 4, 2004
122 #endif
123
124 DebugPrintf (VERBOSE,("LoadS lines read: %d\n",int(s.size())));
125
e6fae9e @schwehr Pulled a lot of code out to Bootstrap.[CH]
authored Sep 10, 2004
126 // FIX: do we need to normalize so that the trace is 1?
127 // Not all data will have a trace==1??
d290f0c @schwehr Starting to get Test1() going. Only does sitesigma so far.
authored Sep 9, 2004
128 return (true);
129 }
130
e6fae9e @schwehr Pulled a lot of code out to Bootstrap.[CH]
authored Sep 10, 2004
131 //////////////////////////////////////////////////////////////////////
132 // MAIN
133 //////////////////////////////////////////////////////////////////////
134 #ifndef REGRESSION_TEST // NOT testing
d290f0c @schwehr Starting to get Test1() going. Only does sitesigma so far.
authored Sep 9, 2004
135
6a68b67 @schwehr Fixed doxygen compaints
authored Oct 13, 2004
136 /// \brief What kind of boot strap to do?
137 ///
138 /// \a Site parametic looks at all the data and uses the Hext method to
139 /// create one sigma that is applied to all samples.
140 ///
141 /// \a Sample parametric uses the sigma at the end of each sample
142 /// (possition 7) to make a new sample that particular measurement.
143
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
144 enum BootTypeEnum { BAD_PARAMETRIC, SITE_PARAMETRIC, SAMPLE_PARAMETRIC };
145 enum FormatEnum {BAD_FORMAT, XYZ_FORMAT,TPR_FORMAT,S_FORMAT};
146 #include "s_bootstrap_cmd.h" // Command line args
147 #include "Eigs.H" // Let's us convert to other coords
148
188455c @schwehr Now uses unamed input
authored Oct 11, 2004
149 bool GetFiles(const size_t numArg, char **in_arg,vector<string> &inFiles) {
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
150 assert(in_arg);
151 assert(*in_arg); // Must be at least 1 file in!
188455c @schwehr Now uses unamed input
authored Oct 11, 2004
152 for (size_t i=0; i<numArg;i++) inFiles.push_back(string(in_arg[i]));
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
153 return (true);
154 }
155
156 BootTypeEnum GetParametricType(const int site_given, const int sample_given) {
157 if (site_given && sample_given) {
158 cerr << "ERROR: can not specify both site and sample paramteric bootstrap" <<endl;
159 exit (EXIT_FAILURE);
160 } else if (site_given) return(SITE_PARAMETRIC);
161 return(SAMPLE_PARAMETRIC); // default
162 }
163
164
165 FormatEnum GetFormat(const char *format_arg) {
166 assert(format_arg);
167 string format(format_arg);
168 if (0==string("s").compare(format)) return(S_FORMAT);
169 if (0==string("tpr").compare(format)) return(TPR_FORMAT);
170 if (0==string("xyz").compare(format)) return(XYZ_FORMAT);
171 cerr << "ERROR: format must be one of s, tpr, or xyz" << endl;
172 exit(EXIT_FAILURE);
173 //return(BAD_FORMAT);
174 }
175
6a68b67 @schwehr Fixed doxygen compaints
authored Oct 13, 2004
176 /// \brief Actually do the boot strap
177 /// \param inFiles vector of files to read in and bootstrap
c0bf75d @schwehr Aggressive naming of 1-Vmax 2-Vint 3-Vmin
authored Oct 15, 2004
178 /// \param out1Max, out2Int, out3Min Each of the streams to write to. vmax,
179 /// vint, vmin. Make them all the same and set oneFile true to get
180 /// one file will all 9 parameters
6a68b67 @schwehr Fixed doxygen compaints
authored Oct 13, 2004
181 /// \param numout_arg 1 if out1, out2, and out3 are all the same file, otherwise should be 3
182 /// \param format How do we want the output to look. (S, XYZ, other some other day)
183 /// \param type PARAMETRIC_SITE or PARAMETRIC_SAMPLE
184 /// \param draw How many sample to draw out of the magic hat
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
185 bool DoS_Bootstrap(const vector<string> &inFiles,
c0bf75d @schwehr Aggressive naming of 1-Vmax 2-Vint 3-Vmin
authored Oct 15, 2004
186 ofstream &out1Max, ofstream &out2Int, ofstream &out3Min,
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
187 const int numout_arg, const FormatEnum format, const BootTypeEnum type,
188 const int draw)
189 {
190 bool ok=true;
191 assert(1==numout_arg || 3==numout_arg);
192 assert(0<draw);
193
194 // Setup random number generator
195 gsl_rng * r; /* global generator */
196 const gsl_rng_type *T;
197 gsl_rng_env_setup();
198 T = gsl_rng_default;
199 r = gsl_rng_alloc (T);
200 { unsigned long int s; getDevRandom(s); gsl_rng_set (r, s); } // Set the Seed
201
202 S_Engine sengine; // For converting to xyz or ptr
203
204 vector<SVec> s;
205 vector<float> sigmas;
206
207 vector<float> Vmin(3,0), Vint(3,0), Vmax(3,0); // for xyz or tpr
208
209 for(size_t i=0;i<inFiles.size();i++) {
b7b7606 @schwehr fixups of DebugPrintf
authored Oct 16, 2004
210 DebugPrintf (TRACE,("Reading file: %s\n",inFiles[i].c_str()));
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
211 s.clear(); sigmas.clear();
212 if (!LoadS(inFiles[i],s,sigmas)) {
213 cerr << "ERROR - can't load datafile, skipping: " << inFiles[i] << endl;
214 ok=false; continue;
215 }
216
217 const float siteSigma = (SITE_PARAMETRIC==type)?SiteSigma(s):-666.;
218
219 SVec newSample(6,0.);
c0bf75d @schwehr Aggressive naming of 1-Vmax 2-Vint 3-Vmin
authored Oct 15, 2004
220 out1Max << setiosflags(ios::fixed) << setprecision(10);
221 out2Int << setiosflags(ios::fixed) << setprecision(10);
222 out3Min << setiosflags(ios::fixed) << setprecision(10);
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
223
224 // Draw out and bootstrap 'draw' number of samples
225 for (size_t i=0;i<size_t(draw); i++) {
c352d90 @schwehr Allows verbosity to control ticks every so many samples drawn
authored Oct 16, 2004
226 if (10<=debug_level) { if (0==i%100000) cout << i <<" "<<i/float(draw) << endl; }
227 else if (4<=debug_level) { if (0==i%1000000) cout << i <<" "<<i/float(draw) << endl; }
228
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
229 switch (type) {
230 case SITE_PARAMETRIC: BootstrapParametricSite (s,siteSigma,newSample, r); break;
231 case SAMPLE_PARAMETRIC: BootstrapParametricSample (s,sigmas ,newSample, r); break;
232 default: assert(false);
233 }
234 // Now what do we do with the new sample?
235 switch(format) {
236 case S_FORMAT:
c0bf75d @schwehr Aggressive naming of 1-Vmax 2-Vint 3-Vmin
authored Oct 15, 2004
237 for (size_t i=0;i<newSample.size();i++) out1Max << newSample[i] << " ";
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
238 break;
239 //case PTR_FORMAT: break; NOT SUPPORTED YET
240 case XYZ_FORMAT:
241 {
242 sengine.setS(newSample);
243 sengine.getXYZ(KMIN, Vmin);
244 sengine.getXYZ(KINT, Vint);
245 sengine.getXYZ(KMAX, Vmax);
246 if (1==numout_arg) {
c0bf75d @schwehr Aggressive naming of 1-Vmax 2-Vint 3-Vmin
authored Oct 15, 2004
247 for (size_t i=0;i<3;i++) out3Min << Vmin[i] << " "; // V3
248 for (size_t i=0;i<3;i++) out2Int << Vint[i] << " "; // V2
249 for (size_t i=0;i<3;i++) out1Max << Vmax[i] << " "; // V1
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
250 } else {
c0bf75d @schwehr Aggressive naming of 1-Vmax 2-Vint 3-Vmin
authored Oct 15, 2004
251 for (size_t i=0;i<3;i++){out1Max<<Vmax[i]<<" "; out2Int<<Vint[i]<<" "; out3Min<<Vmin[i]<<" ";}
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
252 }
253 } // case XYZ
254 break;
255 default: assert(false && "Hell in a hand basket");
256 }
257
258 switch (numout_arg) {
259d3b9 @schwehr Removed endl flush from file writes. resonable speedup
authored Oct 16, 2004
259 case 1: out1Max << "\n"; break;
260 case 3: out1Max << "\n"; out2Int << "\n"; out3Min << "\n"; break;
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
261 default: assert(false && "What are we gonna do now, man?!?!");
262 }
263 } // for draws
264
265
266
267 } // for inFiles
268
269
270 return (ok);
271 }
272
273 //////////////////////////////////////////////////////////////////////
815f89e @schwehr Version 0.4. Now has verbosity and debug.H
authored Oct 8, 2004
274 // MAIN
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
275 //////////////////////////////////////////////////////////////////////
276
277 int main (const int argc, char *argv[]) {
278 bool ok=true;
b155d68 @schwehr Initial revision
authored Sep 9, 2004
279
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
280 gengetopt_args_info a;
281 if (0!=cmdline_parser(argc,argv,&a)) {
282 cerr << "FIX: should never get here" << endl;
283 cerr << "Early exit" << endl;
284 return (EXIT_FAILURE);
285 }
286
c352d90 @schwehr Allows verbosity to control ticks every so many samples drawn
authored Oct 16, 2004
287 //#ifdef NDEBUG
288 //if (a.verbosity_given) {
289 // cerr << "Verbosity is totally ignored for optimized code. Continuing in silent mode" << endl;
290 //}
291 //#else // debugging
292 debug_level = a.verbosity_arg; // now used even in OPTIMIZE mode
b7b7606 @schwehr fixups of DebugPrintf
authored Oct 16, 2004
293 DebugPrintf(TRACE,("Debug level = %d\n",debug_level));
c352d90 @schwehr Allows verbosity to control ticks every so many samples drawn
authored Oct 16, 2004
294 //#endif
815f89e @schwehr Version 0.4. Now has verbosity and debug.H
authored Oct 8, 2004
295
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
296 vector<string> inFiles;
188455c @schwehr Now uses unamed input
authored Oct 11, 2004
297 if (0==a.inputs_num) {cerr << "ERROR: must specify at least one input file" << endl; return(EXIT_FAILURE);}
298 if (!GetFiles(a.inputs_num,a.inputs,inFiles)) {cerr << "Doh! What happened?" << endl; return(EXIT_FAILURE);}
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
299
300 if (1!=a.numout_arg && 3!=a.numout_arg) {
301 cerr << "ERROR: numout must be either 1 or 3" << endl
302 << " found: " << a.numout_arg << endl;
303 return(EXIT_FAILURE);
304 }
305
306 const FormatEnum format = GetFormat(a.format_arg);
b7b7606 @schwehr fixups of DebugPrintf
authored Oct 16, 2004
307 DebugPrintf(VERBOSE,("format: %s (%d)\n",a.format_arg,int(format)));
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
308
309 // Can't have S_FORMAT and 3 outfiles. Does not make sense!!!
310 if (3==a.numout_arg && S_FORMAT==format) {
311 cerr << "ERROR: you can't have 3 output files with the S_FORMAT." << endl
312 << " That would be ludicrous" << endl;
313 return (EXIT_FAILURE);
314 }
315
316
317 const BootTypeEnum type = GetParametricType(a.site_given,a.sample_given);
318 #ifndef NDEBUG
c0bf75d @schwehr Aggressive naming of 1-Vmax 2-Vint 3-Vmin
authored Oct 15, 2004
319 if (debug_level > TRACE)
320 cerr << "Bootstrap type: " << (SITE_PARAMETRIC==type?"site":"sample") << " parametric"<<endl;
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
321 #endif
322
323 if (1==a.numout_arg) {
324 // just one file
325 ofstream out(a.out_arg,ios::out);
326 if (out.is_open()) {
327 if (!DoS_Bootstrap(inFiles, out,out,out, a.numout_arg, format, type, a.draw_arg)) {
328 ok=false; cerr << "ERROR: " << argv[0] << " failed in bootstrap routine." << endl;
329 }
330 } else {ok=false; cerr << "Failed to open output file" << endl;}
331 } else {
332 // 3 different files.
c0bf75d @schwehr Aggressive naming of 1-Vmax 2-Vint 3-Vmin
authored Oct 15, 2004
333 const string o1NameMax(string(a.out_arg)+string("1.vmax"));
334 const string o2NameInt(string(a.out_arg)+string("2.vint"));
335 const string o3NameMin(string(a.out_arg)+string("3.vmin"));
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
336
c0bf75d @schwehr Aggressive naming of 1-Vmax 2-Vint 3-Vmin
authored Oct 15, 2004
337 ofstream o1Max(o1NameMax.c_str(),ios::out);
338 ofstream o2Int(o2NameInt.c_str(),ios::out);
339 ofstream o3Min(o3NameMin.c_str(),ios::out);
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
340
c0bf75d @schwehr Aggressive naming of 1-Vmax 2-Vint 3-Vmin
authored Oct 15, 2004
341 if (!o1Max.is_open() || !o2Int.is_open() || !o3Min.is_open() ) ok=false;
342 if (ok && !DoS_Bootstrap(inFiles, o1Max,o2Int,o3Min, a.numout_arg, format, type, a.draw_arg)) {
c62545f @schwehr Works with the new UI.
authored Oct 6, 2004
343 ok=false; cerr << "ERROR: " << argv[0] << " failed in bootstrap routine." << endl;
344 }
345 }
346
347 return (ok?EXIT_SUCCESS:EXIT_FAILURE);
a6ea48a @schwehr removed old UI.
authored Oct 6, 2004
348 } // main
20d9616 @schwehr major cleanup. Moved code to BootStrap
authored Sep 13, 2004
349
d290f0c @schwehr Starting to get Test1() going. Only does sitesigma so far.
authored Sep 9, 2004
350 #endif // !REGRESSION_TEST
351
352 //////////////////////////////////////////////////////////////////////
353 // REGRESSION TESTS
354 //////////////////////////////////////////////////////////////////////
355
356 #ifdef REGRESSION_TEST
357
358 bool Test1 (void) {
359 vector<SVec> s;
360 vector<float> sigmas;
361 if (!LoadS(string("as1-crypt.s"),s,sigmas)) {FAILED_HERE; return false;};
e6fae9e @schwehr Pulled a lot of code out to Bootstrap.[CH]
authored Sep 10, 2004
362
d290f0c @schwehr Starting to get Test1() going. Only does sitesigma so far.
authored Sep 9, 2004
363 const float siteSigma = SiteSigma(s);
364 const float expectedSiteSigma = 0.00133387523;
365 if (!isEqual(siteSigma, expectedSiteSigma, 0.000001)) {FAILED_HERE; return false;}
e6fae9e @schwehr Pulled a lot of code out to Bootstrap.[CH]
authored Sep 10, 2004
366
367 gsl_rng *r;
368 const gsl_rng_type *T;
369 gsl_rng_env_setup();
370 T = gsl_rng_default;
371 r = gsl_rng_alloc (T);
372 // Let it always start with the same value
373 gsl_rng_set(r,0);
374 //{ unsigned long int seed; getDevRandom(seed); gsl_rng_set(r,s); }
375
376 SVec newSample;
377 const size_t siteNum = BootstrapParametricSite (s,siteSigma,newSample, r);
378 cout << "Site boot picked sample " << siteNum << endl;
379 const size_t sampleNum = BootstrapParametricSample(s,sigmas ,newSample, r);
380 cout << "Sample boot picked sample " << sampleNum << endl;
381
d290f0c @schwehr Starting to get Test1() going. Only does sitesigma so far.
authored Sep 9, 2004
382 return (true);
383 }
384
e6fae9e @schwehr Pulled a lot of code out to Bootstrap.[CH]
authored Sep 10, 2004
385 bool Test2 () {
386 { char a; cout << " devRandom char : " << short(getDevRandom (a)) << endl; }
387 { short a; cout << " devRandom short : " << getDevRandom (a) << endl; }
388 { int a; cout << " devRandom int : " << getDevRandom (a) << endl; }
389 { long a; cout << " devRandom long : " << getDevRandom (a) << endl; }
390 { float a; cout << " devRandom float : " << getDevRandom (a) << endl; }
391 { double a; cout << " devRandom double: " << getDevRandom (a) << endl; }
392 return (true);
393 }
d290f0c @schwehr Starting to get Test1() going. Only does sitesigma so far.
authored Sep 9, 2004
394
395 int main(UNUSED int argc, char *argv[]) {
396 bool ok=true;
397
398 if (!Test1()) {FAILED_HERE;ok=false;};
e6fae9e @schwehr Pulled a lot of code out to Bootstrap.[CH]
authored Sep 10, 2004
399 if (!Test2()) {FAILED_HERE;ok=false;};
d290f0c @schwehr Starting to get Test1() going. Only does sitesigma so far.
authored Sep 9, 2004
400
401 cout << argv[0] << " :" << (ok?"ok":"FAILED") << endl;
402 return (ok?EXIT_SUCCESS:EXIT_FAILURE);
403 }
404 #endif // REGRESSION_TEST
Something went wrong with that request. Please try again.