Add note about floating point weights in update_weights docs (#1280)
This commit is contained in:
parent
4bde8a0adb
commit
ae4b48ece8
@ -141,6 +141,10 @@ impl<X: SampleUniform + PartialOrd> WeightedIndex<X> {
|
||||
/// allocation internally.
|
||||
///
|
||||
/// In case of error, `self` is not modified.
|
||||
///
|
||||
/// Note: Updating floating-point weights may cause slight inaccuracies in the total weight.
|
||||
/// This method may not return `WeightedError::AllWeightsZero` when all weights
|
||||
/// are zero if using floating-point weights.
|
||||
pub fn update_weights(&mut self, new_weights: &[(usize, &X)]) -> Result<(), WeightedError>
|
||||
where X: for<'a> ::core::ops::AddAssign<&'a X>
|
||||
+ for<'a> ::core::ops::SubAssign<&'a X>
|
||||
|
Loading…
x
Reference in New Issue
Block a user