Commit b4fbc13f authored by Martin Beseda's avatar Martin Beseda
Browse files

TMP (uncompilable): Attempting to use basic data types from module...

TMP (uncompilable): Attempting to use basic data types from module data_kinds_4neuro_m + attempting to solve compilation problem
parent 5d444625
......@@ -26,7 +26,7 @@ module connection_m
class(neuron_t), pointer :: input_neuron !< Pointer to an input neuron
class(neuron_t), pointer :: output_neuron !< Pointer to an output neuron
real :: weight !< Weight of the connection
real(kind=real_4neuro) :: weight !< Weight of the connection
contains
......@@ -63,7 +63,7 @@ module connection_m
!> Passes (assigns) the product
!! input neuron state * weight)
!! to an output neuron.
procedure :: pass_signal => pass_signal_impl
procedure :: pass_signal => pass_signal_impl
!> Scalar desctructor for single instances of the class connection_t
final :: destroy_connection
......@@ -137,7 +137,7 @@ module connection_m
function new_connection_2(input_neuron, output_neuron) result(new_obj)
class(neuron_t), pointer, intent(in) :: input_neuron
class(neuron_t), pointer, intent(in) :: output_neuron
real :: weight
real(kind=real_4neuro) :: weight
type(connection_t), pointer :: new_obj
integer :: values(8) !< values(8) is used as seed
......@@ -166,7 +166,7 @@ module connection_m
function new_connection_3(input_neuron, output_neuron, weight) result(new_obj)
class(neuron_t), pointer, intent(in) :: input_neuron
class(neuron_t), pointer, intent(in) :: output_neuron
real, intent(in) :: weight
real(kind=real_4neuro), intent(in) :: weight
type(connection_t), pointer :: new_obj
#ifdef TIME_PROFILING
real :: start_time
......@@ -273,11 +273,11 @@ module connection_m
!! @param[in] input_neuron Pointer to the input neuron (instance of neuron_t)
!! @param[in] output_neuron Pointer to the output neuron (instance of neuron_t)
!! @param[in] weight Weight of the connection (real number)
subroutine connection_init_components_impl(this, input_neuron, output_neuron, weight)
class(connection_t), intent(inout) :: this
class(neuron_t), pointer :: input_neuron
class(neuron_t), pointer :: output_neuron
real, intent(in) :: weight
subroutine connection_init_components_impl(this, input_neuron, output_neuron, weight)
class(connection_t), intent(inout) :: this
class(neuron_t), pointer, intent(in) :: input_neuron
class(neuron_t), pointer, intent(in) :: output_neuron
real(kind=real_4neuro), intent(in) :: weight
#ifdef TIME_PROFILING
real :: start_time
......@@ -314,7 +314,7 @@ module connection_m
!! @param[in] added_value Number (real) to be added to the current weight
subroutine adjust_weight_impl(this, added_value)
class(connection_t), intent(inout) :: this
real, intent(in) :: added_value
real(kind=real_4neuro), intent(in) :: added_value
#ifdef TIME_PROFILING
real :: start_time
call time_profiling_start(start_time)
......@@ -355,7 +355,7 @@ module connection_m
function new_interval_connection_2(input_neuron, output_neuron) result(new_obj)
class(neuron_t), pointer, intent(in) :: input_neuron
class(neuron_t), pointer, intent(in) :: output_neuron
real :: weight
real(kind=real_4neuro) :: weight
type(interval_connection_t), pointer :: new_obj
integer :: values(8)
#ifdef TIME_PROFILING
......@@ -381,7 +381,7 @@ module connection_m
function new_interval_connection_3(input_neuron, output_neuron, weight) result(new_obj)
class(neuron_t), pointer, intent(in) :: input_neuron
class(neuron_t), pointer, intent(in) :: output_neuron
real, intent(in) :: weight
real(kind=real_4neuro), intent(in) :: weight
type(interval_connection_t), pointer :: new_obj
#ifdef TIME_PROFILING
real :: start_time
......
......@@ -9,6 +9,7 @@
module neuron_m
use time_measurement_m
use normal_m
use data_kinds_4neuro_m
implicit none
......@@ -22,10 +23,10 @@ module neuron_m
type, abstract :: neuron_t
private
real :: potential !< Neuron inner potential
real :: state !< State of the neuron (0/1 for binary n. etc.)
real(kind=real_4neuro) :: potential !< Neuron inner potential
real(kind=real_4neuro) :: state !< State of the neuron (0/1 for binary n. etc.)
integer :: id !< Neuron ID
integer(kind=integer_4neuro) :: id !< Neuron ID
contains
!> Initalizes the common neuron_t classes components
......@@ -72,15 +73,15 @@ module neuron_m
contains
!> Mock method, does nothing - it's only purpose is to override the deffered one
procedure :: activate => mock_activate_impl
procedure :: activate => mock_activate_impl
!> Getter to the 'potential' component
!! @return Number 5.0
procedure :: get_potential => mock_get_potential_impl
procedure :: get_potential => mock_get_potential_impl
!> Getter to the 'state' component
!! @return Number 15.0
procedure :: get_state => mock_get_state_impl
procedure :: get_state => mock_get_state_impl
end type mock_neuron_t
interface mock_neuron_t
......@@ -129,10 +130,11 @@ module neuron_m
!> Linear neuron class - uses activation function in the form f(x)=a*x + b,
!! 'x' being the neuron's potential
type, extends(neuron_t) :: linear_neuron_t
private
!! Coefficients for the linear activation function in format 'f(x)=a*x + b'
real, private :: a_coef !> The coefficient 'a' in the activation function f(x)=a*x + b
real, private :: b_coef !> The coefficient 'b' in the activation function f(x)=a*x + b
real :: a_coef !> The coefficient 'a' in the activation function f(x)=a*x + b
real :: b_coef !> The coefficient 'b' in the activation function f(x)=a*x + b
contains
......@@ -160,8 +162,9 @@ module neuron_m
!! in the form f(x) = (1 + e^(-x))^(-alpha),
!! 'x' being the neuron potential here
type, extends(neuron_t) :: logistic_neuron_t
private
real, private :: alpha_coef
real :: alpha_coef
contains
......@@ -198,7 +201,7 @@ module neuron_m
!! @return Value of the neuron's potential (real number)
function get_potential_impl(this) result(potential)
class(neuron_t), intent(in) :: this
real :: potential
real(kind=real_4neuro) :: potential
#ifdef TIME_PROFILING
real :: start_time
call time_profiling_start(start_time)
......@@ -213,7 +216,7 @@ module neuron_m
!! @return Value of the current neuron's state
function get_state_impl(this) result(state)
class(neuron_t), intent(in) :: this
real :: state
real(kind=real_4neuro) :: state
#ifdef TIME_PROFILING
real :: start_time
call time_profiling_start(start_time)
......@@ -227,10 +230,10 @@ module neuron_m
!> Getter to the 'id' component
!! @return Neuron ID
function get_id_impl(this) result(id)
class(neuron_t), intent(in) :: this
integer :: id
class(neuron_t), intent(in) :: this
integer(kind=integer_4neuro) :: id
#ifdef TIME_PROFILING
real :: start_time
real :: start_time
call time_profiling_start(start_time)
#endif
id = this%id
......@@ -264,8 +267,8 @@ module neuron_m
!> Adds the input signal value to the current potential
!! @param[in] input_signal Input value
subroutine adjust_potential_impl(this, input_signal)
class(neuron_t), intent(inout) :: this
real, intent(in) :: input_signal
class(neuron_t), intent(inout) :: this
real(kind=real_4neuro), intent(in) :: input_signal
#ifdef TIME_PROFILING
real :: start_time
call time_profiling_start(start_time)
......@@ -324,7 +327,7 @@ module neuron_m
!! @return Number 5.0
function mock_get_potential_impl(this) result(return_value)
class(mock_neuron_t), intent(in) :: this
real :: return_value
real(kind=real_4neuro) :: return_value
#ifdef TIME_PROFILING
real :: start_time
call time_profiling_start(start_time)
......@@ -340,7 +343,7 @@ module neuron_m
!! @return Number 15.0
function mock_get_state_impl(this) result(return_value)
class(mock_neuron_t), intent(in) :: this
real :: return_value
real(kind=real_4neuro) :: return_value
#ifdef TIME_PROFILING
real :: start_time
call time_profiling_start(start_time)
......@@ -388,10 +391,10 @@ module neuron_m
!! @param[in] threshold Threshold used by unit-step activation function
!! @return Pointer to the instance of the class binary_neuron_t
function new_binary_neuron_1(threshold) result(new_obj)
real, intent(in) :: threshold
type(binary_neuron_t), pointer :: new_obj
real(kind=real_4neuro), intent(in) :: threshold
type(binary_neuron_t), pointer :: new_obj
#ifdef TIME_PROFILING
real :: start_time
real :: start_time
call time_profiling_start(start_time)
#endif
allocate(new_obj)
......@@ -462,10 +465,10 @@ module neuron_m
!! @param[in] b_coef b coef. of the linear activation fucntion
!! @return Pointer to the instance of the class linear_neuron_t
function new_linear_neuron_2(a_coef, b_coef) result(new_obj)
real, intent(in) :: a_coef
real, intent(in) :: b_coef
real(kind=real_4neuro), intent(in) :: a_coef
real(kind=real_4neuro), intent(in) :: b_coef
type(linear_neuron_t), pointer :: new_obj
type(linear_neuron_t), pointer :: new_obj
#ifdef TIME_PROFILING
real :: start_time
call time_profiling_start(start_time)
......@@ -532,10 +535,10 @@ module neuron_m
!! @param[in] alpha_coef Alpha coefficient in the logistic activation function
!! @return Pointer to the instance of the class logistic_neuron_t
function new_logistic_neuron_1(alpha_coef) result(new_obj)
real, intent(in) :: alpha_coef
type(logistic_neuron_t), pointer :: new_obj
real(kind=real_4neuro), intent(in) :: alpha_coef
type(logistic_neuron_t), pointer :: new_obj
#ifdef TIME_PROFILING
real :: start_time
real :: start_time
call time_profiling_start(start_time)
#endif
......
......@@ -4,6 +4,8 @@
!! @author Martin Beseda
!! @date 2017
module time_measurement_m
use data_kinds_4neuro_m
implicit none
public
......@@ -13,7 +15,7 @@ module time_measurement_m
!> Subroutine for starting time profiling
!! @param[out] start_time Parameter, where current time will be saved (real number)
subroutine time_profiling_start(start_time)
real, intent(inout) :: start_time
real(kind=real_4neuro), intent(inout) :: start_time
call cpu_time(start_time)
end subroutine time_profiling_start
......@@ -24,7 +26,7 @@ module time_measurement_m
!! @param[in] start_time Parameter containing starting time (real number)
!! @param[in] region_name Name of the measured region (string)
subroutine time_profiling_stop(start_time, region_name)
real, intent(in) :: start_time
real(kind=real_4neuro), intent(in) :: start_time
character(len=*) :: region_name
real :: stop_time
character(len=35) :: s
......
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