Commit 62b50b87 authored by Wolfgang Kilian's avatar Wolfgang Kilian
Browse files

Test für initialisiertes Neuron

parent b6ec4eea
......@@ -11,6 +11,7 @@ module neurons
real(wp), dimension(:), allocatable :: b
contains
procedure :: write
procedure :: init
end type neuron
contains
......@@ -21,8 +22,22 @@ contains
write (u, "(1X,A)") "Neuron:"
write (u, "(3x,A,1x,F11.9)") "a =", n%a
write (u, "(3x,A,1x,A)") "b =", "[leer]"
if (allocated (n%b)) then
write (u, "(3x,A,*(1x,F11.9))") "b =", n%b
else
write (u, "(3x,A,1x,A)") "b =", "[leer]"
end if
end subroutine write
subroutine init (n, a, b)
class(neuron), intent(out) :: n
real(wp), intent(in) :: a
real(wp), dimension(:), intent(in) :: b
n%a = a
n%b = b
end subroutine init
end module neurons
......@@ -10,6 +10,8 @@ program nnet
write (u, *)
call test_empty_neuron
write (u, *)
call test_init_neuron
close (u)
......@@ -35,4 +37,17 @@ contains
end subroutine test_empty_neuron
! Test: initialisiertes Neuron
subroutine test_init_neuron
use kinds, only: wp
use neurons, only: neuron
type(neuron) :: n
write (u, "(A)") "* Test: initialized neuron"
call n%init (0.5_wp, [0.1_wp, 0.2_wp])
call n%write (u)
end subroutine test_init_neuron
end program nnet
......@@ -5,3 +5,8 @@
Neuron:
a = 0.000000000
b = [leer]
* Test: initialized neuron
Neuron:
a = 0.500000000
b = 0.100000000 0.200000000
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment