()
| 72 | } |
| 73 | |
| 74 | fn check_chebyshev_lagrange() { |
| 75 | // chebyshev_nodes carries one of the affected loops directly. |
| 76 | for &n in &[4_usize, 8, 16, 32] { |
| 77 | let nodes = chebyshev_nodes(n, -2.0, 3.5); |
| 78 | print_kv(&format!("chebyshev_nodes(n={n}) hash"), hash_f64s(&nodes)); |
| 79 | } |
| 80 | // lagrange_polynomial uses divided-difference loops touched by clippy. |
| 81 | let xs = vec![0.0_f64, 0.5, 1.1, 1.7, 2.4, 3.0]; |
| 82 | let ys: Vec<f64> = xs.iter().map(|x| x.sin() + 0.5 * x).collect(); |
| 83 | let p = lagrange_polynomial(xs.clone(), ys.clone()); |
| 84 | for &q in &[0.1_f64, 0.7, 1.3, 1.9, 2.5] { |
| 85 | print_kv( |
| 86 | &format!("lagrange.eval({q})"), |
| 87 | format!("{:.17e}", p.eval(q)), |
| 88 | ); |
| 89 | } |
| 90 | print_kv( |
| 91 | "lagrange.derivative coeffs", |
| 92 | hash_f64s(&p.derivative().coef), |
| 93 | ); |
| 94 | print_kv("lagrange.integral coeffs", hash_f64s(&p.integral().coef)); |
| 95 | } |
| 96 | |
| 97 | fn check_lanczos() { |
| 98 | for &z in &[0.5_f64, 1.0, 1.5, 2.5, 3.7, 5.5, 10.25, 100.0] { |
no test coverage detected