Tile Loop

Description: This refactoring takes a double nested do-loop, and creates a nested do-loop with four levels of depth. Instead of iterating through a two dimensional array (for example) by going through each row, it will loop over smaller tile blocks.

State: Implemeted         Author:  Ashley Kasza      Version:   Photran 7.0

Code Example:

    program main

    integer :: i,j

    do i = 1,50
         do j = 1,40
             print *,i
         end do
    end do

end program main

   program main

        integer :: i1, j1

    integer :: i,j
    do i1=1,50,1
        do j1=1,40,1
            do i=max( 1,i1),min(50,i1+0)
                do j=max( 1,j1),min(40,j1+0)
                    print *,i
                end do
            end do
        end do
    end do

end program main


ScreenShots

      

HTML Comment Box is loading comments...