forked from dwr-psandhu/ann_calsim
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfnet_X2.f90
111 lines (109 loc) · 6.06 KB
/
fnet_X2.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
module fnet_X2
! a = 0.015276
! b = -0.57708
intrinsic Reshape
real, dimension(8,54) :: input = &
Reshape((/-3.437137,1.193817,1.342572,-3.253250,3.542509,-0.017063,1.798327,2.019635 &
,-3.959873,-7.396043,-7.670904,-4.883084,-3.093680,-2.618034,2.897167,-0.349862 &
,-3.432326,-6.070485,0.992810,-3.994467,-5.415946,-3.375664,1.078381,-1.678598 &
,-2.817410,-3.997076,0.183435,-2.777499,-3.837134,-1.614006,-0.133452,-2.463486 &
,-1.680253,-2.453976,0.999087,-2.101582,-2.982478,0.031890,0.868303,-3.377735 &
,-1.219584,-0.880832,-0.395056,-1.048456,-4.474589,0.072824,1.161318,-4.269753 &
,1.235753,1.202389,-0.052998,1.325210,-4.078216,1.851660,-0.702133,0.914647 &
,0.028207,-2.886787,0.586837,2.609778,-9.254420,1.952760,-0.363893,3.313863 &
,-15.965164,-0.430429,-0.123346,-15.090837,-22.207085,-24.940529,12.574998,-7.207396 &
,-14.949311,0.949644,-0.301487,-7.482528,-3.766253,-35.132668,10.085158,-4.489647 &
,-11.270763,-0.424288,0.072169,-0.983799,0.037038,-27.951677,16.468254,-16.176304 &
,-1.774199,-0.134919,-0.177615,-0.758495,0.421113,-11.049678,25.544410,-16.927814 &
,1.175855,0.141769,0.312833,-1.091863,-0.233434,-3.866010,27.664812,-13.555112 &
,2.697534,0.225025,-0.445677,-2.978242,-0.600198,0.281761,34.265457,-21.936510 &
,-1.486668,-0.240575,0.305966,2.914843,0.042694,1.805343,24.197424,-10.872210 &
,0.342155,0.272011,-0.097143,5.102058,-0.038713,0.239018,18.888039,-9.083898 &
,-0.399127,0.089610,-0.543296,-3.727368,-0.092169,0.363451,11.461532,-9.843420 &
,0.438263,-0.152978,0.368666,2.353009,0.146063,-1.990102,17.840313,-19.369516 &
,0.063256,-0.043925,0.123903,-0.005277,-0.070074,0.008519,0.425807,-0.145833 &
,0.136414,0.107748,-0.233459,0.025084,-0.056709,-0.026873,-0.050726,0.174843 &
,-0.033355,0.004345,0.188948,-0.142038,-0.096009,0.058807,0.157639,0.329596 &
,0.185306,0.042430,0.159035,-6.410312,0.071911,0.158982,-0.023867,-1.305023 &
,-0.062953,-0.056120,0.001060,-0.323741,0.085620,0.141928,0.143851,-2.364111 &
,0.024703,0.092593,-0.073483,0.118587,-0.108021,0.009212,0.190982,-1.586856 &
,0.251770,0.055630,0.029771,-0.014574,-0.129282,-0.139352,-0.122964,1.492320 &
,-0.009523,0.010274,-0.022699,-0.096116,0.007743,-0.002431,-0.010513,0.200259 &
,-0.103080,0.061195,-0.160239,0.095430,0.019439,-0.074858,0.130931,-3.855193 &
,-0.242463,-0.061893,0.040926,0.010759,0.006777,0.599772,0.026949,-1.533455 &
,-0.254442,0.002919,0.049463,-0.010792,0.006806,0.086974,0.454478,0.753817 &
,-0.020601,0.026687,-0.064379,0.027449,0.047761,-0.204189,-0.240786,0.214538 &
,0.046833,-0.027001,0.057303,0.375089,-0.031486,-0.082057,0.065436,-0.696675 &
,-0.002574,0.053921,-0.084121,-0.250805,-0.027990,0.150940,0.347310,0.260784 &
,-0.101085,-0.040238,0.003386,-0.005803,0.025029,0.043348,-0.456560,0.345900 &
,-0.273468,-0.076959,0.079138,0.657082,0.117138,0.025450,-0.431479,-1.057346 &
,0.084269,0.077821,-0.034161,-0.826461,-0.032333,-0.179400,0.013779,1.331102 &
,0.089257,-0.029816,0.012547,0.754480,-0.066673,-0.110205,-1.280766,-2.060975 &
,-0.144440,0.429622,0.511880,0.048493,0.152510,-0.283249,-0.682704,-0.891598 &
,0.358062,0.226769,-0.363503,0.095651,0.052452,-0.195870,0.882901,0.407610 &
,0.543879,-0.039642,0.834473,-0.639637,-0.060058,-0.493471,-0.629127,-0.137881 &
,0.111722,0.202304,0.532607,-0.339470,0.047579,-0.167965,-0.172755,-0.644774 &
,0.210045,0.211034,0.105852,-0.175312,-0.051113,-0.121786,-0.106227,-0.175353 &
,0.209085,0.044568,-0.000203,-0.528464,0.054331,-0.320650,-0.386936,0.390013 &
,0.110741,0.083782,0.319989,0.237292,-0.052288,-0.437525,-0.397453,-0.126255 &
,0.620925,-0.237430,-0.113427,-0.368516,-0.035134,-0.625363,-0.211426,-0.998326 &
,1.385453,0.039567,0.727085,-0.669963,0.248048,-1.900006,-2.224034,-0.349100 &
,1.305761,-0.296644,-1.621223,-3.642845,-0.581264,-1.332566,-3.640139,0.564439 &
,-1.912614,-0.600875,0.123113,0.231183,0.364661,2.890081,-2.388024,1.289801 &
,-1.548785,0.542889,-0.673584,-0.670563,-0.695353,3.276086,-1.441882,1.430191 &
,-2.485823,-0.113539,0.423937,-0.945605,-0.025802,4.202829,-5.694776,3.439615 &
,-0.822141,0.331362,-0.134952,-2.333592,-0.218462,1.540353,-2.668819,2.526924 &
,-1.033679,-0.425102,1.902978,0.738472,0.946046,0.849947,-0.972683,2.199693 &
,0.178104,-0.381691,-0.430242,-1.002300,0.097194,-1.479659,1.903411,3.141668 &
,0.951978,-0.299382,0.986774,-0.942263,-0.448852,-3.066992,0.893921,0.477728 &
,0.488175,0.835806,-0.504143,0.763542,-0.435786,-2.277374,4.548078,0.073429 &
/),(/8,54/))
real, dimension(2,8) :: hidden1 = &
Reshape((/42.033634,2.898902 &
,-4.555980,0.370274 &
,1.356391,0.522443 &
,-32.649242,3.309969 &
,9.620313,1.156152 &
,-47.937870,10.367124 &
,-0.660434,-1.293569 &
,39.464645,4.603959 &
/),(/2,8/))
real, dimension(1,2) :: hidden2 = &
Reshape((/-0.156993,1.693333/),(/1,2/))
real, dimension(8) :: bias1 = &
(/4.073364,2.09871,1.344428,4.704626,7.653398,6.242645,-11.783332,5.627652/)
real, dimension(2) :: bias2 = &
(/-0.609239,0.348043/)
real, dimension(1) :: bias3 = &
(/-0.296851/)
contains
subroutine fnet_X2_initall()
end subroutine fnet_X2_initall
subroutine fnet_X2_engine(inarray, outarray, init)
intrinsic MatMul, Size
real, dimension(:), intent(in) :: inarray
real, dimension(:), intent(inout) :: outarray
real, dimension(54) :: 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, 54
! inarray2(i) = inarray(55-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_X2_engine
end module fnet_X2