Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addition of a subroutine to compute the median of array elements #426
Addition of a subroutine to compute the median of array elements #426
Changes from 29 commits
8dddff4
dbc16af
5d38d82
935949e
d506f4a
2bc1a8b
ac1a2a2
fdfd150
b19c537
8ed99fe
0d46361
bad19f8
3342c6a
929d5c1
7e3111e
dfea79d
8f4a57f
4f43ce5
6644140
2ca833a
e0f68ed
3eb4e4a
de2c419
9bbcb74
f17b890
391c658
afc92a2
4d328dc
bdb47b7
227f021
9d38d9d
cbdc4ac
a13c700
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a question. I couldn't really grasp the purpose of median with the scalar optional mask? The false case will always give NaN, and the true case is the same as having no mask, right?
Is the use case supposed to be something like:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same, I'm confused about this as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is to be in agreement with the API of the intrinsic
sum
, and the already implementedmean
,var
,...Such API will indeed cover cases as proposed by @ivan-pi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is indeed the case for SUM. It would be interesting to learn the output of
sum(array,.false.)
. Is it also NaN?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sum(array, .false.)
will return0
, as following the standard.The functions
mean
,var
, .... will returnNaN
, because ofmean(array, .false.) = sum(array, .false.) / 0
For
median
, if all elements correspond to.false.
, then there are no elements formedian
. Hence, it makes sense to returnNaN
IMO.