Source File
cluster.go
Belonging Package
github.com/andybalholm/brotli
package brotli
/* Copyright 2013 Google Inc. All Rights Reserved.
Distributed under MIT license.
See file LICENSE for detail or copy at https://opensource.org/licenses/MIT
*/
/* Functions for clustering similar histograms together. */
type histogramPair struct {
idx1 uint32
idx2 uint32
cost_combo float64
cost_diff float64
}
func histogramPairIsLess( *histogramPair, *histogramPair) bool {
if .cost_diff != .cost_diff {
return .cost_diff > .cost_diff
}
return (.idx2 - .idx1) > (.idx2 - .idx1)
}
/* Returns entropy reduction of the context map when we combine two clusters. */
func clusterCostDiff( uint, uint) float64 {
var uint = +
return float64()*fastLog2() + float64()*fastLog2() - float64()*fastLog2()
}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |