You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add argmin/max_skipnan and indexed_fold_skipnan (#33)
* Implement argmin_skipnan
* Implement argmax_skipnan
* Loosen the rule for argmin max related methods
* Make returning code clearer
* Add quickcheck for argmin_skipnan, argmax_skipnan
* Use `fold` instead of `for`
* Add indexed_fold_skipnan to MaybeNanExt
* Impl argmin/max_skipnan using indexed_fold_skipnan
* Fix argmin/max_skipnan quickcheck tests
The old tests were incorrect because `min`/`max` return `None` when
there are *any* NaN values (or the array is empty), while
`argmin/max_skipnan` should return `None` only when *all* the values
are NaNs (or the array is empty).
This wasn't caught earlier because the `quickcheck::Arbitrary`
implementation for `f32` generates only finite values. To make sure
the behavior with NaN values is properly tested, the element type in
the test has been changed to `Option<i32>`.
* Replace min/max.map with if for clarity
* Add () to make the match clearer
0 commit comments