pub fn hash_item(&mut self, id:D, weight:f64) {
        assert!(weight > 0.);
        trace!("hash_item : id {:?}  weight {} ", id, weight);
        let winv = 1./weight;
        let unif0m = Uniform::<usize>::new(0, self.m);
        let mut hasher = self.b_hasher.build_hasher();
        id.hash(&mut hasher);
        let id_hash : u64 = hasher.finish();
        let mut rng = Xoshiro256PlusPlus::seed_from_u64(id_hash);
        let mut h = winv * self.exp01.sample(&mut rng);
        let mut i = 1;
        let mut qmax = self.maxvaluetracker.get_max_value();
        while h < qmax {
            let k = unif0m.sample(&mut rng);
            assert!(k < self.m);
            if h < self.maxvaluetracker.values[k] {
                self.signature[k] = id;
                // 
                self.maxvaluetracker.update(k, h);
                qmax = self.maxvaluetracker.get_max_value();
            }
            h = winv * i as f64;
            i = i + 1;
            if h >= qmax {
                break;
            }
            h = h + winv * self.exp01.sample(&mut rng);
            trace!("hash_item :  i h qmax =  {}   {}   {} ", i, h, qmax);
        }
    }
/// Incrementally adds an item in hash signature. It can be used in streaming.  
/// It is the building block of the computation, but this method 
/// does not check for unicity of id added in hash computation.  
/// It is the user's responsability to enforce that. See function hash_weigthed_idxmap
Incrementally adds an item in hash signature. It can be used in streaming.
It is the building block of the computation, but this method
does not check for unicity of id added in hash computation.
It is the user's responsability to enforce that.
Incrementally adds an item in hash signature . It can be used in streaming . It is the building block of the computation but this method does not check for unicity of id added in hash computation . It is the user ' s responsability to enforce that .
pub fn hash_item(&mut self, id:D, weight:f64) {
        assert!(weight > 0.);
        trace!("hash_item : id {:?}  weight {} ", id, weight);
        let winv = 1./weight;
        let unif0m = Uniform::<usize>::new(0, self.m);
        let mut hasher = self.b_hasher.build_hasher();
        id.hash(&mut hasher);
        let id_hash : u64 = hasher.finish();
        let mut rng = Xoshiro256PlusPlus::seed_from_u64(id_hash);
        let mut h = winv * self.exp01.sample(&mut rng);
        let mut i = 1;
        let mut qmax = self.maxvaluetracker.get_max_value();
        while h < qmax {
            let k = unif0m.sample(&mut rng);
            assert!(k < self.m);
            if h < self.maxvaluetracker.values[k] {
                self.signature[k] = id;
                // 
                self.maxvaluetracker.update(k, h);
                qmax = self.maxvaluetracker.get_max_value();
            }
            h = winv * i as f64;
            i = i + 1;
            if h >= qmax {
                break;
            }
            h = h + winv * self.exp01.sample(&mut rng);
            trace!("hash_item :  i h qmax =  {}   {}   {} ", i, h, qmax);
        }
    }
pub fn hash_item ( & mut self , id : D , weight : f64 ) { assert ! ( weight 0. ) ; trace ! ( " " id weight ) ; let winv = 1. / weight ; let unif0m = Uniform :: < usize > :: new ( 0 , self . m ) ; let mut hasher = self . b_hasher . build_hasher ( ) ; id . hash ( & mut hasher ) ; let id_hash : u64 = hasher . finish ( ) ; let mut rng = Xoshiro256PlusPlus :: seed_from_u64 ( id_hash ) ; let mut h = winv * self . exp01 . sample ( & mut rng ) ; let mut i = 1 ; let mut qmax = self . maxvaluetracker . get_max_value ( ) ; while h < qmax { let k = unif0m . sample ( & mut rng ) ; assert ! ( k self m ) ; if h < self . maxvaluetracker . values [ k ] { self . signature [ k ] = id ; //  self . maxvaluetracker . update ( k , h ) ; qmax = self . maxvaluetracker . get_max_value ( ) ; } h = winv * i as f64 ; i = i + 1 ; if h >= qmax { break ; } h = h + winv * self . exp01 . sample ( & mut rng ) ; trace ! ( " " i h qmax ) ; } }
Incrementally adds an item in hash signature.
Incrementally adds an item in hash signature .
&mut self
id
D
weight
f64