;)
Blake Mizerany
11 years ago
49 | 49 | // higher ranks of the data distribution. |
50 | 50 | // See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error properties. |
51 | 51 | func NewBiased() *Stream { |
52 | f := func(s *stream, r float64) float64 { | |
52 | ƒ := func(s *stream, r float64) float64 { | |
53 | 53 | return 2 * s.epsilon * r |
54 | 54 | } |
55 | return newStream(f) | |
55 | return newStream(ƒ) | |
56 | 56 | } |
57 | 57 | |
58 | 58 | // NewTargeted returns an initialized Stream concerned with a particular set of |
60 | 60 | // space and computation time. |
61 | 61 | // See http://www.cs.rutgers.edu/~muthu/bquant.pdf for time, space, and error properties. |
62 | 62 | func NewTargeted(quantiles ...float64) *Stream { |
63 | f := func(s *stream, r float64) float64 { | |
63 | ƒ := func(s *stream, r float64) float64 { | |
64 | 64 | var m float64 = math.MaxFloat64 |
65 | 65 | var f float64 |
66 | 66 | for _, q := range quantiles { |
73 | 73 | } |
74 | 74 | return m |
75 | 75 | } |
76 | return newStream(f) | |
76 | return newStream(ƒ) | |
77 | 77 | } |
78 | 78 | |
79 | 79 | // Stream computes quantiles for a stream of float64s. It is not thread-safe. |