fn update(&mut self, k:usize, value:f64) {
        assert!(k < self.m);
        trace!("\n max value tracker update k, value , value at k {} {} {} ", k, value, self.values[k]);
        let mut current_value = value;
        let mut current_k = k;
        let mut more = false;
        if current_value < self.values[current_k] {
            more = true;
        }
        
        while more {
            trace!("mxvt update k value {} {}", current_k, current_value);
            self.values[current_k] = current_value;
            let pidx = self.m + (current_k/2) as usize;   // m + upper integer value of k/2 beccause of 0 based indexation
            if pidx > self.last_index {
                break;
            }
            let siblidx = current_k^1;      // get sibling index of k with numeration beginning at 0
            assert!(self.values[siblidx] <= self.values[pidx]);
            assert!(self.values[current_k] <= self.values[pidx]);
            //
            if self.values[siblidx] >= self.values[pidx] && self.values[current_k] >= self.values[pidx] {
                break;     // means parent current and sibling are equals no more propagation needed
            }
            // now either self.values[siblidx] <self.values[pidx] or current_value < self.values[pidx]
            trace!("propagating current_value {} sibling  {} ? ", current_value, self.values[siblidx]);
            //
            if current_value < self.values[siblidx] {
                trace!("     propagating sibling value {} to parent {}", self.values[siblidx], pidx);
                current_value = self.values[siblidx];
            }
            else {
                trace!("     propagating current_value {} to parent {}", current_value, pidx);   
            }
            current_k = pidx;
            if current_value >= self.values[current_k]  {
                more = false;
            }
        }
    }
// update slot k with value value
// 0 indexation imposes some changes with respect to the the algo 4 of the paper
// parent of k is m + (k/2)
// and accordingly
// sibling ok k is k+1 if k even, k-1 else so it is given by bitxor(k,1)
update slot k with value value
0 indexation imposes some changes with respect to the the algo 4 of the paper
parent of k is m + (k/2)
and accordingly
sibling ok k is k+1 if k even, k-1 else so it is given by bitxor(k,1)
update slot k with value value 0 indexation imposes some changes with respect to the the algo 4 of the paper parent of k is m + ( k / 2 ) and accordingly sibling ok k is k + 1 if k even k - 1 else so it is given by bitxor ( k 1 )
fn update(&mut self, k:usize, value:f64) {
        assert!(k < self.m);
        trace!("\n max value tracker update k, value , value at k {} {} {} ", k, value, self.values[k]);
        let mut current_value = value;
        let mut current_k = k;
        let mut more = false;
        if current_value < self.values[current_k] {
            more = true;
        }
        while more {
            trace!("mxvt update k value {} {}", current_k, current_value);
            self.values[current_k] = current_value;
            let pidx = self.m + (current_k/2) as usize;   // m + upper integer value of k/2 beccause of 0 based indexation
            if pidx > self.last_index {
                break;
            }
            let siblidx = current_k^1;      // get sibling index of k with numeration beginning at 0
            assert!(self.values[siblidx] <= self.values[pidx]);
            assert!(self.values[current_k] <= self.values[pidx]);
            //
            if self.values[siblidx] >= self.values[pidx] && self.values[current_k] >= self.values[pidx] {
                break;     // means parent current and sibling are equals no more propagation needed
            }
            // now either self.values[siblidx] <self.values[pidx] or current_value < self.values[pidx]
            trace!("propagating current_value {} sibling  {} ? ", current_value, self.values[siblidx]);
            //
            if current_value < self.values[siblidx] {
                trace!("     propagating sibling value {} to parent {}", self.values[siblidx], pidx);
                current_value = self.values[siblidx];
            }
            else {
                trace!("     propagating current_value {} to parent {}", current_value, pidx);   
            }
            current_k = pidx;
            if current_value >= self.values[current_k]  {
                more = false;
            }
        }
    }
fn update ( & mut self , k : usize , value : f64 ) { assert ! ( k self m ) ; trace ! ( " \n " k value self values [ k ] ) ; let mut current_value = value ; let mut current_k = k ; let mut more = false ; if current_value < self . values [ current_k ] { more = true ; } while more { trace ! ( " " current_k current_value ) ; self . values [ current_k ] = current_value ; let pidx = self . m + ( current_k / 2 ) as usize ; // m + upper integer value of k/2 beccause of 0 based indexation if pidx > self . last_index { break ; } let siblidx = current_k ^ 1 ; // get sibling index of k with numeration beginning at 0 assert ! ( self values [ siblidx ] self values [ pidx ] ) ; assert ! ( self values [ current_k ] self values [ pidx ] ) ; // if self . values [ siblidx ] >= self . values [ pidx ] && self . values [ current_k ] >= self . values [ pidx ] { break ; // means parent current and sibling are equals no more propagation needed } // now either self.values[siblidx] <self.values[pidx] or current_value < self.values[pidx] trace ! ( " " current_value self values [ siblidx ] ) ; // if current_value < self . values [ siblidx ] { trace ! ( " " self values [ siblidx ] pidx ) ; current_value = self . values [ siblidx ] ; } else { trace ! ( " " current_value pidx ) ; } current_k = pidx ; if current_value >= self . values [ current_k ] { more = false ; } } }
update slot k with value value
0 indexation imposes some changes with respect to the the algo 4 of the paper
parent of k is m + (k/2)
and accordingly
sibling ok k is k+1 if k even, k-1 else so it is given by bitxor(k,1)
update slot k with value value 0 indexation imposes some changes with respect to the the algo 4 of the paper parent of k is m + ( k / 2 ) and accordingly sibling ok k is k + 1 if k even k - 1 else so it is given by bitxor ( k 1 )
&mut self
k
usize
value
f64