rnkpop Subroutine

private subroutine rnkpop(me, arrin, indx, rank)

Ranks initial population. Calls external sort routine to produce key index and rank order of input array arrin (which is not altered).

Type Bound

pikaia_class

Arguments

Type IntentOptional Attributes Name
class(pikaia_class), intent(inout) :: me
real(kind=wp), intent(in), dimension(me%np) :: arrin
integer, intent(out), dimension(me%np) :: indx
integer, intent(out), dimension(me%np) :: rank

Calls

proc~~rnkpop~~CallsGraph proc~rnkpop pikaia_class%rnkpop proc~rqsort rqsort proc~rnkpop->proc~rqsort

Called by

proc~~rnkpop~~CalledByGraph proc~rnkpop pikaia_class%rnkpop proc~newpop pikaia_class%newpop proc~newpop->proc~rnkpop proc~pikaia pikaia_class%pikaia proc~pikaia->proc~rnkpop proc~pikaia->proc~newpop proc~solve_with_pikaia pikaia_class%solve_with_pikaia proc~solve_with_pikaia->proc~pikaia program~test_algen test_algen program~test_algen->proc~solve_with_pikaia

Source Code

    subroutine rnkpop(me,arrin,indx,rank)

    implicit none

    class(pikaia_class),intent(inout)     :: me
    real(wp),dimension(me%np),intent(in)  :: arrin
    integer,dimension(me%np),intent(out)  :: indx
    integer,dimension(me%np),intent(out)  :: rank

    integer :: i

    !Compute the key index
    call rqsort(me%np,arrin,indx)

    !and the rank order
    do i=1,me%np
        rank(indx(i)) = me%np-i+1
    end do

    end subroutine rnkpop