Encode phenotype parameters into integer genotype ph(k) are x,y coordinates [ 0 < x,y < 1 ]
Type | Intent | Optional | 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 |
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