00001
00002
00003
00004
00005
00006
00007 #include "stdafx.h"
00008 #include <string>
00009 #include <iostream>
00010 #include <sstream>
00011 #include <ctime>
00012
00013
00014 #include "thetaNeuron.h"
00015
00016
00017 using namespace std;
00018
00019 int main()
00020 {
00021
00022 int num_inputs=4;
00023 int num_outputs, num_outputs2;
00024 double ti[]={2, 1, 1.5, 4};
00025 int mts=3;
00026 double mse=0;
00027 double *ts, *ts2, *ts3;
00028 ts=new double[mts];
00029 ts2=new double[mts];
00030 ts3=new double[mts];
00031 double phase;
00032
00033
00034 thetaNeuron tn(num_inputs);
00035
00036
00037 tn.displayThetaNeuron();
00038
00039
00040 phase = tn.getPhase();
00041 cout << "Phase: " << phase << endl << endl;
00042
00043
00044 tn.setMethod(thetaNeuron::Numerical);
00045 num_outputs=tn.runThetaNeuron(ti,ts,mts);
00046
00047
00048 tn.setMethod(thetaNeuron::EventDriven);
00049 num_outputs2=tn.runThetaNeuron(ti,ts2,mts);
00050
00051
00052 if (num_outputs!=num_outputs2) {
00053 cout << "The Two Simulation Methods Produced Different Numbers of Output Spikes!" << endl << endl;
00054 }
00055 else if (num_outputs==0) {
00056 cout << "The Two Simulation Methods Produced No Output Spikes!" << endl << endl;
00057 }
00058 else {
00059 for (int j=0;j<num_outputs;j++) {
00060 mse+=(ts[j]-ts2[j])*(ts[j]-ts2[j]);
00061 }
00062 mse /= num_outputs;
00063 cout << "Output Spike Mean-Squared Error Between Simulation Methods: " << endl << "\t" << mse << endl << endl;
00064 }
00065
00066
00067 if (num_outputs>0) {
00068 cout << "A second neuron is simulated in connection to the output of the previous neuron" << endl;
00069 thetaNeuron tn3(1);
00070 tn3.runThetaNeuron(ts,ts3,mts);
00071 tn3.~thetaNeuron();
00072 }
00073
00074
00075 tn.~thetaNeuron();
00076
00077 system("PAUSE");
00078
00079 return EXIT_SUCCESS;
00080 }