Commit ed3f782
authored
Bulk quantiles (#26)
* Promoted module to directory
* Moved interpolate to separate file
* Re-implemented quantile_axis_mut to get closer to something we can use for bulk computation
* Use a set instead of a vec to avoid repeating computations
* Use bulk method for single quantile
* Implement bulk method to get sorted
* Refactored quantiles_axis_mut to use sorted_get_many_mut
* Avoid recomputing index value
* Add quantiles_mut to 1d trait
* Return hashmaps from bulk methods
* Fixed tests
* Use IndexSet to preserve insertion order
* Fix indentation
* IndexMap provides a more intuitive behaviour
* Remove prints
* Renamed methods
* Docs for get_many_from_sorted_mut
* Added docs for private free function
* Docs for quantiles_mut
* Fixed several typos in docs
* More robust test
* Added test for quantiles
* Test quantiles_axis_mut
* Add comments
* Return options when the lane we are computing against is empty
* Fixed docs
* Fixed tests
* Move *index* functions out of Interpolate trait
The behavior of these functions should be independent of the
interpolation strategy.
* Reduce indentation in quantiles_axis_mut
* Reduce indentation in quantile_axis_skipnan_mut
* Use .into_scalar() method
* Improve docs of partition_mut
* Reformat quantiles_axis_mut
* Cargo fmt
* Fmt
* Formatting
* Log version works
* Refactor
* Fix indexes
* Working implementation
* Shorter syntax
* Formatting
* Better docs
* Comments
* Typo
* Don't lose pieces after rebase
* Fmt
* Reduce code duplication
* Fmt
* Clarify docs of get_many_from_sorted_mut_unchecked
* Add get_many_from_sorted_mut benchmark
* Simplify get_many_from_sorted_mut_unchecked
* Eliminate allocations from _get_many_from_sorted_mut_unchecked
This improves performance, especially for small arrays.
* Add get_from_sorted_mut benchmark
* Call slice_axis_mut instead of slice_mut
This has slightly lower overhead.
* Replace iter::repeat with vec!
This is a bit cleaner.
* Fix typo in comment
* Remove unnecessary type annotation
* Simplify quantiles tests
For me, the tests are easier to understand when they don't collect
into a `Vec`.
* Check keys in test_sorted_get_many_mut
* Simplify sort tests
* Improve sort and quantiles docs
* Make Interpolate::interpolate operate elementwise
* Make quantiles_* return Array instead of IndexMap
* Add interpolate parameter to quantile*
This has a few advantages:
* It's now possible to save the interpolation strategy in a variable
and easily re-use it.
* We can now freely add more type parameters to the `quantile*`
methods as needed without making them more difficult to call.
* We now have the flexibility to add more advanced interpolation
strategies in the future (e.g. one that wraps a closure).
* Calling the `quantile*` methods is now slightly more compact because
a turbofish isn't necessary.
* Make get_many_from_sorted_mut take array of indexes
This is slightly more versatile because `ArrayBase` allows arbitrary
strides.
* Make quantiles* take array instead of slice
* Remove unnecessary IndexSet
* Return EmptyInput instead of None
* Fix tests
* Match output type for argmin/max_skipnan
* Fix tests
* Fmt
* Update src/lib.rs
Co-Authored-By: LukeMathWalker <[email protected]>
* Add quantile error
* Renamed InvalidFraction to InvalidQuantile
* Return QuantileError
* Fix tests
* Fix docs
* Fmt
* Simplify and deduplicate1 parent 9e04bc0 commit ed3f782
File tree
10 files changed
+918
-281
lines changed- benches
- src
- histogram
- quantile
- tests
10 files changed
+918
-281
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | | - | |
| 27 | + | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
112 | 113 | | |
113 | 114 | | |
114 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
334 | 335 | | |
335 | 336 | | |
336 | 337 | | |
337 | | - | |
338 | | - | |
| 338 | + | |
| 339 | + | |
339 | 340 | | |
340 | 341 | | |
341 | 342 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
0 commit comments