-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinput.h
83 lines (73 loc) · 1.44 KB
/
input.h
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
71
72
73
74
75
76
77
78
79
80
81
82
#include "graph.h"
/*
* Change the input vector by null values
*
* @param inputs the input vector
* @param n the number of input in the vector
*/
void addNullInputs(double *inputs, int n)
{
int i;
//For all inputs
for(i=0; i < n; i++)
{
inputs[i] = 0.0;
}
}
/*
* Change the input vector by binary values on a specific cluster
*
* @param inputs the input vector
* @param n the number of input in the vector
* @param index the index of the center position the cluster
* @param nbInput the number of input to activate
*/
void addBinaryLocalized(double *inputs, int n, int index, int nbInput)
{
int i;
//For all inputs
for(i=0; i < n; i++)
{
//If we are on the cluster
if((i>=(index-nbInput/2)) && (i<(index+nbInput/2)))
{
inputs[i] = 3.0;
}
else
{
inputs[i] = 0.0;
}
}
}
/*
* Change the input vector by binary values on a specific cluster with random activation
*
* @param inputs the input vector
* @param n the number of input in the vector
* @param index the index of the center position the cluster
* @param nbInput the number of input to activate
*/
void addBinaryLocalizedRandom(double *inputs, int n, int index, int nbInput)
{
int i;
//For all inputs
for(i=0; i < n; i++)
{
//If we are on the cluster
if((i>=(index-nbInput/2)) && (i<(index+nbInput/2)))
{
if((rand()%2)!=0)
{
inputs[i] = 3.0;
}
else
{
inputs[i] = 0.0;
}
}
else
{
inputs[i] = 0.0;
}
}
}