paradiseo/test/eo/t-eoRNG.cpp
Adèle Harrissart 490e837f7a * New tree configuration of the project:
.../
   ...           + -- EO
   |             |
   |             |
   +-- src ----- + -- EDO
   |             |
   |             |
   +-- test      + -- MO
   |             |
   |             |
   +-- tutorial  + -- MOEO
   |             |
   |             |
   +-- doc       + -- SMP
   |             |
   |             |
   ...           + -- EOMPI
                 |
                 |
                 + -- EOSERIAL

Question for current maintainers: ./README: new release?

Also:

* Moving out eompi & eoserial modules (issue #2).

* Correction of the errors when executing "make doc" command.

* Adding a solution for the conflicting headers problem (see the two CMake Cache
 Values: PROJECT_TAG & PROJECT_HRS_INSTALL_SUBPATH) (issue #1)

* Header inclusions:
        ** src: changing absolute paths into relative paths ('#include <...>' -> '#include "..."')
        ** test, tutorial: changing relative paths into absolute paths ('#include "..."' -> '#include <...>')

* Moving out some scripts from EDO -> to the root

* Add a new script for compilation and installation (see build_gcc_linux_install)

* Compilation with uBLAS library or EDO module: now ok

* Minor modifications on README & INSTALL files

* Comment eompi failed tests with no end

*** TODO: CPack (debian (DEB) & RedHat (RPM) packages) (issues #6 & #7) ***
2014-09-06 13:04:35 +02:00

53 lines
1.3 KiB
C++
Executable file

//-----------------------------------------------------------------------------
// t-rng.cpp
//-----------------------------------------------------------------------------
// This file really needs to be implementes usign some stringent tests, for now
// we simply check that the impementation of some methods does generally work...
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <iostream>
#include <paradiseo/eo.h>
#include <paradiseo/eo/utils/eoRNG.h>
using namespace std;
int main()
{
const size_t num(10000);
double mean(100.);
double sigma(5.);
double sum(0.);
for(size_t i=0; i<num; ++i)
sum += abs(rng.normal(sigma));
sum /= double(num);
if(sum > sigma / 0.68) {
cerr << "Normal distribution seems out of bounds; "
<< "rerun to make sure it wasn't a statistical outlier" << endl;
return -1;
}
sum = 0.;
for(size_t i=0; i<num; ++i)
sum += abs(rng.normal(mean, sigma) - mean);
sum /= double(num);
if(sum > sigma / 0.68) {
cerr << "Normal distribution seems out of bounds; "
<< "rerun to make sure it wasn't a statistical outlier" << endl;
return -1;
}
return 0;
}
// Local Variables:
// coding: iso-8859-1
// mode: C++
// c-file-offsets: ((c . 0))
// c-file-style: "Stroustrup"
// fill-column: 80
// End: