encode Subroutine

private subroutine encode(me, ph, gn)

Encode phenotype parameters into integer genotype ph(k) are x,y coordinates [ 0 < x,y < 1 ]

Type Bound

pikaia_class

Arguments

Type IntentOptional Attributes Name
class(pikaia_class), intent(in) :: me
real(kind=wp), intent(in), dimension(me%n) :: ph
integer, intent(out), dimension(me%n*me%nd) :: gn

Called by

proc~~encode~~CalledByGraph proc~encode pikaia_module::pikaia_class%encode proc~pikaia pikaia_module::pikaia_class%pikaia proc~pikaia->proc~encode proc~solve_with_pikaia pikaia_module::pikaia_class%solve_with_pikaia proc~solve_with_pikaia->proc~pikaia

Source Code

    subroutine encode(me,ph,gn)

    implicit none

    class(pikaia_class),intent(in)            :: me
    real(wp),dimension(me%n),intent(in)       :: ph
    integer,dimension(me%n*me%nd),intent(out) :: gn

    integer  :: ip,i,j,ii
    real(wp) :: z

    z=10.0_wp**me%nd
    ii=0
    do i=1,me%n
        ip=int(ph(i)*z)
        do j=me%nd,1,-1
            gn(ii+j)=mod(ip,10)
            ip=ip/10
        end do
        ii=ii+me%nd
    end do

    end subroutine encode