Function opendp::transformations::then_find_bin
source · pub fn then_find_bin<M, TIA>(
edges: Vec<TIA>
) -> PartialTransformation<VectorDomain<AtomDomain<TIA>>, VectorDomain<AtomDomain<usize>>, M, M>where
TIA: Number,
M: DatasetMetric,
(VectorDomain<AtomDomain<TIA>>, M): MetricSpace,
(VectorDomain<AtomDomain<usize>>, M): MetricSpace,
Expand description
Make a transformation that finds the bin index in a monotonically increasing vector of edges.
For each value in the input vector, finds the index of the bin the value falls into.
edges
splits the entire range of TIA
into bins.
The first bin at index zero ranges from negative infinity to the first edge, non-inclusive.
The last bin at index edges.len()
ranges from the last bin, inclusive, to positive infinity.
To be valid, edges
must be unique and ordered.
edges
are left inclusive, right exclusive.
§Arguments
input_domain
- The domain of the input vector.input_metric
- The metric of the input vector.edges
- The set of edges to split bins by.
§Generics
M
- Metric TypeTIA
- Atomic Input Type that is numeric