@@ -166,8 +166,9 @@ func (c *opticsClusterer) Online(observations chan []float64, done chan struct{}
166166
167167func (c * opticsClusterer ) run () {
168168 var (
169- l = 0
170- ns , nss = make ([]int , 0 ), make ([]int , 0 )
169+ l int
170+ d float64
171+ ns , nss []int = make ([]int , 0 ), make ([]int , 0 )
171172 q priorityQueue
172173 p * pItem
173174 )
@@ -183,10 +184,10 @@ func (c *opticsClusterer) run() {
183184
184185 c .so = append (c .so , i )
185186
186- if c .coreDistance (i , & l , & ns ) != 0 {
187+ if d = c .coreDistance (i , & l , & ns ); d != 0 {
187188 q = newPriorityQueue (l )
188189
189- c .update (i , & l , & ns , & q )
190+ c .update (i , d , & l , & ns , & q )
190191
191192 for q .NotEmpty () {
192193 p = q .Pop ().(* pItem )
@@ -197,8 +198,8 @@ func (c *opticsClusterer) run() {
197198
198199 c .so = append (c .so , p .v )
199200
200- if c .coreDistance (p .v , & l , & nss ) != 0 {
201- c .update (p .v , & l , & nss , & q )
201+ if d = c .coreDistance (p .v , & l , & nss ); d != 0 {
202+ c .update (p .v , d , & l , & nss , & q )
202203 }
203204 }
204205 }
@@ -221,9 +222,7 @@ func (c *opticsClusterer) coreDistance(p int, l *int, r *[]int) float64 {
221222 return m
222223}
223224
224- func (c * opticsClusterer ) update (p int , l * int , r * []int , q * priorityQueue ) {
225- d := c .coreDistance (p , l , r )
226-
225+ func (c * opticsClusterer ) update (p int , d float64 , l * int , r * []int , q * priorityQueue ) {
227226 for i := 0 ; i < * l ; i ++ {
228227 if ! c .v [(* r )[i ]] {
229228 m := math .Max (d , c .distance (c .d [p ], c .d [(* r )[i ]]))
0 commit comments