forked from dwr-psandhu/ann_calsim
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfnet_CO.f90
183 lines (181 loc) · 13.1 KB
/
fnet_CO.f90
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
module fnet_CO
! a = 5.569e-005
! b = 0.090701
intrinsic Reshape
real, dimension(8,126) :: input = &
Reshape((/-0.111616,0.267571,0.415636,0.225896,-0.058992,-0.113708,0.104055,0.191341, &
0.053819,0.004693,-0.237520,-0.447021,-0.004224,0.089277,-0.009741,0.237417, &
-0.121394,0.061144,-0.054371,-0.117613,0.080010,0.026544,0.051916,0.213686, &
-0.113634,0.306194,0.199297,0.282816,0.140232,-0.114199,0.062105,0.058903, &
-0.022485,-0.088559,0.146099,0.172293,0.157426,-0.121725,0.008760,-0.138721, &
0.016232,0.143225,0.010925,0.059910,0.007948,0.081196,-0.029193,-0.207209, &
0.113279,0.165024,0.049336,0.330290,-0.108418,0.014599,0.016660,0.069765, &
0.323880,0.170811,-0.014173,0.316533,0.060100,-0.156999,-0.039252,0.003255, &
0.060308,2.008823,0.503156,-1.807248,0.133674,0.214954,-0.096967,-0.423110, &
-0.173332,2.193314,0.354971,2.293571,-0.119021,0.016937,0.176877,0.276560, &
-0.387789,0.803174,0.193052,1.686041,0.193852,-0.142091,0.231935,0.406278, &
0.196988,0.754978,0.179880,-0.245012,0.220772,0.005196,0.050041,-0.173670, &
-0.203278,0.449936,0.055650,-0.061196,-0.393530,0.255958,-0.042767,-0.026059, &
0.483791,-0.268354,-0.356661,0.040918,0.578685,-0.139204,0.073484,-0.096866, &
-0.336073,-0.177687,-0.099437,-0.295852,0.053897,0.162921,-0.062985,-0.102929, &
0.124921,1.778793,-0.002308,-0.396989,0.059328,0.273541,0.134346,0.296348, &
0.014041,-0.408132,-0.007199,-1.050102,0.080006,0.392432,-0.097474,-0.357855, &
-0.095744,-0.078054,-0.422164,0.761509,0.291133,0.234939,0.064081,-0.199590, &
0.131665,-0.080993,-0.515110,0.715614,0.304213,-0.253015,-0.089869,0.033450, &
-0.607911,-0.586377,-0.570707,-0.279617,0.548326,0.535715,-0.068953,0.484687, &
-0.131501,-0.348486,-0.224536,-1.228183,0.479247,0.327046,-0.028482,0.580211, &
0.464958,-0.851661,0.122709,0.002512,0.551816,-0.390054,-0.221509,-0.000206, &
0.881974,0.637196,0.301471,0.655038,0.128807,-0.259732,-0.498720,-0.399815, &
0.227308,0.058615,0.484737,0.409475,0.470810,-0.351272,-0.170525,-0.097919, &
0.311126,-0.301366,0.107928,-1.346960,-0.314889,0.030318,-0.412898,0.093443, &
-0.234736,-0.602107,0.028032,-0.140434,-0.401159,0.603309,-0.490360,-0.207167, &
0.826756,-0.058920,0.557363,0.191261,0.322655,0.393887,-0.840759,1.339799, &
-0.399261,2.769052,1.669576,-0.128387,0.641522,0.786916,0.127868,1.124927, &
1.249430,-3.317902,-0.120203,2.866487,0.182402,-0.331605,-0.434544,-0.585327, &
-0.444935,1.664307,0.598269,-1.978584,0.146114,0.718352,0.348382,0.942877, &
0.302068,-1.160224,-0.560491,0.893324,1.219880,0.138498,0.056069,-0.206554, &
-0.242033,-1.619723,0.611547,0.054250,-1.292243,0.456550,-0.223740,-0.485495, &
-0.077996,2.876767,0.116015,-1.291346,0.773456,0.320349,0.402114,0.910970, &
0.284951,-1.268648,0.177626,-1.603812,0.055510,-0.076688,-0.333395,-0.878587, &
0.148986,-1.023073,-0.175227,2.297372,-0.591746,0.055129,-0.339814,-0.517639, &
0.294419,2.652959,1.103220,-0.085596,0.141245,-0.561870,0.068485,0.017075, &
0.028299,-0.223421,-3.136918,10.294864,-3.406212,-0.550699,1.918998,-0.764092, &
-2.494434,-1.102477,-5.009344,6.748995,-5.386913,-1.630742,6.090288,-3.509088, &
-4.928915,-1.733477,-4.686052,5.618288,-4.195285,-2.338657,5.500425,-2.268355, &
-4.169974,-4.527264,-2.568138,4.862224,-2.514879,-2.314215,4.821941,-1.574217, &
-3.713217,-5.704767,-2.224816,4.688947,-2.470531,-1.709627,5.297598,-1.850139, &
-4.519880,-7.154777,-1.411832,5.239668,-1.935054,-1.077935,5.641716,-1.939928, &
-6.169447,-7.671487,-1.078774,4.980181,-2.230265,-1.448193,6.642349,-2.534232, &
-6.454650,-7.794847,-1.925291,4.955430,-2.778282,-1.672486,7.728530,-3.815945, &
-14.655311,6.889520,-14.409956,0.913614,-14.459769,-11.623222,15.299975,-16.163942, &
-14.076967,6.065315,-12.807235,2.765967,-10.389379,-10.748382,5.849673,-13.383626, &
-2.990965,3.816149,-11.433412,0.733596,-6.688013,-10.458286,0.163760,-6.759526, &
0.539116,1.506899,-5.598453,0.238509,-1.955067,-8.364325,-0.746504,-1.686207, &
1.358673,4.818849,-4.718167,1.195722,-1.650316,-9.381039,-0.616323,0.038049, &
0.264739,3.142928,-0.412703,5.241949,-0.260958,-7.038268,-0.343088,0.356723, &
1.175479,3.841203,2.064638,7.506895,-1.654407,-5.272629,-0.131541,-0.680377, &
-1.053665,1.576163,-0.004062,3.052690,0.688164,-4.431009,0.646348,2.006680, &
-0.875183,2.814526,1.668610,3.596377,-0.319569,-0.553061,0.097231,-0.330787, &
0.630953,1.920698,0.986582,-1.829278,1.009016,-1.897494,0.025309,-0.643646, &
-0.305259,-3.099776,0.649776,0.710617,-1.685741,0.608638,1.008912,-0.538075, &
-2.002704,-2.971929,0.045816,-0.186831,-1.754314,0.403124,1.190400,-0.729470, &
-2.155029,-2.876513,-0.095170,-0.759037,-1.405407,-0.141247,0.592580,-0.428682, &
-1.970185,-2.482267,-0.078142,-0.855554,-1.272734,-0.505972,0.794592,-0.750886, &
-1.207710,-1.953319,-0.626392,-1.044250,-1.024250,-1.151738,1.249394,-1.348024, &
-0.106710,-1.669829,-0.350459,-0.602898,-1.015460,-1.330180,0.956927,-1.629126, &
0.299287,-1.805860,-0.028337,-0.658395,-0.078188,-1.160809,0.792167,-1.946010, &
0.380267,-1.675367,-0.340802,-1.184590,0.014468,-1.677671,1.302083,-2.341234, &
-1.256121,-1.153947,-1.786843,-1.098376,-2.498857,-2.713960,3.420100,-4.727663, &
-2.323986,-2.237175,-3.054917,-2.902260,-0.555659,-4.213500,1.199719,-4.436618, &
-4.271410,-3.464737,-3.009304,-1.527633,-0.240616,-2.059944,1.254754,-1.205187, &
-2.876892,-2.786237,-0.721545,2.447249,1.484036,-2.543448,0.973391,1.177743, &
-0.002068,-2.464094,-2.061267,0.217676,1.123437,-4.390926,0.398699,-0.051677, &
1.420641,-4.904289,-0.911421,0.015180,-0.762689,-0.873368,-0.980872,-1.315720, &
0.125052,-2.680990,0.405332,1.238567,-1.480047,-0.056613,-0.569969,0.705755, &
-0.071222,1.535359,-2.786638,-0.662071,1.690850,1.190379,0.380435,-0.292446, &
-0.370857,0.429587,-0.801653,-0.897508,-0.122104,0.275311,0.167758,0.130311, &
0.784597,1.358310,-1.886739,1.453292,0.280201,0.224334,-0.419945,0.781549, &
-0.373819,0.296656,0.104803,0.592292,0.293147,0.106812,-0.631745,-0.404607, &
-0.488902,-0.077712,0.301942,-1.570568,0.106377,0.371649,-0.027002,-0.178433, &
-0.194947,0.911984,0.238677,-0.327996,0.056806,-0.098881,-0.113835,-0.092486, &
0.223824,0.856330,0.017236,-0.179751,-0.404491,0.110421,-0.111570,0.050673, &
-0.002321,0.996644,-0.215904,0.700097,0.025563,0.040131,-0.079908,-0.031636, &
-0.154730,1.424449,0.218974,0.082181,0.080863,-0.029966,-0.111561,-0.505743, &
0.301846,-0.006343,-0.226236,-1.166395,-0.137642,0.245396,-0.127111,-0.154538, &
-0.574232,-1.195692,-0.392584,0.248715,0.253349,-0.084225,0.033814,-0.315034, &
-0.810324,5.513417,0.450524,5.872795,0.803594,0.218645,-0.465972,-2.003279, &
0.046250,5.058202,0.087290,2.164234,-1.233140,-0.919228,0.445641,-1.222121, &
-1.701431,-2.207720,0.617210,3.049259,0.823110,0.093647,0.440256,1.268230, &
1.258227,-1.026660,0.041530,-0.034170,-0.149598,-1.358985,0.508717,1.230542, &
-0.745549,-0.534227,1.561824,-3.306352,1.490606,-0.848070,0.391799,1.762662, &
1.848527,-2.279227,-0.438226,-5.707020,-0.146739,-0.767970,-0.417177,-0.173273, &
-1.094252,-3.123737,0.266829,2.425762,1.438345,0.168198,-0.546498,-0.055502, &
0.368129,0.178043,-0.770649,1.913389,-1.185022,-0.573117,0.139286,0.438269, &
-0.710357,-0.002059,-0.357755,-1.660770,-1.259298,0.731176,0.110081,0.248013, &
1.306648,0.648565,-0.596333,1.312776,-1.668080,0.142989,0.093653,-0.182566, &
-0.080511,-0.573452,-0.352830,1.355521,-0.347317,-0.110620,-0.311687,-0.408179, &
-0.109072,-1.116577,-0.295665,-0.236361,-0.082686,0.264498,-0.346749,-0.340516, &
0.307472,-1.244969,0.224851,0.137887,-0.319389,-0.201359,-0.418344,-0.395262, &
0.507675,0.373147,-0.460335,0.285365,-0.479018,0.348514,-0.379750,0.036595, &
0.412912,-0.157463,0.309588,-0.110355,-0.517790,-0.172328,-0.302445,0.181146, &
0.292001,-0.103194,0.055434,-1.133746,-0.375414,-0.022895,-0.325307,0.071425, &
0.024210,0.433433,-0.234119,-0.427567,-0.513522,0.099460,-0.180190,0.359332, &
0.227899,0.971680,-0.378756,-0.447999,-0.271883,0.779243,0.038630,0.465788, &
0.795916,-0.653770,0.621929,-1.523508,1.057273,0.367536,-0.765938,1.092782, &
0.406829,-0.510048,-0.170523,-4.291499,0.724044,1.278467,0.074272,0.970207, &
-0.445212,-1.087009,0.956855,-0.689027,0.649817,-0.295612,0.467576,-0.124687, &
0.708504,-1.010774,1.297997,-2.218348,-0.598653,0.098371,-0.547073,-0.628679, &
0.584390,4.204140,0.796264,-2.125610,0.862413,0.474160,-0.162225,-1.072383, &
-1.024463,3.834114,0.718867,-0.834660,-0.381297,0.545016,-0.165831,-0.569802, &
1.529122,0.359664,-0.230328,-0.269915,-0.926742,0.211598,-0.567930,-0.316234, &
-0.485908,-1.818301,0.840374,-2.262065,0.247277,-0.418002,0.184021,-0.406724, &
-1.565306,-0.801351,-0.025105,-1.109785,0.018917,1.517050,-0.017057,0.007076, &
0.163026,-0.226617,0.340433,-2.862733,0.224752,-0.302732,0.105028,0.289390, &
0.027401,-0.433734,-0.339747,0.066670,-0.043062,0.093604,-0.077693,-0.060607, &
-0.367838,-1.642198,-0.553122,0.370745,-0.011381,0.006457,-0.050420,0.054439, &
0.164980,0.130910,-0.049876,0.212574,-0.067508,-0.071876,0.025482,0.049271, &
0.222569,0.155100,0.062688,0.216136,0.286775,-0.210687,0.034305,-0.079419, &
0.148210,-0.391484,-0.046748,0.072560,-0.065294,-0.114798,-0.018615,-0.057971, &
0.215250,0.374652,0.089462,0.000516,0.220383,-0.016365,0.108683,-0.053019, &
0.317647,-0.060177,-0.209926,-0.196111,-0.220575,-0.121491,-0.130553,0.153893, &
-0.161519,-2.040163,-0.961979,-0.193606,-0.514677,0.211407,-0.292939,0.110601, &
-0.483453,-1.006432,-0.088516,0.888109,0.423233,0.008665,0.371782,-0.039775, &
0.200269,0.331638,0.071129,-1.346128,-0.357634,0.180375,-0.093125,0.016146, &
-0.019873,-0.121252,-0.002783,0.228766,-0.114630,-0.020596,0.069674,0.144798, &
-0.282181,0.444570,0.126264,1.111695,0.263300,0.011616,0.013097,-0.393003, &
-0.196662,0.732243,0.130000,-1.482116,-0.433191,0.385522,0.120116,0.513466, &
0.292284,-0.791115,-0.370825,0.419895,0.265431,-0.203157,-0.089453,-0.072102, &
-0.257184,-0.825142,0.023877,0.957954,-0.204862,-0.007990,0.070763,-0.057412, &
-0.058970,0.404489,0.071449,-1.161790,-0.141685,0.244899,-0.022203,0.084410, &
0.265621,-0.601360,-0.571940,1.092567,0.373612,-0.277147,0.076573,0.286637, &
-0.201549,0.510005,0.291077,-0.603112,-0.098747,0.216608,-0.041242,-0.341560 &
/),(/8,126/))
real, dimension(2,8) :: hidden1 = &
Reshape((/3.542376,1.139001, &
-0.937461,-0.489622, &
1.824117,1.302499, &
-0.457555,0.372421, &
0.258304,6.458685, &
7.962249,5.538525, &
0.944217,-1.476282, &
0.505187,9.176127 &
/),(/2,8/))
real, dimension(1,2) :: hidden2 = &
Reshape((/-0.889742,1.693627/),(/1,2/))
real, dimension(8) :: bias1 = &
(/6.110201,-2.589745,5.10756,5.570314,3.656191,5.42879,-4.455007,4.401045/)
real, dimension(2) :: bias2 = &
(/0.274291,-0.499469/)
real, dimension(1) :: bias3 = &
(/0.432349/)
contains
subroutine fnet_CO_initall()
end subroutine fnet_CO_initall
subroutine fnet_CO_engine(inarray, outarray, init)
intrinsic MatMul, Size
real, dimension(:), intent(in) :: inarray
real, dimension(:), intent(inout) :: outarray
real, dimension(126) :: inarray2
real (kind=8), dimension(8) :: layer1
real (kind=8), dimension(2) :: layer2
real (kind=8), dimension(1) :: layer3
integer , intent(inout) :: init
integer :: i, j
!do i = 1, 126
! inarray2(i) = inarray(127-i)
!end do
layer1 = MatMul(input,inarray)
layer1 = layer1 + bias1
do i = 1, Size(layer1,1)
layer1(i) = 1.0 / (1.0 + DEXP(-1.0 * layer1(i)))
end do
layer2 = MatMul(hidden1,layer1)
layer2 = layer2 + bias2
do i = 1, Size(layer2,1)
layer2(i) = 1.0 / (1.0 + DEXP(-1.0 * layer2(i)))
end do
layer3 = MatMul(hidden2,layer2)
layer3 = layer3 + bias3
outarray(1) = layer3(1)
end subroutine fnet_CO_engine
end module fnet_CO