Show
Ignore:
Timestamp:
06/09/10 14:00:40 (14 years ago)
Author:
mido
Message:

astyle applied all over the library

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • library/tests/stresssuite/arx_stress.cpp

    r766 r1064  
    1717 
    1818TEST ( arx_stress ) { 
    19         // Setup model 
    20         vec th ( "0.8 -0.3 0.4 0.01" ); 
    21         int ord = th.length(); //auxiliary variable 
    22         double sqr = 0.1; 
     19    // Setup model 
     20    vec th ( "0.8 -0.3 0.4 0.01" ); 
     21    int ord = th.length(); //auxiliary variable 
     22    double sqr = 0.1; 
    2323 
    24         //Test constructor 
    25         mat V0 = 0.00001 * eye ( ord + 1 ); 
    26         V0 ( 0 ) = 1; // 
    27         double nu0 = ord + 5.0; 
     24    //Test constructor 
     25    mat V0 = 0.00001 * eye ( ord + 1 ); 
     26    V0 ( 0 ) = 1; // 
     27    double nu0 = ord + 5.0; 
    2828 
    29         ARX Ar; 
    30         Ar.set_statistics ( 1, V0, nu0 );               // Estimator 
    31         Ar.set_constant ( false ); 
    32         Ar.validate(); 
    33         const epdf& f_thr = Ar.posterior();          // refrence to posterior of the estimator 
     29    ARX Ar; 
     30    Ar.set_statistics ( 1, V0, nu0 );               // Estimator 
     31    Ar.set_constant ( false ); 
     32    Ar.validate(); 
     33    const epdf& f_thr = Ar.posterior();          // refrence to posterior of the estimator 
    3434 
    35         //Test estimation 
    36         int ndat = 100;                 // number of data records 
    37         vec Yt ( ndat );                // Store generated data 
    38         Yt.set_subvector ( 0, randn ( ord ) ); //initial values 
    39         vec rgr ( ord );                // regressor 
     35    //Test estimation 
     36    int ndat = 100;                 // number of data records 
     37    vec Yt ( ndat );                // Store generated data 
     38    Yt.set_subvector ( 0, randn ( ord ) ); //initial values 
     39    vec rgr ( ord );                // regressor 
    4040 
    41         //print moments of the prior distribution 
    42         cout << "prior mean: " << f_thr.mean() << endl; 
    43         cout << "prior variance: " << f_thr.variance() << endl; 
     41    //print moments of the prior distribution 
     42    cout << "prior mean: " << f_thr.mean() << endl; 
     43    cout << "prior variance: " << f_thr.variance() << endl; 
    4444 
    45         // cycle over time: 
    46         for ( int t = ord; t < ndat; t++ ) { 
    47                 //Generate regressor 
    48                 for ( int j = 0; j < ( ord ); j++ ) { 
    49                         rgr ( j ) = Yt ( t - j - 1 ); 
    50                 } 
    51                 //model 
    52                 Yt ( t ) = th * rgr + sqr * NorRNG(); 
     45    // cycle over time: 
     46    for ( int t = ord; t < ndat; t++ ) { 
     47        //Generate regressor 
     48        for ( int j = 0; j < ( ord ); j++ ) { 
     49            rgr ( j ) = Yt ( t - j - 1 ); 
     50        } 
     51        //model 
     52        Yt ( t ) = th * rgr + sqr * NorRNG(); 
    5353 
    54                 Ar.bayes ( vec_1 ( Yt ( t ) ), rgr );       // Bayes rule 
     54        Ar.bayes ( vec_1 ( Yt ( t ) ), rgr );       // Bayes rule 
    5555 
    56                 // Build predictor 
    57                 mlstudent*      Pr = Ar.predictor_student ( ); 
    58                 // Test similarity of likelihoods from the Bayes rule and the predictor 
    59                 cout << "BR log-lik: " << Ar._ll(); 
    60                 cout << " , predictor ll: " <<  Pr->evallogcond ( vec_1 ( Yt ( t ) ), rgr )  << endl; 
    61                 delete Pr; 
    62         } 
    63         //print posterior moments 
    64         cout << "posterior mean: " << f_thr.mean() << endl; 
    65         cout << "posterior variance: " << f_thr.variance() << endl; 
     56        // Build predictor 
     57        mlstudent*      Pr = Ar.predictor_student ( ); 
     58        // Test similarity of likelihoods from the Bayes rule and the predictor 
     59        cout << "BR log-lik: " << Ar._ll(); 
     60        cout << " , predictor ll: " <<  Pr->evallogcond ( vec_1 ( Yt ( t ) ), rgr )  << endl; 
     61        delete Pr; 
     62    } 
     63    //print posterior moments 
     64    cout << "posterior mean: " << f_thr.mean() << endl; 
     65    cout << "posterior variance: " << f_thr.variance() << endl; 
    6666 
    67         // Test brute-froce structure estimation 
     67    // Test brute-froce structure estimation 
    6868 
    69         cout << "Structure estimation: " << endl; 
    70         cout << Ar.structure_est ( egiw ( 1, V0, nu0 ) ) << endl; 
     69    cout << "Structure estimation: " << endl; 
     70    cout << Ar.structure_est ( egiw ( 1, V0, nu0 ) ) << endl; 
    7171}