Changeset 26575


Ignore:
Timestamp:
11/09/21 10:58:56 (3 years ago)
Author:
bulthuis
Message:

BUG: Try to fix bugs on tests

Location:
issm/trunk-jpl/src/c
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/shared/Random/randomgenerator.cpp

    r26574 r26575  
    99#define M_PI 3.141592653589793238462643
    1010
    11 namespace rdn
    12 {
    13         uniform_distribution::uniform_distribution(){/*{{{*/
     11
     12uniform_distribution_rnd::uniform_distribution_rnd(){/*{{{*/
    1413
    1514                a   = 1103515245;       // BSD Formula
     
    2019                ubound = 1.0;
    2120                return;
    22         }
     21}
    2322        /*}}}*/
    24         uniform_distribution::uniform_distribution(double lower,double upper){/*{{{*/
     23uniform_distribution_rnd::uniform_distribution_rnd(double lower,double upper){/*{{{*/
    2524
    2625                a   = 1103515245;               // BSD Formula
     
    3130                ubound = upper;
    3231                return;
    33         }
     32}
    3433        /*}}}*/
    35         uniform_distribution::~uniform_distribution(){}
    36         void uniform_distribution::seed( unsigned int s ) { _seed = s; }
    37         unsigned int uniform_distribution::get_seed() { return _seed; }
    38         double uniform_distribution::generator() {
     34uniform_distribution_rnd::~uniform_distribution_rnd(){}
     35void uniform_distribution_rnd::seed( unsigned int s ) { _seed = s; }
     36unsigned int uniform_distribution_rnd::get_seed() { return _seed; }
     37double uniform_distribution_rnd::generator() {
    3938                _seed = ( a * _seed + c ) % m ;
    4039                return (ubound-lbound)*(double) _seed/ m + lbound;
    41         }
     40}
    4241
    4342
    44         normal_distribution::normal_distribution(){/*{{{*/
     43normal_distribution_rnd::normal_distribution_rnd(){/*{{{*/
    4544
    4645                _seed = 0;
     
    4847                sdev  = 1.0;
    4948                return;
    50         }
    51         /*}}}*/
    52         normal_distribution::normal_distribution(double m,double s){/*{{{*/
     49}
     50/*}}}*/
     51normal_distribution_rnd::normal_distribution_rnd(double m,double s){/*{{{*/
    5352
    5453                _seed = 0;
     
    5655                sdev  = s;
    5756                return;
    58         }
     57}
    5958        /*}}}*/
    60         normal_distribution::~normal_distribution(){}
    61         void normal_distribution::seed( unsigned int s ) { _seed = s; }
    62         double normal_distribution::generator(){/*{{{*/
     59normal_distribution_rnd::~normal_distribution_rnd(){}
     60void normal_distribution_rnd::seed( unsigned int s ) { _seed = s; }
     61double normal_distribution_rnd::generator(){/*{{{*/
    6362
    64                 uniform_distribution unifdistri;
     63                uniform_distribution_rnd unifdistri;
    6564                unifdistri.seed(_seed);
    6665
     
    7776        }
    7877        /*}}}*/
    79 }
  • issm/trunk-jpl/src/c/shared/Random/randomgenerator.h

    r26574 r26575  
    66#define _RANDOMGENERATOR_H_
    77
    8 namespace rdn
     8class uniform_distribution_rnd
    99{
    10   class uniform_distribution
    11   {
    1210
    1311    private:
     
    2321
    2422      /*constructors, destructors: */
    25       uniform_distribution();
    26       uniform_distribution(double a_1, double a_2);
    27       ~uniform_distribution();
     23      uniform_distribution_rnd();
     24      uniform_distribution_rnd(double a_1, double a_2);
     25      ~uniform_distribution_rnd();
    2826
    2927      void seed( unsigned int s );
     
    3129      double generator();
    3230
    33   };
     31};
    3432
    35   class normal_distribution
    36   {
     33class normal_distribution_rnd
     34{
    3735
    3836    private:
     
    4442
    4543      /*constructors, destructors: */
    46       normal_distribution();
    47       normal_distribution(double m,double s);
    48       ~normal_distribution();
     44      normal_distribution_rnd();
     45      normal_distribution_rnd(double m,double s);
     46      ~normal_distribution_rnd();
    4947
    5048      void seed( unsigned int s );
    5149      double generator();
    5250
    53   };
     51};
    5452
    55 
    56 }
    5753#endif //ifndef _RANDOMGENERATOR_H_
  • issm/trunk-jpl/src/c/solutionsequences/solutionsequence_sampling.cpp

    r26574 r26575  
    1818
    1919        /*Define seed*/
    20         rdn::normal_distribution distribution;
     20        normal_distribution_rnd distribution;
    2121        if(seed<0){
    2222                std::random_device rd;
Note: See TracChangeset for help on using the changeset viewer.