-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsigmoid2d.f90
More file actions
31 lines (26 loc) · 778 Bytes
/
sigmoid2d.f90
File metadata and controls
31 lines (26 loc) · 778 Bytes
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
!compile with
!f2py -c -m sigmoid2d --f90flags="-fopenmp -lm " --opt="-O3 " -lgomp --fcompiler=gnu95 sigmoid2d.f90
subroutine sigmoid2d(z,nr,nc)
use omp_lib
implicit none
real*8 z(nr,nc)
integer nr, nc
integer :: i, j, num_threads
! integer OMP_get_num_threads
!f2py intent(in) :: z
!f2py intent(hide) :: nr, nc
!f2py intent(out) :: z
!$OMP PARALLEL DO PRIVATE(i),shared(z)
do i=1,nr
! if (j == 1) then
! The if clause can be removed for serious use.
! It is here for debugging only.
! num_threads = OMP_get_num_threads()
! print *, 'num_threads running:', num_threads
! end if
do j=1,nc
z(i,j) = 1.d0/(1.d0 + exp(-1.d0*z(i,j)))
end do
end do
!$OMP END PARALLEL DO
end subroutine sigmoid2d