This commit is contained in:
2024-06-14 10:14:33 -04:00
parent 10dff1d421
commit 1ab48d08bc

View File

@@ -94,13 +94,11 @@ impl RoyaltyTree {
} else { } else {
let w0=self.weight_here_below(index); let w0=self.weight_here_below(index);
let w1=self.weight_below(index); let w1=self.weight_below(index);
println!("Weight_here at {}, weight_here_below {}, weight_below {}",index,w0,w1);
w0-w1 w0-w1
} }
} }
fn expand_to(&mut self, index: usize) -> &mut Self { fn expand_to(&mut self, index: usize) -> &mut Self {
println!("Expand_to {} ",index); for _ in self.tree.len()..=index { self.tree.push(Royalty::new()) }
for _ in self.tree.len()..=index { println!(" Push!"); self.tree.push(Royalty::new()) }
self self
} }
fn capture0(&mut self, index: usize) -> &mut Self { fn capture0(&mut self, index: usize) -> &mut Self {
@@ -136,10 +134,8 @@ impl RoyaltyTree {
fn add_royalty(&mut self, amount: FiNum) { fn add_royalty(&mut self, amount: FiNum) {
let ff=self.forefather(); let ff=self.forefather();
self.tree[ff].lazy+=amount; self.tree[ff].lazy+=amount;
println!("Add royalty amount {}, storing at node {}, lazy amount there is now {}",amount,ff,self.tree[ff].lazy);
} }
fn add_weight(&mut self, index: usize, weight: FiNum) { fn add_weight(&mut self, index: usize, weight: FiNum) {
println!("Add_weight at {}",index);
if self.tree.len()>0 { if self.tree.len()>0 {
let mut ff0=self.forefather(); let mut ff0=self.forefather();
let ff1=wt_forefather(index); let ff1=wt_forefather(index);
@@ -154,7 +150,6 @@ impl RoyaltyTree {
self.get_royalty(index); // Just for the side effect of capturing everything to this point self.get_royalty(index); // Just for the side effect of capturing everything to this point
let mut index=index; let mut index=index;
let ff=self.forefather(); let ff=self.forefather();
println!("Ascending from {} to {}",index,ff);
while index!=ff { while index!=ff {
self.tree[index].weight+=weight; self.tree[index].weight+=weight;
index=wt_parent(index); index=wt_parent(index);