2 ms·
This is a sum of absolute differences, so in Rust: let satd = d.iter().cloned().map(abs).sum(); As an added bonus, there's no undefined behavior!
by pcwalton 7y ago
This is a sum of absolute differences, so in Rust:
let satd = d.iter().cloned().map(abs).sum();
As an added bonus, there's no undefined behavior!