simplicity returns the simplicity score for how will the curent q, lMin, lMax, lStep and skip match the given nice numbers, Q.
(q float64, Q []float64, skip int, lMin, lMax, lStep float64)
| 189 | // simplicity returns the simplicity score for how will the curent q, lMin, lMax, |
| 190 | // lStep and skip match the given nice numbers, Q. |
| 191 | func simplicity(q float64, Q []float64, skip int, lMin, lMax, lStep float64) float64 { |
| 192 | const eps = dlamchP * 100 |
| 193 | |
| 194 | for i, v := range Q { |
| 195 | if v == q { |
| 196 | m := math.Mod(lMin, lStep) |
| 197 | v = 0 |
| 198 | if (m < eps || lStep-m < eps) && lMin <= 0 && 0 <= lMax { |
| 199 | v = 1 |
| 200 | } |
| 201 | return 1 - float64(i)/(float64(len(Q))-1) - float64(skip) + v |
| 202 | } |
| 203 | } |
| 204 | panic("labelling: invalid q for Q") |
| 205 | } |
| 206 | |
| 207 | // maxSimplicity returns the maximum simplicity for q, Q and skip. |
| 208 | func maxSimplicity(q float64, Q []float64, skip int) float64 { |