Quantile subroutine, Fortran 90

2 replies · 7K views · last reply
natski
Messages
262
Reaction score
2
Hi all,

I have been Googling for a Fortran 90 quantile routine but to no avail...

I need a subroutine to which one passes an 1-D array plus the quantile range required...

e.g.

"call quantile(array,0.5D0,value)"

would give me the median of array. Does anyone know of a handy (and free) F90 script to accomplish this?

Thanks,

natski
 
Last edited:
Just use one of the many sorting routines that are available. Then get the SIZE(array), divide that number of by 2, round and get the data point at that location.
 
Yup was just about to post that I'd done exactly that :-)