-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwlm.cpp
More file actions
64 lines (48 loc) · 1.09 KB
/
Copy pathwlm.cpp
File metadata and controls
64 lines (48 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <iostream>
#include "wlm.hpp"
using namespace std;
int main() {
//
// States
//
// May be initialized with NO length.
State b;
b.insert(1);
b.insert(4);
b.insert(2);
b.insert(2);
// Or we may initialize it with some arbitrary length.
State b2(5);
for (int i = 0; i < 5; i++)
b2[i] = i;
// b2[5] // this would segfault!
cout << "b[1] = " << b[1] << endl
<< "b.toString() -> " << b.toString() << endl
<< endl;
//
// Weights
//
// Weights always requires a filename.
Weight w("weights.txt");
//w.load();
/* Non-zero indicates a file couldn't be loaded. Probably means
we need to initialize some values. */
/*
if (w.load())
{
w.insert(1);
w.insert(3);
w.insert(4);
w.insert(5);
}
*/
cout << "w[1] = " << w[1] << endl;
cout << "w.toString -> " << w.toString() << endl
<< endl;
cout << "Vhat(b) where b = " << b.toString() << endl
<< " and w = " << w.toString() << endl
<< "Vhat(b) -> " << w.Vhat(b) << endl;
w.save();
cout << w.random() << endl;
return 0;
}