Revision 717, 491 bytes
(checked in by mido, 15 years ago)
|
clean up of the whole tests directory has just started
|
Line | |
---|
1 | #include "additive_generator.h" |
---|
2 | #include "base/user_info.h" |
---|
3 | |
---|
4 | using namespace itpp; |
---|
5 | using bdm::UI; |
---|
6 | |
---|
7 | void 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 | |
---|
19 | mat additive_generator::next() { |
---|
20 | mat b = a; |
---|
21 | a = ( 1 - lambda ) * a + lambda * v2; |
---|
22 | return b; |
---|
23 | } |
---|