forked from dwr-psandhu/ann_calsim
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfnet_MTZ.f90
183 lines (181 loc) · 13 KB
/
fnet_MTZ.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_MTZ
! a = 2.9315e-005
! b = 0.086358
intrinsic Reshape
real, dimension(8,126) :: input = &
Reshape((/-0.019952,-0.023759,0.042963,-0.162432,-0.055693,0.151510,0.025701,-0.019519, &
-0.077636,-0.109247,-0.003236,-0.081667,-0.161716,-0.025014,-0.024942,-0.014738, &
0.027177,0.049902,-0.011286,-0.079593,0.024058,0.087906,0.004188,-0.010128, &
-0.028231,-0.027746,-0.029784,-0.132977,-0.086770,0.056232,-0.011837,-0.020878, &
-0.012716,-0.022802,-0.053041,-0.116874,-0.078599,-0.037771,-0.021384,0.025780, &
-0.046949,-0.008015,-0.032984,-0.051183,-0.030333,0.107994,0.046604,0.030669, &
0.014206,-0.060922,-0.040377,-0.174926,-0.001066,-0.120589,-0.005473,-0.026950, &
-0.050806,-0.050122,-0.029749,-0.083033,-0.156586,-0.015572,-0.060975,-0.014957, &
0.036782,0.282821,-0.217699,-0.413749,-0.159574,-0.302950,-0.293938,0.330276, &
-0.050325,0.178895,0.300606,-0.162973,0.263068,0.088753,0.048468,0.449115, &
-0.326507,0.134940,-0.237027,-0.229596,0.023717,1.007588,0.463517,0.155138, &
-0.181800,-0.498638,-0.475275,-0.498348,-0.425783,-0.132727,0.342131,-0.308700, &
-0.113399,-0.030779,-0.497487,0.221821,-0.608515,-0.416326,-0.133423,-0.097093, &
0.064842,0.013745,0.056019,0.606794,-0.252317,-1.110797,-0.410651,0.092355, &
-0.280435,-0.413666,0.148012,0.139513,-0.281840,-0.669258,-0.040190,0.285108, &
-0.021097,-0.307003,-0.188108,0.143148,-0.260883,-0.130536,0.251080,-0.164321, &
-0.139607,0.033313,-0.133995,0.436918,-0.248118,0.415329,0.194315,0.018967, &
-0.154314,0.124047,0.024268,0.588879,-0.152767,1.037615,0.399711,0.057559, &
0.266970,0.007881,-0.138205,-0.030485,0.415809,0.000858,0.270645,-0.397803, &
-0.009644,-0.105804,0.008468,-0.117763,0.246868,-0.083586,0.215723,-0.362911, &
-0.077211,0.223952,-0.127949,0.049919,0.222213,-0.117043,0.026661,-0.127853, &
-0.063171,0.051767,-0.087565,-0.022099,0.096184,-0.173646,0.013015,-0.243079, &
-0.066238,0.086738,0.148637,0.004566,0.116930,0.053143,0.068080,-0.104721, &
-0.203937,-0.098108,0.058572,-0.061015,0.096797,-0.194033,0.121212,-0.058852, &
-0.014458,0.166485,0.056324,0.139153,0.016073,-0.043240,-0.042857,-0.085151, &
-0.167714,0.008220,0.137186,0.021241,-0.035946,-0.147494,0.140159,0.055937, &
-0.075558,0.385880,0.523064,0.147235,0.016590,-0.456084,0.393504,-0.634373, &
0.308434,0.189282,-0.083748,-0.252301,-0.288637,-0.573647,0.010199,-0.505858, &
0.116085,0.084283,0.222790,-0.022297,0.119829,-0.325404,0.299651,0.173863, &
0.284227,0.449122,-0.391691,-0.204302,0.433277,-0.271021,0.103026,0.047221, &
-0.082187,0.169141,-0.250763,0.114650,0.226889,0.000443,0.359034,0.289767, &
-0.089807,-0.130650,-0.045256,-0.136172,0.314574,-0.223545,0.337016,0.306645, &
0.155479,-0.019882,-0.112593,-0.204066,0.121432,-0.032707,0.109063,-0.289108, &
-0.063636,-0.121998,0.095488,0.156002,0.167351,-0.062821,0.138742,-0.101853, &
0.059141,0.093034,0.330284,0.157579,-0.036525,0.388777,0.100607,0.211195, &
0.085535,0.512855,-0.002991,0.206096,0.229317,0.078579,-0.378890,0.209047, &
3.183922,-0.785429,0.680973,0.618008,-0.206693,-0.260962,0.206311,3.781611, &
3.437279,-1.208694,0.250517,0.787320,0.150246,0.291976,-0.076159,3.548890, &
2.876675,-1.415257,0.375618,0.836904,-0.092870,0.750057,-0.226707,2.681368, &
2.321944,-1.475293,0.096071,0.887388,0.023921,0.856462,-0.167544,2.174114, &
1.989031,-1.433525,-0.221252,0.812201,-0.095229,1.348487,-0.071695,1.568657, &
0.935974,-1.357581,-0.278575,1.208604,-0.342729,1.347070,-0.079024,0.882290, &
0.448220,-1.779910,-0.613247,1.469320,-0.260896,1.502181,-0.197983,0.485495, &
1.160219,-2.646812,-1.312626,2.246526,0.824239,2.513488,-1.191441,1.026311, &
3.453224,-6.281884,-6.455709,4.776443,5.355426,6.042776,-6.349417,1.182959, &
-0.545249,-2.363003,-5.042743,2.727827,6.088065,3.422507,-6.666447,-1.622048, &
-1.056451,-0.080316,-2.103002,1.884941,4.567380,0.188927,-5.040889,-0.268502, &
-0.300845,0.774802,-0.341114,1.732955,3.505041,-0.496243,-3.050878,0.388218, &
0.359448,0.408180,0.209792,-0.029507,3.313611,-0.242781,-3.036654,-0.386168, &
0.844767,0.761886,0.203035,-1.922270,2.455534,0.017970,-2.321992,0.066874, &
0.860860,0.243957,0.673595,-1.157907,1.394387,-0.280219,-1.474747,-0.083143, &
0.451646,0.197882,0.213932,0.256022,1.209448,-0.055029,-0.436244,-0.530782, &
0.104933,0.052271,-0.142897,0.677260,0.210099,-0.347090,0.331449,-0.104637, &
0.011734,-0.027960,-0.325988,0.677338,0.290144,-0.770655,0.482035,-0.399620, &
0.575087,-0.194676,-0.594746,0.225682,-0.351951,-0.036589,-0.749020,0.829302, &
0.467503,-0.159707,-0.193851,-0.023663,-0.795955,0.204456,-0.533176,0.450030, &
0.534571,-0.040647,-0.205743,0.108207,-0.621810,-0.047311,-0.546061,0.496244, &
0.657735,-0.105182,-0.286045,0.231714,-0.556383,0.187943,-0.515038,0.149233, &
0.374525,-0.182189,-0.314562,0.214334,-0.550045,0.246150,-0.352536,-0.038425, &
0.376625,-0.102923,-0.163071,0.322366,-0.566128,0.492403,-0.442983,0.069258, &
0.008694,-0.305862,-0.192898,0.339315,-0.809095,0.549269,-0.250060,0.231284, &
0.428128,-0.703139,-0.471756,0.427911,-0.632862,0.624455,-0.588101,0.420692, &
0.794989,-0.777037,-1.204164,1.174593,0.242808,1.076016,-0.820422,0.602324, &
-0.066201,-0.544602,-0.882551,0.414320,1.957298,0.615218,-1.770416,0.295294, &
0.200923,0.078272,-0.656854,-1.140308,2.586703,0.165084,-2.689707,0.537786, &
-0.364924,-0.180142,-0.379150,-0.986625,2.072777,0.372067,-1.471455,0.101783, &
-0.256487,-0.081503,0.193042,0.285835,-0.032524,0.043815,-0.417084,-0.436302, &
0.062483,0.260986,0.659100,1.086936,-1.038760,-0.169344,0.520697,0.106766, &
0.074966,-0.131393,0.499661,0.542223,-0.773401,0.344406,0.235916,0.319553, &
-0.209709,-0.183177,-0.454934,-0.221848,0.175318,0.310358,-0.241992,-0.116499, &
-0.136495,-0.004144,-0.268900,-0.445649,0.325200,0.121105,0.089292,0.102316, &
-0.061348,0.121722,-0.107885,-0.532226,0.093238,-0.075375,0.130710,-0.137121, &
-0.757379,0.307932,-0.240898,0.159632,-0.285352,0.752260,0.006136,-0.052354, &
-0.331369,0.103834,-0.145272,-0.195695,-0.167835,0.263710,-0.123918,-0.012655, &
-0.112706,0.141998,0.007524,0.038787,-0.126312,0.035710,-0.155667,-0.043316, &
-0.122232,-0.015917,-0.053568,0.145432,0.046810,-0.310757,-0.052488,0.019279, &
0.014400,-0.050419,-0.164522,0.016380,0.108414,-0.111005,0.094873,-0.044643, &
0.153405,0.010919,0.001503,-0.058621,0.109645,0.010723,-0.035093,0.036968, &
0.196188,0.063663,0.238244,-0.055888,0.020212,0.229296,-0.096602,0.045819, &
0.386904,0.190332,-0.019902,-0.109967,0.107812,0.248248,-0.198215,0.307474, &
-0.426542,0.223933,0.033776,0.033353,0.209328,0.336011,-0.604178,-0.568341, &
-0.073194,0.125272,-0.722645,-0.918684,0.361619,0.047833,-0.655642,-0.196893, &
-0.128441,0.232588,-0.425229,-1.134293,0.213517,-0.262897,-0.214987,-0.010964, &
0.113352,0.190156,0.155808,-0.583669,0.384615,0.001804,-0.243049,-0.151792, &
-0.254782,0.028565,0.499193,-0.608985,0.358837,-0.130079,-0.196374,-0.159661, &
-0.699382,0.439909,-0.781663,-0.433263,0.154415,-0.859137,0.087728,-0.608364, &
-0.454126,0.238797,-0.881760,-0.460703,0.335707,-0.721141,0.584208,-0.290269, &
0.469271,-0.477581,-0.502289,-0.660827,0.475678,-0.318201,0.602298,0.309767, &
0.931246,-0.269740,0.237836,0.158432,0.462596,0.099011,0.070998,0.327309, &
-0.052339,0.044402,0.152974,0.684493,0.152263,-0.292807,0.064667,-0.003341, &
0.082432,0.291598,-0.494539,0.157219,-0.240400,0.135373,-0.161217,-0.536599, &
-0.081491,0.196553,-0.384194,0.178846,0.037397,0.058527,-0.027797,-0.480624, &
-0.021293,0.007159,-0.106750,0.158748,-0.146482,0.124880,0.072954,-0.123842, &
-0.035953,0.119184,-0.080599,0.291470,0.029819,-0.164768,-0.054290,0.040752, &
0.203204,0.444394,-0.021088,0.440545,0.171303,-0.018891,-0.176181,-0.211598, &
0.104551,0.238436,0.133981,0.332959,-0.168109,-0.013431,-0.177106,-0.082001, &
0.261205,0.335885,0.038553,0.232898,0.204534,-0.012437,-0.028009,-0.045213, &
0.107877,0.191192,-0.109360,0.452282,-0.080860,-0.301539,-0.125721,-0.100448, &
-0.870299,0.509918,0.527131,0.714753,0.433577,0.041663,0.532701,0.346044, &
-0.785434,-0.117906,0.471987,0.474124,0.277048,0.148413,0.568561,0.843296, &
-0.701881,-0.215455,0.151946,-0.197825,-0.072453,0.461793,0.604139,0.432501, &
-0.335069,-0.331745,-0.112806,-0.272554,-0.425338,0.036758,0.265616,0.467703, &
-0.299577,-0.406813,0.404516,-0.547638,-0.401682,0.036980,0.084680,0.356007, &
-0.133466,-0.470119,0.419100,-0.618436,-0.348923,0.150964,-0.025467,0.196555, &
0.355000,-0.247999,0.358628,-0.234543,-0.047358,0.076050,-0.003716,-0.022678, &
-0.010923,-0.110964,-0.209346,-0.036571,-0.483519,0.054184,0.089298,-0.140114, &
-0.290057,-0.021873,-0.682112,0.524785,-0.335058,0.037994,0.307815,-0.152841, &
-0.640629,0.102992,-0.139060,0.876133,-0.376686,0.008617,0.359353,0.523737, &
0.177165,0.009844,0.064559,0.094817,0.094883,-0.104851,-0.002054,-0.130721, &
0.034915,0.058177,0.008625,-0.001356,0.092101,0.032161,0.013058,0.021368, &
-0.021984,-0.011802,0.016121,-0.093996,-0.032075,0.130427,0.012931,0.007783, &
0.070579,0.007040,0.020803,0.114908,-0.070633,0.096421,0.020757,-0.064765, &
-0.027924,0.130938,-0.126315,-0.096911,0.073695,-0.030623,-0.057319,0.087405, &
-0.013966,-0.008688,-0.006224,0.018175,-0.053008,-0.096167,-0.038157,0.035548, &
-0.057808,-0.129185,-0.006707,-0.064215,-0.017174,0.112492,0.104587,-0.105921, &
-0.030685,-0.040838,-0.098471,-0.241202,-0.040076,0.047685,-0.008824,-0.027742, &
-0.144104,-0.188023,-0.024139,0.123987,-0.165244,-0.168886,0.001166,-0.024213, &
0.108911,0.078209,0.237857,0.140355,0.189386,0.047428,0.039299,0.079390, &
-0.061486,0.101438,-0.131405,-0.237788,-0.084796,0.211272,-0.020274,0.115161, &
-0.123399,0.221590,-0.121986,-0.099494,-0.111308,0.322263,-0.075611,0.181120, &
0.047948,-0.054916,-0.119707,0.128001,-0.083468,-0.082223,0.029484,-0.128447, &
0.046283,-0.064619,-0.097070,-0.054718,-0.054442,-0.310963,-0.061529,-0.037556, &
-0.092198,0.175657,0.092914,0.332167,0.002742,0.250623,-0.029838,0.129107, &
0.139619,-0.153303,0.055189,-0.082807,-0.053212,0.000343,0.070074,-0.160599, &
-0.014376,-0.038054,-0.004520,0.220457,-0.230302,-0.095489,-0.058383,-0.037001, &
-0.013634,-0.009812,0.109853,0.268867,-0.196844,0.040770,-0.090686,-0.001490 &
/),(/8,126/))
real, dimension(2,8) :: hidden1 = &
Reshape((/-2.008769,-0.354362, &
2.296098,-0.227166, &
4.026399,0.305678, &
-0.618457,-0.693511, &
-1.317380,-0.124120, &
-1.262783,0.299401, &
4.060811,-1.685129, &
-0.110255,-1.586430 &
/),(/2,8/))
real, dimension(1,2) :: hidden2 = &
Reshape((/1.125974,1.465161/),(/1,2/))
real, dimension(8) :: bias1 = &
(/-1.869172,1.38275,1.478498,-1.070625,-1.248389,-1.066565,0.905124,-1.463771/)
real, dimension(2) :: bias2 = &
(/0.296874,0.245575/)
real, dimension(1) :: bias3 = &
(/-0.012135/)
contains
subroutine fnet_MTZ_initall()
end subroutine fnet_MTZ_initall
subroutine fnet_MTZ_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_MTZ_engine
end module fnet_MTZ