root/library/tests/additive_generator.cpp @ 560

Revision 480, 468 bytes (checked in by vbarta, 15 years ago)

fixed tests for new UI::get & UI::build

Line 
1#include "additive_generator.h"
2#include "base/user_info.h"
3
4using namespace itpp;
5using bdm::UI;
6
7void additive_generator::from_setting ( const Setting &set ) {
8        int sz;
9        UI::get ( sz, set, "size", UI::compulsory );
10
11        mat a0 = randu ( sz, sz );
12        a = a0 * a0.T();
13        vec v = randu ( sz );
14        v2 = outer_product ( v, v );
15
16        UI::get ( lambda, set, "lambda", UI::optional );
17}
18
19mat additive_generator::next() {
20        mat b = a;
21        a = ( 1 - lambda ) * a + lambda * v2;
22        return b;
23}
Note: See TracBrowser for help on using the browser.