Quantile subroutine, Fortran 90

  • Context: Fortran 
  • Thread starter Thread starter natski
  • Start date Start date
  • Tags Tags
    Fortran Subroutine
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 7K views
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:
Physics news on Phys.org
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 :-)