Fortran Quantile subroutine, Fortran 90

AI Thread Summary
A user is seeking a Fortran 90 subroutine for calculating quantiles from a 1-D array, specifically looking for a method to obtain the median with a function call like "call quantile(array,0.5D0,value)". Another participant suggests using existing sorting routines to achieve this, recommending to sort the array, determine its size, and access the appropriate data point for the quantile. The original poster confirms they have implemented this solution successfully.
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:
Technology 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 :-)
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I have a quick questions. I am going through a book on C programming on my own. Afterwards, I plan to go through something call data structures and algorithms on my own also in C. I also need to learn C++, Matlab and for personal interest Haskell. For the two topic of data structures and algorithms, I understand there are standard ones across all programming languages. After learning it through C, what would be the biggest issue when trying to implement the same data...

Similar threads

Replies
5
Views
3K
Replies
4
Views
2K
Replies
2
Views
2K
Replies
5
Views
13K
Replies
2
Views
2K
Replies
2
Views
8K
Replies
18
Views
6K
Replies
12
Views
3K
Back
Top