summaryrefslogtreecommitdiff
path: root/src/row.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/row.h81
1 files changed, 81 insertions, 0 deletions
diff --git a/src/row.h b/src/row.h
new file mode 100644
index 0000000..0ec5dde
--- /dev/null
+++ b/src/row.h
@@ -0,0 +1,81 @@
1#ifndef NEURAL_ROW_H
2#define NEURAL_ROW_H
3
4#include "neural/container.h"
5
6namespace Neural
7{
8 template<typename sigtype>
9 class Row : public Container<sigtype>
10 {
11 public:
12 //typedef Bu::List<Neural::Node<sigtype> *> NodeList;
13 Row() :
14 iInputs( 0 ),
15 iOutputs( 0 ),
16 iWeights( 0 ),
17 iBiases( 0 )
18 {
19 }
20
21 virtual ~Row()
22 {
23 }
24
25 virtual void finalize( int iNumInputs )
26 {
27 iInputs = iNumInputs;
28 iOutputs = 0;
29 iWeights = 0;
30 iBiases = 0;
31
32 for( typename Container<sigtype>::NodeList::iterator i =
33 Container<sigtype>::getNodeList().begin(); i; i++ )
34 {
35 (*i)->finalize( iInputs );
36 iOutputs += (*i)->getNumOutputs();
37 iWeights += (*i)->getNumWeights();
38 iBiases += (*i)->getNumBiases();
39 }
40 }
41
42 virtual void process( sigtype *aInput, sigtype *aOutput )
43 {
44 int iOutputOffset = 0;
45 for( typename Container<sigtype>::NodeList::iterator i =
46 Container<sigtype>::getNodeList().begin(); i; i++ )
47 {
48 (*i)->process( aInput, aOutput+iOutputOffset );
49 iOutputOffset += (*i)->getNumOutputs();
50 }
51 }
52
53 virtual int getNumInputs() const
54 {
55 return iInputs;
56 }
57
58 virtual int getNumOutputs() const
59 {
60 return iOutputs;
61 }
62
63 virtual int getNumWeights() const
64 {
65 return iWeights;
66 }
67
68 virtual int getNumBiases() const
69 {
70 return iBiases;
71 }
72
73 private:
74 int iInputs;
75 int iOutputs;
76 int iWeights;
77 int iBiases;
78 };
79};
80
81#endif