L1 norm of element-wise difference.
(a: &[f64], b: &[f64])
| 84 | |
| 85 | /// L1 norm of element-wise difference. |
| 86 | pub fn l1_norm_delta(a: &[f64], b: &[f64]) -> f64 { |
| 87 | let n = a.len().min(b.len()); |
| 88 | let mut sum = 0.0f64; |
| 89 | for i in 0..n { |
| 90 | sum += (a[i] - b[i]).abs(); |
| 91 | } |
| 92 | sum |
| 93 | } |
| 94 | |
| 95 | /// Sum of a[i] where mask[i] is true. |
| 96 | pub fn dangling_sum(a: &[f64], mask: &[bool]) -> f64 { |
nothing calls this directly
no test coverage detected