sort Subroutine

public pure subroutine sort(a, b, c, d)

FIXME : Add documentation

Arguments

Type IntentOptional Attributes Name
real, intent(inout), dimension(:) :: a
real, intent(inout), dimension(:) :: b
real, intent(inout), dimension(:) :: c
real, intent(inout), dimension(:) :: d

Contents

Source Code


Source Code

  pure subroutine sort(a, b, c, d)
    real, dimension(:), intent(in out) :: a, b, c, d
    real :: tmp
    integer :: i, j, jmax
    jmax = size(a)
    do j = 1, jmax
       do i = 1, jmax - j
          if (a(i+1) < a(i)) then
             tmp = a(i); a(i) = a(i+1); a(i+1) = tmp
             tmp = b(i); b(i) = b(i+1); b(i+1) = tmp
             tmp = c(i); c(i) = c(i+1); c(i+1) = tmp
             tmp = d(i); d(i) = d(i+1); d(i+1) = tmp
          end if
       end do
    end do
  end subroutine sort