Revision 467, 490 bytes
(checked in by vbarta, 15 years ago)
|
added a program (square_mat_prep) to generate configurably random matrices, changed square_mat_stress to use the generated agenda
|
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"); |
---|
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 | if (set.exists("lambda")) { |
---|
17 | UI::get(lambda, set, "lambda"); |
---|
18 | } |
---|
19 | } |
---|
20 | |
---|
21 | mat additive_generator::next() { |
---|
22 | mat b = a; |
---|
23 | a = (1 - lambda) * a + lambda * v2; |
---|
24 | return b; |
---|
25 | } |
---|