Sha256: a8310e2da4f88595e41a4940ae9d269f9e0d809d815146519e94ce7e9a1de27c

Contents?: true

Size: 839 Bytes

Versions: 16

Compression:

Stored size: 839 Bytes

Contents

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(p1 *histogramPair, p2 *histogramPair) bool {
	if p1.cost_diff != p2.cost_diff {
		return p1.cost_diff > p2.cost_diff
	}

	return (p1.idx2 - p1.idx1) > (p2.idx2 - p2.idx1)
}

/* Returns entropy reduction of the context map when we combine two clusters. */
func clusterCostDiff(size_a uint, size_b uint) float64 {
	var size_c uint = size_a + size_b
	return float64(size_a)*fastLog2(size_a) + float64(size_b)*fastLog2(size_b) - float64(size_c)*fastLog2(size_c)
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ruby_snowflake_client-1.3.7 ext/vendor/github.com/andybalholm/brotli/cluster.go
ruby_snowflake_client-1.3.6 ext/vendor/github.com/andybalholm/brotli/cluster.go
ruby_snowflake_client-1.3.5 ext/vendor/github.com/andybalholm/brotli/cluster.go
ruby_snowflake_client-1.3.4 ext/vendor/github.com/andybalholm/brotli/cluster.go
ruby_snowflake_client-1.3.4.pre.debug ext/vendor/github.com/andybalholm/brotli/cluster.go
ruby_snowflake_client-1.3.3.pre.debug ext/vendor/github.com/andybalholm/brotli/cluster.go
ruby_snowflake_client-1.3.2 ext/vendor/github.com/andybalholm/brotli/cluster.go
ruby_snowflake_client-1.3.1 ext/vendor/github.com/andybalholm/brotli/cluster.go
ruby_snowflake_client-1.3.0 ext/vendor/github.com/andybalholm/brotli/cluster.go
ruby_snowflake_client-1.2.1 ext/vendor/github.com/andybalholm/brotli/cluster.go
ruby_snowflake_client-1.2.0 ext/vendor/github.com/andybalholm/brotli/cluster.go
ruby_snowflake_client-1.1.1 ext/vendor/github.com/andybalholm/brotli/cluster.go
ruby_snowflake_client-1.1.0 ext/vendor/github.com/andybalholm/brotli/cluster.go
ruby_snowflake_client-1.0.2 ext/vendor/github.com/andybalholm/brotli/cluster.go
ruby_snowflake_client-1.0.1 ext/vendor/github.com/andybalholm/brotli/cluster.go
ruby_snowflake_client-1.0.0 ext/vendor/github.com/andybalholm/brotli/cluster.go