Commit 16ffa45
fix: propagate NaN in Matrix::inf_norm (#85)
`Matrix::inf_norm()` silently returned 0.0 for matrices containing NaN
entries because `NaN > max_row_sum` always evaluates to false, so NaN
rows were skipped entirely. This contradicts the expected mathematical
behavior that any NaN entry contaminates the norm.
- Detect NaN row sums explicitly and short-circuit to `f64::NAN`
(marked `cold_path()`). Preferred `f64::maximum` is still unstable
behind `float_minimum_maximum` as of Rust 1.95, so the explicit
check is used instead.
- Document NaN/Inf behavior with a new "Non-finite handling" section
and a NaN doctest.
- Add regression tests across D=2..=5 via a macro:
all-NaN → NaN, single-NaN → NaN, `+∞` entry → `+∞`.
Tests: `just ci` — 98 lib, 26 doc, 259 exact-feature, 101 Python,
all examples, all linters/validators.
Closes #85
Co-Authored-By: Oz <oz-agent@warp.dev>1 parent 56973bc commit 16ffa45
1 file changed
Lines changed: 61 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
116 | 122 | | |
117 | 123 | | |
118 | 124 | | |
119 | 125 | | |
120 | 126 | | |
121 | 127 | | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
122 | 132 | | |
123 | 133 | | |
124 | 134 | | |
| |||
127 | 137 | | |
128 | 138 | | |
129 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
130 | 147 | | |
131 | 148 | | |
132 | 149 | | |
| |||
758 | 775 | | |
759 | 776 | | |
760 | 777 | | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
761 | 822 | | |
0 commit comments