fix calculation of grad ith offsets

This commit is contained in:
Alain Zscheile 2024-01-02 03:13:57 +01:00
parent 8b7d751b30
commit 5e7a5bd576

View file

@ -38,13 +38,8 @@ pub fn encode_grad_ith(mut max_deriv: u8, idx: &[u8]) -> usize {
let mmj = max_deriv.checked_sub(j).unwrap();
// the amount of preceding slots before this variable
// TODO: fix this, it doesn't work yet (consider m=1,v=1; m=1,v=2; m=2,v=2)
let il1 = idx.len() - ilred - 1;
acc += (mmj..max_deriv).map(|i| {
let res = encode_grad_full_size(i, il1);
println!("({}, {}) = {}", i, il1, res);
res
}).sum::<usize>();
acc += (0..j).map(|i| encode_grad_full_size(max_deriv - i, il1)).sum::<usize>();
// now this variable is settled
max_deriv = mmj;