make defaultEpsilon a const in newStream
Blake Mizerany
10 years ago
51 | 51 | f := func(s *stream, r float64) float64 { |
52 | 52 | return 2 * s.epsilon * r |
53 | 53 | } |
54 | return newStream(0.01, f) | |
54 | return newStream(f) | |
55 | 55 | } |
56 | 56 | |
57 | 57 | // NewTargeted returns an initialized Stream concerned with a particular set of |
72 | 72 | } |
73 | 73 | return m |
74 | 74 | } |
75 | return newStream(0.01, f) | |
75 | return newStream(f) | |
76 | 76 | } |
77 | 77 | |
78 | 78 | // Stream calculates quantiles for a stream of float64s. |
81 | 81 | b Samples |
82 | 82 | } |
83 | 83 | |
84 | func newStream(epsilon float64, ƒ invariant) *Stream { | |
85 | x := &stream{epsilon: epsilon, ƒ: ƒ, l: list.New()} | |
84 | func newStream(ƒ invariant) *Stream { | |
85 | const defaultEpsilon = 0.01 | |
86 | x := &stream{epsilon: defaultEpsilon, ƒ: ƒ, l: list.New()} | |
86 | 87 | return &Stream{x, make(Samples, 0, 500)} |
87 | 88 | } |
88 | 89 |