forked from dwr-psandhu/ann_calsim
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfnet_emm.f90
183 lines (181 loc) · 13.1 KB
/
fnet_emm.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_EMM
! a = 0.00014203
! b = 0.075691
intrinsic Reshape
real, dimension(8,126) :: input = &
Reshape((/1.926623,0.003790,-0.161608,0.230055,-0.582696,0.250687,0.664157,-0.345152, &
-1.359933,-0.214343,0.454344,0.489522,0.258023,0.086391,-0.110798,-0.138888, &
0.531639,-0.040629,-0.046898,0.161429,-0.204956,0.398793,-0.003306,-0.103667, &
0.568860,-0.025517,-0.026228,0.129939,-0.126625,0.051840,0.044315,-0.022302, &
0.408380,-0.000140,0.109230,0.185235,0.138444,0.312148,-0.088655,0.074944, &
-0.023145,0.050081,-0.265871,-0.125962,-0.012510,-0.526056,0.020858,0.229301, &
1.190651,-0.046023,0.183336,-0.017844,0.092154,-0.099805,-0.121778,0.295106, &
-0.248054,-0.005408,-0.055528,-0.256593,-0.442597,0.043372,0.132917,0.129437, &
2.308602,0.002104,-0.453766,-0.217616,-0.354009,-0.388457,-0.010662,-0.825520, &
-1.163430,0.177428,-0.848938,-0.835414,-0.333790,-0.336668,0.424576,-0.101550, &
-1.264064,0.090402,-0.080194,-1.874079,0.378765,0.497046,-0.737905,0.093022, &
1.191229,0.087124,-0.067303,-1.544961,0.216739,0.599728,0.579483,-0.722434, &
0.144799,-0.138228,0.949833,0.327218,0.099396,0.789661,-0.419254,0.509895, &
0.499954,0.171078,-0.488240,-0.107220,-0.078895,0.534062,1.185812,-0.476161, &
-3.134633,0.102395,-0.423997,0.687941,-0.151325,0.167295,2.089728,-0.025799, &
3.211672,-0.067738,0.497407,0.249944,-0.246960,-0.529594,1.066167,0.242051, &
0.939305,-0.097638,0.011696,-0.760396,0.909389,-1.878384,0.136075,-0.134766, &
-2.562473,-0.412328,-0.305754,-0.636243,0.193172,-4.439370,-0.205890,0.542438, &
-1.109525,0.255517,-0.739094,-1.138451,0.723077,-0.175034,0.107967,-0.409419, &
2.300975,-0.241770,-0.142228,-1.779845,0.276221,0.684468,-0.098046,-1.926440, &
5.368210,-0.281813,-0.068192,-1.806898,-0.757919,0.640409,0.272094,-1.378142, &
4.788258,-0.272798,-0.275997,-0.191033,-1.879473,-0.140247,0.158443,-0.616585, &
-0.570452,-0.299724,-0.047735,-0.069174,-0.138394,0.223729,0.400256,-0.477808, &
-2.854081,-0.098286,-0.788201,1.339434,0.412035,0.326419,-0.486063,0.390588, &
-5.027854,-0.063830,-0.615241,0.976958,-0.247925,-0.017476,-0.015922,1.341978, &
-1.247319,-0.357675,0.067411,1.399021,0.179478,-0.503531,-0.250343,0.527340, &
3.934897,-1.047718,0.328221,0.269496,0.940522,1.482308,-0.494850,0.478502, &
-8.378614,-0.343120,-1.282647,-3.042639,0.340633,1.081289,1.085727,1.117817, &
2.916491,-0.435312,0.367222,4.062134,0.825519,-1.898506,0.366985,0.905687, &
6.884812,-0.369348,-0.028278,-0.109689,0.416996,-0.126299,-0.018064,-2.303832, &
-4.056549,0.049094,0.169403,1.365860,-0.886273,2.077691,1.446845,1.615751, &
-4.659174,0.296291,-1.331156,-1.690302,0.551035,-1.428918,-0.916443,2.598386, &
4.415392,-0.516020,2.072010,1.787371,1.406792,0.622903,0.076890,-1.698180, &
-1.298228,0.209011,-0.730623,-2.124967,-1.058322,1.954793,0.140798,0.323252, &
-1.933345,-0.004375,0.229241,2.659065,0.610199,-1.447518,0.304742,1.907702, &
-0.300212,-0.586541,1.128411,3.103529,-0.372639,-1.364541,0.290147,-0.895934, &
8.005963,5.537167,3.789037,6.004569,-1.072264,0.641340,-2.819920,0.602388, &
0.738295,6.885900,5.182836,5.760646,-3.500504,-1.323584,-3.487782,-3.319384, &
0.960591,5.851647,4.500111,4.755568,-1.706239,-0.759216,-2.470431,-3.581793, &
3.139391,5.081389,4.030641,4.868111,-0.658673,-0.689307,-2.498541,-2.283368, &
4.537467,5.152103,3.588530,4.949065,0.170644,-0.830370,-2.700904,-1.755598, &
4.193098,5.308460,3.771004,5.393791,-0.286765,-1.502331,-2.604913,-1.675104, &
4.160838,5.485836,3.747339,5.838080,-0.233126,-2.049339,-2.083901,-1.708739, &
2.848329,4.981217,3.481355,5.924624,0.036719,-1.959342,-1.312373,-1.024477, &
-5.216585,15.642376,15.283361,10.460916,-11.114380,-11.681868,-8.845600,-7.361144, &
-2.569888,10.161358,15.129836,10.848669,-10.057602,-7.689399,-6.686404,-9.772379, &
-1.051363,2.676534,12.170850,13.047573,-4.141676,-0.823219,-4.540271,-10.382781, &
2.309888,1.045009,10.928282,14.643767,-2.605113,0.587310,-6.822160,-11.394491, &
3.084911,-1.424300,7.512609,16.851620,-2.091953,-1.756265,-7.633720,-6.745628, &
4.668703,-1.026398,2.981880,15.970766,-3.182006,-3.919770,-7.446283,-6.923176, &
2.953551,0.250861,-0.130010,8.733973,-1.445656,-0.767329,-3.061310,-6.826293, &
0.391184,-0.086879,-0.247591,5.999160,-1.182629,-0.854894,-4.237068,-6.379585, &
-1.023642,-0.115692,-0.024116,0.373107,-1.983852,2.450292,-0.510798,-2.003746, &
-0.724350,0.033346,0.095615,-2.013857,2.068854,-1.172206,0.934725,-2.867432, &
5.353245,0.466606,0.331008,-0.957925,-0.706894,-1.159660,0.267906,2.211411, &
4.463367,0.584337,0.709862,-0.824523,-0.875081,-1.292750,0.302474,1.229618, &
4.274899,0.805972,0.867259,-0.209015,-1.052783,-1.589820,-0.178890,0.710535, &
4.403243,1.044269,1.132822,1.076930,-1.400209,-1.854735,-1.108790,-0.156743, &
4.367750,0.909635,1.097629,1.965565,-1.298719,-1.499091,-1.578287,-0.563935, &
4.488968,0.967940,0.784868,2.001229,-1.006578,-0.742178,-2.090757,-0.847019, &
4.513936,1.446458,0.500404,2.584120,-0.998434,-0.259874,-1.968602,-0.760699, &
3.994042,2.008644,0.955917,2.964529,-1.496772,-0.342415,-2.144794,-1.898225, &
3.305830,3.529434,2.169180,1.665846,-3.031179,-0.395112,-1.241159,-2.554606, &
0.186026,1.474014,0.267836,0.771268,0.709978,1.571174,-2.468601,-1.228276, &
4.470478,2.938141,1.303627,1.657811,2.658828,-1.368464,-4.094929,-2.972194, &
0.269739,0.158293,0.112615,-0.981671,3.158695,0.825614,-3.343476,-2.842596, &
2.477770,0.563577,1.334421,-3.222644,2.367087,-0.683082,-3.875863,-3.215775, &
1.862343,-0.151762,0.515571,-3.329292,1.094725,2.616688,-2.690036,-0.979018, &
5.329745,-0.224049,0.149887,-1.482011,0.412511,-1.047147,-3.661682,-2.516704, &
5.201083,0.286590,-0.657980,1.150145,1.586337,1.686576,-1.578454,0.552207, &
3.734306,0.419563,-0.346652,2.476400,1.757216,2.203209,1.121738,0.722152, &
2.370572,0.275515,0.340388,6.317399,0.761056,1.243553,1.089028,-0.201947, &
-0.793267,-0.519038,0.429505,0.902293,0.531198,0.966255,-1.376250,0.711782, &
1.404279,-0.079100,0.109638,0.768568,0.940052,0.058789,0.263971,-0.461545, &
-1.312592,-0.101685,0.312759,0.063468,0.269517,0.319480,0.252794,-0.805440, &
1.067478,-0.058673,0.391563,-0.035322,-0.156014,0.252796,-0.258243,-0.050853, &
2.843608,-0.104910,0.312971,0.520877,0.323420,-0.149913,-0.690821,-0.499292, &
-1.325537,0.298185,-0.090443,0.783207,-0.165961,0.432145,1.072338,1.054745, &
1.599051,0.064090,0.167407,-0.903867,-0.654982,2.025162,-0.645750,-0.213820, &
-0.910094,0.180922,0.393097,1.535563,1.021518,1.148331,-0.804244,0.140236, &
-5.198544,0.459129,0.018213,0.754917,1.999050,4.713883,1.093233,-0.079140, &
-0.779455,0.849116,2.178166,-0.038046,0.539887,0.885321,-3.781089,-0.407020, &
-3.285642,-0.936111,-0.547196,0.649169,1.621251,-2.500546,-0.475818,0.723683, &
-4.087288,-0.295941,0.003561,-0.322598,-1.945728,0.901451,0.214469,-0.602876, &
3.470618,-0.505602,-0.605345,-2.117905,0.512964,1.553680,-0.554108,-1.070191, &
9.042462,-0.047530,-0.224349,-0.953568,-0.606292,-3.304385,-1.197155,-2.313172, &
0.578572,-0.835702,-1.576422,-0.934569,0.399176,-3.012999,1.792544,-0.883526, &
-1.865420,0.512069,-0.891356,-1.451160,-4.411219,-3.367958,-0.018037,2.186078, &
2.579009,1.043290,-1.548510,1.583241,-0.546599,-1.296286,-0.471324,2.580595, &
-4.264131,0.893820,-1.777700,1.377869,-1.414071,-1.994754,2.857931,0.315031, &
-0.059013,-0.209774,0.755361,0.820783,0.535715,-1.042633,0.412825,0.656364, &
0.419805,-0.173769,-0.086981,0.693603,0.408652,-1.703234,-0.416585,0.781032, &
-0.845119,-0.145159,-0.671898,0.029170,-0.222598,-1.158370,-0.703047,0.519864, &
-1.541789,-0.358957,-0.159802,-0.116804,-1.629156,0.530471,-0.736994,0.106631, &
-2.860688,-0.266643,-0.156277,-1.351682,-1.350596,1.055185,-0.189337,0.651077, &
-0.569086,-0.011071,-0.363069,-0.731074,-1.189369,0.837949,-0.072867,0.392179, &
0.194573,-0.111869,0.017303,0.223133,-1.098331,-0.073406,0.249043,-0.315159, &
0.137188,-0.282949,0.663296,0.476361,-0.646467,-0.341103,0.568667,0.319279, &
-5.071720,-0.671630,-1.345754,0.459445,1.092873,2.733554,0.120619,0.944689, &
2.369295,0.118340,-2.303519,-1.103266,-0.294671,1.282020,0.560444,-0.081915, &
-5.848857,0.389958,-0.666265,-0.642292,-1.761467,2.573280,0.014494,2.554356, &
3.812488,0.270169,-1.386906,0.302519,-1.579489,-1.196894,0.192463,2.524131, &
-0.114505,-0.138851,-0.604457,1.497147,-1.392625,0.231276,0.516881,0.863414, &
3.821436,-0.059284,0.980582,-3.069768,1.052709,-0.260144,-0.913724,-1.960361, &
-2.504460,-0.037236,-0.480174,-1.077119,2.170891,0.380268,-1.704766,0.053372, &
1.342935,0.226829,-0.011261,-0.149833,1.523901,0.274496,1.136337,-1.671562, &
2.352196,-0.123645,-0.085229,-1.431794,0.330199,-0.499300,-0.116782,1.101574, &
-4.270691,-0.233713,-0.194789,0.241483,-0.288815,-0.871434,-0.795149,-0.303530, &
-0.781798,0.093042,-0.301281,-0.438837,0.277187,0.606419,-0.120496,-0.104162, &
0.613397,-0.061628,0.033069,-0.510467,-0.281916,0.416929,-0.518195,-0.462892, &
2.628400,-0.105635,0.424861,0.237058,0.017445,-0.534708,0.156084,0.279504, &
-1.343549,-0.004948,0.101247,0.330059,-0.253659,0.022679,0.264106,0.225901, &
1.559788,-0.019167,0.028187,-0.091681,-1.094069,0.708749,-0.307217,0.148412, &
-0.210009,0.001119,0.025682,0.323422,-0.268692,0.337548,-0.044964,0.204112, &
-3.589742,-0.046559,0.327997,-0.045769,0.283855,0.015330,-0.146626,0.110031, &
-0.299655,0.058604,-0.091779,0.130550,-0.106401,0.103110,-0.144161,0.166744, &
1.334682,0.088334,-0.127699,-0.598307,0.974272,-1.153338,-0.021186,-0.802261, &
3.014618,0.175861,-0.371088,-0.990875,-0.853650,1.412175,0.068390,0.277439, &
-0.619519,-0.109689,0.145071,0.016341,0.226484,-1.997477,-0.236390,-0.097991, &
-2.642009,-0.082181,0.707446,1.469643,0.592676,0.557600,0.471209,0.388201, &
6.859223,-0.094085,0.148504,-0.429538,-0.619371,0.486489,0.017225,-0.766899, &
-2.085785,0.067659,-0.404451,-0.869558,-0.170136,-1.027459,-0.075399,0.232188, &
-0.218354,0.250681,-0.440003,-0.575073,0.048953,1.096857,0.212928,-0.024396, &
0.679121,-0.161411,0.373601,0.106564,0.168245,0.213078,-0.605168,-0.057470, &
-0.037379,0.227574,-0.689618,-0.797615,-0.329552,-0.355766,0.321335,0.137353, &
-0.164763,-0.025038,0.265550,0.304782,0.456261,0.260894,-0.049853,-0.238526 &
/),(/8,126/))
real, dimension(2,8) :: hidden1 = &
Reshape((/-2.285871,-0.004588, &
4.582663,-0.178102, &
2.370683,-3.374466, &
2.708303,-0.026697, &
-5.174141,-11.448236, &
-1.000147,0.992032, &
-9.228837,-1.834140, &
-3.954800,1.941886 &
/),(/2,8/))
real, dimension(1,2) :: hidden2 = &
Reshape((/-1.42606,-0.469869/),(/1,2/))
real, dimension(8) :: bias1 = &
(/0.884405,-7.391455,-5.696062,-6.7448,3.950369,4.540649,5.226464,3.046937/)
real, dimension(2) :: bias2 = &
(/-2.120389,-0.457375/)
real, dimension(1) :: bias3 = &
(/1.55356/)
contains
subroutine fnet_EMM_initall()
end subroutine fnet_EMM_initall
subroutine fnet_EMM_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_EMM_engine
end module fnet_EMM