-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bayesian framework (quartiles), remove bender
. using quick sort by Juli Rew . remove bender . compute quartile (percentile) . update quartile . remove no data's
- Loading branch information
Showing
3 changed files
with
159 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
! Recursive Fortran 95 quicksort routine | ||
! sorts real numbers into ascending numerical order | ||
! Author: Juli Rew, SCD Consulting ([email protected]), 9/03 | ||
! Based on algorithm from Cormen et al., Introduction to Algorithms, | ||
! 1997 printing | ||
|
||
! Made F conformant by Walt Brainerd | ||
|
||
module qsort_c_module | ||
|
||
public :: QsortC | ||
private :: Partition | ||
|
||
contains | ||
|
||
recursive subroutine QsortC(A) | ||
real, intent(in out), dimension(:) :: A | ||
integer :: iq | ||
|
||
if(size(A) > 1) then | ||
call Partition(A, iq) | ||
call QsortC(A(:iq-1)) | ||
call QsortC(A(iq:)) | ||
endif | ||
end subroutine QsortC | ||
|
||
subroutine Partition(A, marker) | ||
real, intent(in out), dimension(:) :: A | ||
integer, intent(out) :: marker | ||
integer :: i, j | ||
real :: temp | ||
real :: x ! pivot point | ||
x = A(1) | ||
i= 0 | ||
j= size(A) + 1 | ||
|
||
do | ||
j = j-1 | ||
do | ||
if (A(j) <= x) exit | ||
j = j-1 | ||
end do | ||
i = i+1 | ||
do | ||
if (A(i) >= x) exit | ||
i = i+1 | ||
end do | ||
if (i < j) then | ||
! exchange A(i) and A(j) | ||
temp = A(i) | ||
A(i) = A(j) | ||
A(j) = temp | ||
elseif (i == j) then | ||
marker = i+1 | ||
return | ||
else | ||
marker = i | ||
return | ||
endif | ||
end do | ||
|
||
end subroutine Partition | ||
|
||
end module qsort_c_module |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters