-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsog_test.cpp
More file actions
38 lines (29 loc) · 707 Bytes
/
Copy pathsog_test.cpp
File metadata and controls
38 lines (29 loc) · 707 Bytes
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
// Joshua L. Phillips
// 10-15-2014
// SumofGaussians example
// Released to public domain
#include <iostream>
#include <cstdlib>
#include "SumofGaussians.h"
using namespace std;
int main(int argc, char* argv[]) {
int seed = atoi(argv[1]);
int dims = atoi(argv[2]);
int ncenters = atoi(argv[3]);
srand(seed);
SumofGaussians sog(dims,ncenters);
double input[dims];
double dz[dims];
for (int x = 0; x < dims; x++)
cin >> input[x];
while (!cin.eof()) {
cout << sog.eval(input) << " ";
sog.deriv(input,dz);
for (int x = 0; x < dims; x++)
cout << dz[x] << " ";
cout << endl;
for (int x = 0; x < dims; x++)
cin >> input[x];
}
return 0;
}