MCPcopy Index your code
hub / github.com/gonum/plot / simplicity

Function simplicity

labelling.go:191–205  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

189// simplicity returns the simplicity score for how will the curent q, lMin, lMax,
190// lStep and skip match the given nice numbers, Q.
191func 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.
208func maxSimplicity(q float64, Q []float64, skip int) float64 {

Callers 1

talbotLinHanrahanFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected