Changeset 450

Show
Ignore:
Timestamp:
07/29/09 15:39:19 (15 years ago)
Author:
vbarta
Message:

removed enorm<sq_T>::sample(int) - now spelled sample_m, inherited

Location:
library
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • library/bdm/stat/exp_family.h

    r429 r450  
    142142 
    143143                        vec sample() const; 
    144                         mat sample ( int N ) const; 
     144 
    145145                        double evallog_nn ( const vec &val ) const; 
    146146                        double lognc () const; 
     
    12091209        }; 
    12101210 
    1211         template<class sq_T> 
    1212         mat enorm<sq_T>::sample ( int N ) const 
    1213         { 
    1214                 mat X ( dim,N ); 
    1215                 vec x ( dim ); 
    1216                 vec pom; 
    1217                 int i; 
    1218  
    1219                 for ( i=0;i<N;i++ ) 
    1220                 { 
    1221 #pragma omp critical 
    1222                         NorRNG.sample_vector ( dim,x ); 
    1223                         pom = R.sqrt_mult ( x ); 
    1224                         pom +=mu; 
    1225                         X.set_col ( i, pom ); 
    1226                 } 
    1227  
    1228                 return X; 
    1229         }; 
    1230  
    12311211// template<class sq_T> 
    12321212// double enorm<sq_T>::eval ( const vec &val ) const { 
  • library/tests/enorm.cfg

    r444 r450  
    1616  support = ( "matrix", 2, 2, [ -5.0, 5.0, -5.0, 5.0 ] ); 
    1717  integral = 1.0; 
     18  R = ( "matrix", 2, 2, [ 1.0, -0.5, -0.5, 2.0 ] ); 
    1819}, 
    1920{ 
  • library/tests/enorm_test.cpp

    r448 r450  
    5656    } 
    5757} 
    58  
    59 TEST(test_enorm_sample) { 
    60     RNG_randomize(); 
    61  
    62     // Setup model 
    63     vec mu("1.1 -1"); 
    64     ldmat R(mat("1 -0.5; -0.5 2")); 
    65  
    66     RV x("{x }"); 
    67     RV y("{y }"); 
    68  
    69     enorm<ldmat> E; 
    70     E.set_rv(concat(x, y)); 
    71     E.set_parameters(mu, R); 
    72  
    73     int n = 1000; 
    74     vec ll(n); 
    75     mat smp = E.sample(1000); 
    76     vec emu = sum(smp, 2) / n; 
    77     CHECK_CLOSE(mu, emu, 0.3); 
    78  
    79     mat er = (smp * smp.T()) / n - outer_product(emu, emu); 
    80     CHECK_CLOSE(R.to_mat(), er, 0.3); 
    81 } 
  • library/tests/testSmp.cpp

    r394 r450  
    3434        enorm<ldmat> eN; 
    3535        eN.set_parameters(mu0,R); 
    36         mat Smp = eN.sample(N); 
     36        mat Smp = eN.sample_m(N); 
    3737 
    3838        disp(mu0,R.to_mat(),Smp);