-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSynapse.cpp
More file actions
70 lines (52 loc) · 2.17 KB
/
Synapse.cpp
File metadata and controls
70 lines (52 loc) · 2.17 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
64
65
66
67
68
69
70
/*
* Synapse.cpp
*
* Copyright 2018 OFTNAI. All rights reserved.
*
*/
#include "Synapse.h"
#include <cfloat>
Synapse::Synapse(float weight,
const Neuron * preSynapticNeuron,
const HiddenNeuron * postSynapticNeuron,
float * weightHistory)//
: // int fixedBufferWeightHistorySize)
weight(weight),
preSynapticNeuron(preSynapticNeuron),
postSynapticNeuron(postSynapticNeuron),
weightHistory(weightHistory)//,
//fixedBufferWeightHistorySize(fixedBufferWeightHistorySize)
{
// Allocate buffer space.
//fixedBufferWeightHistory = new float[fixedBufferWeightHistorySize];
// Set with initial value of weight
resetBlockage();
}
/*
float Synapse::getLast() {
// The elemnt in the buffer directly behind (lower index, with wrap arround) the oldest, is the newest
return fixedBufferWeightHistory[lastBufferElement];
}
void Synapse::savePresent() {
// Save new addition in the position of the oldest
fixedBufferWeightHistory[lastBufferElement] = weight;
// move position of the oldest along
lastBufferElement = (lastBufferElement == fixedBufferWeightHistorySize-1) ? 0 : lastBufferElement+1;
}
#include <iostream>
*/
void Synapse::resetBlockage() {
blockage = 1;
/*
lastBufferElement = 0;
blockage = 0;
for(int i=0;i < fixedBufferWeightHistorySize;i++)
fixedBufferWeightHistory[i] = weight;
//std::cout << "RESET blockage" << std::endl;
*/
}
Synapse::~Synapse() {
// DO NOT use this, since putting in vector calls this!! due to copying
//std::cout << " DELETING!!!" << std::endl;
//delete [] fixedBufferWeightHistory;
}