00001 #
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "ArchiveStatistic.h"
00025 #include "Debug.h"
00026
00027
00028 #include <iostream>
00029 using namespace std;
00030
00031
00032
00033
00034
00035
00036
00037 dense_hash_map<unsigned int, bool, hash<unsigned int> >* ArchiveStatistic::neuronIDHashMap;
00038
00039
00040
00041
00042
00043
00044
00045 ArchiveStatistic::ArchiveStatistic(unsigned int* fNeurCount, unsigned int* fNeurTotal){
00046
00047 firingNeuronCount = fNeurCount;
00048 firingNeuronTotal = fNeurTotal;
00049
00050
00051 type = NEURON_ID;
00052 }
00053
00054
00055
00056 ArchiveStatistic::~ArchiveStatistic(){
00057 #ifdef MEMORY_DEBUG
00058 cout<<"DESTROYING ARCHIVE STATISTIC"<<endl;
00059 #endif//MEMORY_DEBUG
00060 }
00061
00062
00063
00064 unsigned int ArchiveStatistic::getID(){
00065 return ID;
00066 }
00067
00068
00069
00070 unsigned int ArchiveStatistic::getType(){
00071 return type;
00072 }
00073
00074
00075
00076
00077 void ArchiveStatistic::recalculate(){
00078 }
00079
00080
00081
00082
00083 void ArchiveStatistic::recalculate(unsigned int){
00084 }
00085
00086
00087
00088
00089 void ArchiveStatistic::recalculateNeuronGrp(){
00090 }
00091
00092
00093
00094
00095 void ArchiveStatistic::resetFiringNeuronCount(){
00096 *firingNeuronCount = 0;
00097 }
00098
00099
00100
00101
00102 void ArchiveStatistic::resetFiringNeuronTotal(){
00103 *firingNeuronTotal = 0;
00104 }
00105
00106
00107
00108 void ArchiveStatistic::setID(unsigned int id){
00109 ID = id;
00110 }
00111
00112
00113
00114
00115
00116
00117
00118 NeuronGrpArchiveStatistic::NeuronGrpArchiveStatistic(unsigned int* fNeurCount, unsigned int* fNeurTotal, unsigned int nGrpID) : ArchiveStatistic(fNeurCount, fNeurTotal) {
00119 type = NEURON_GROUP;
00120 neuronGrpID = nGrpID;
00121 }
00122
00123
00124
00125 NeuronGrpArchiveStatistic::~NeuronGrpArchiveStatistic(){
00126 #ifdef MEMORY_DEBUG
00127 cout<<"DESTROYING NEURON GROUP ARCHIVE STATISTIC"<<endl;
00128 #endif//MEMORY_DEBUG
00129 }
00130
00131
00132
00133 unsigned int NeuronGrpArchiveStatistic::getNeuronGrpID(){
00134 return neuronGrpID;
00135 }
00136
00137
00138
00139
00140
00141
00142 void NeuronGrpArchiveStatistic::recalculateNeuronGrp(){
00143 ++(*firingNeuronCount);
00144 ++(*firingNeuronTotal);
00145
00146 #ifdef ARCHIVE_STATISTICS_DEBUG
00147 cout<<"NeuronGrpArchiveStatistic: Recalculated neuron group. firingNeuronCount = "<<*firingNeuronCount<<"; firingNeuronTotal = "<<*firingNeuronTotal<<endl;
00148 #endif//ARCHIVE_STATISTICS_DEBUG
00149 }
00150
00151
00152
00153
00154 QString NeuronGrpArchiveStatistic::toQString(){
00155 return QString("Neuron ID Error! This class was not created with a string.");
00156 }
00157
00158
00159
00160
00161
00162
00163 RangeArchiveStatistic::RangeArchiveStatistic(unsigned int* fNeurCount, unsigned int* fNeurTotal, unsigned int rLow, unsigned int rHigh) : ArchiveStatistic(fNeurCount, fNeurTotal) {
00164 rangeLow = rLow;
00165 rangeHigh = rHigh;
00166 }
00167
00168
00169
00170 RangeArchiveStatistic::~RangeArchiveStatistic(){
00171 #ifdef MEMORY_DEBUG
00172 cout<<"DESTROYING RANGE ARCHIVE STATISTIC"<<endl;
00173 #endif//MEMORY_DEBUG
00174 }
00175
00176
00177
00178 void RangeArchiveStatistic::recalculate(){
00179 for(unsigned int i=rangeLow; i <= rangeHigh; ++i){
00180 if(neuronIDHashMap->count(i)){
00181 ++(*firingNeuronCount);
00182 ++(*firingNeuronTotal);
00183 }
00184 }
00185 #ifdef ARCHIVE_STATISTICS_DEBUG
00186 cout<<"RangeArchiveStatistic: Recalculated neuron group. firingNeuronCount = "<<*firingNeuronCount<<"; firingNeuronTotal = "<<*firingNeuronTotal<<endl;
00187 #endif//ARCHIVE_STATISTICS_DEBUG
00188 }
00189
00190
00191
00192 QString RangeArchiveStatistic::toQString(){
00193 QString tempStr(QString::number(rangeLow));
00194 tempStr += "-";
00195 tempStr += QString::number(rangeHigh);
00196 return tempStr;
00197 }
00198
00199
00200
00201
00202
00203
00204
00205 AndArchiveStatistic::AndArchiveStatistic(unsigned int* fNeurCount, unsigned int* fNeurTotal, unsigned int fNeurID, unsigned int sNeurID) : ArchiveStatistic(fNeurCount, fNeurTotal) {
00206 firstNeuronID = fNeurID;
00207 secondNeuronID = sNeurID;
00208 }
00209
00210
00211
00212 AndArchiveStatistic::~AndArchiveStatistic(){
00213 #ifdef MEMORY_DEBUG
00214 cout<<"DESTROYING AND ARCHIVE STATISTIC"<<endl;
00215 #endif//MEMORY_DEBUG
00216 }
00217
00218
00219
00220 void AndArchiveStatistic::recalculate(){
00221 if(neuronIDHashMap->count(firstNeuronID) && neuronIDHashMap->count(secondNeuronID)){
00222 ++(*firingNeuronCount);
00223 ++(*firingNeuronTotal);
00224 }
00225 #ifdef ARCHIVE_STATISTICS_DEBUG
00226 cout<<"AndArchiveStatistic: Recalculated neuron group. firingNeuronCount = "<<*firingNeuronCount<<"; firingNeuronTotal = "<<*firingNeuronTotal<<endl;
00227 #endif//ARCHIVE_STATISTICS_DEBUG
00228 }
00229
00230
00231
00232 QString AndArchiveStatistic::toQString(){
00233 QString tempStr(QString::number(firstNeuronID));
00234 tempStr += "&";
00235 tempStr += QString::number(secondNeuronID);
00236 return tempStr;
00237 }
00238
00239
00240
00241
00242
00243
00244
00245 OrArchiveStatistic::OrArchiveStatistic(unsigned int* fNeurCount, unsigned int* fNeurTotal, unsigned int fNeurID, unsigned int sNeurID) : ArchiveStatistic(fNeurCount, fNeurTotal) {
00246 firstNeuronID = fNeurID;
00247 secondNeuronID = sNeurID;
00248 }
00249
00250
00251
00252 OrArchiveStatistic::~OrArchiveStatistic(){
00253 #ifdef MEMORY_DEBUG
00254 cout<<"DESTROYING OR ARCHIVE STATISTIC"<<endl;
00255 #endif//MEMORY_DEBUG
00256 }
00257
00258
00259
00260 void OrArchiveStatistic::recalculate(){
00261 if(neuronIDHashMap->count(firstNeuronID) || neuronIDHashMap->count(secondNeuronID)){
00262 ++(*firingNeuronCount);
00263 ++(*firingNeuronTotal);
00264 }
00265 #ifdef ARCHIVE_STATISTICS_DEBUG
00266 cout<<"OrArchiveStatistic: Recalculated neuron group. firingNeuronCount = "<<*firingNeuronCount<<"; firingNeuronTotal = "<<*firingNeuronTotal<<endl;
00267 #endif//ARCHIVE_STATISTICS_DEBUG
00268 }
00269
00270
00271
00272 QString OrArchiveStatistic::toQString(){
00273 QString tempStr(QString::number(firstNeuronID));
00274 tempStr += "|";
00275 tempStr += QString::number(secondNeuronID);
00276 return tempStr;
00277 }
00278
00279
00280
00281
00282
00283
00284
00285 NeuronIDArchiveStatistic::NeuronIDArchiveStatistic(unsigned int* fNeurCount, unsigned int* fNeurTotal, unsigned int neurID) : ArchiveStatistic(fNeurCount, fNeurTotal) {
00286 neuronID = neurID;
00287 }
00288
00289
00290
00291 NeuronIDArchiveStatistic::~NeuronIDArchiveStatistic(){
00292 #ifdef MEMORY_DEBUG
00293 cout<<"DESTROYING NEURON ID ARCHIVE STATISTIC"<<endl;
00294 #endif//MEMORY_DEBUG
00295 }
00296
00297
00298
00299 void NeuronIDArchiveStatistic::recalculate(){
00300 if(neuronIDHashMap->count(neuronID)){
00301 ++(*firingNeuronCount);
00302 ++(*firingNeuronTotal);
00303 }
00304 #ifdef ARCHIVE_STATISTICS_DEBUG
00305 cout<<"NeuronIDArchiveStatistic: Recalculated neuron group. firingNeuronCount = "<<*firingNeuronCount<<"; firingNeuronTotal = "<<*firingNeuronTotal<<endl;
00306 #endif//ARCHIVE_STATISTICS_DEBUG
00307 }
00308
00309
00310
00311 QString NeuronIDArchiveStatistic::toQString(){
00312 return QString::number(neuronID);
00313 }
00314
00315