// binOpAbsdif returns the absolute value of the difference of two inputs.
334716
func binOpAbsdif(rate int8, x, y Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(BinOpUgenName, rate, BinOpAbsdif, numOutputs, x, y)
}
467873
func binOpSumsqr(rate int8, x, y Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(BinOpUgenName, rate, BinOpSumsqr, numOutputs, x, y)
}
132848
func (c C) Absdif(val Input) Input {
	return c.Add(val.Neg()).Abs()
}
1161136
func Fdiff(w io.Writer, a, b interface{}) {
	Pdiff(&wprintfer{w}, a, b)
}
866244
func (api *ProductDiskAPI) FilterMultiBy(key string, value interface{}) *ProductDiskAPI {
	api.filterBy(key, value, true)
	return api
}
686674
func doubleNativeFromBinary(buf []byte) (interface{}, []byte, error) {
	if len(buf) < doubleEncodedLength {
		return nil, nil, fmt.Errorf("cannot decode binary double: %s", io.ErrShortBuffer)
	}
	return math.Float64frombits(binary.LittleEndian.Uint64(buf[:doubleEncodedLength])), buf[doubleEncodedLength:], nil
}
1070224
func binOpSqrsum(rate int8, x, y Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(BinOpUgenName, rate, BinOpSqrsum, numOutputs, x, y)
}
1126923
func (u *Ugen) Div(val Input) Input {
	return binOpDiv(u.Rate, u, val, u.NumOutputs)
}
972615
func binOpClip2(rate int8, x, y Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(BinOpUgenName, rate, BinOpClip2, numOutputs, x, y)
}
1372498
func binOpGT(rate int8, x, y Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(BinOpUgenName, rate, BinOpGT, numOutputs, x, y)
}
41675
func TwoWayDiff(config, live *unstructured.Unstructured) *DiffResult {
	var configObj, liveObj map[string]interface{}
	if config != nil {
		config = removeNamespaceAnnotation(config)
		configObj = config.Object
	}
	if live != nil {
		liveObj = jsonutil.RemoveMapFields(configObj, live.Object)
	}
	gjDiff := gojsondiff.New().CompareObjects(liveObj, configObj)
	dr := DiffResult{
		Diff:     gjDiff,
		Modified: gjDiff.Modified(),
	}
	return &dr
}
972278
func binOpFold2(rate int8, x, y Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(BinOpUgenName, rate, BinOpFold2, numOutputs, x, y)
}
263398
func (b *BitSet) SymmetricDifferenceCardinality(compare *BitSet) uint {
	panicIfNull(b)
	panicIfNull(compare)
	b, compare = sortByLength(b, compare)
	cnt := popcntXorSlice(b.set, compare.set)
	if len(compare.set) > len(b.set) {
		cnt += popcntSlice(compare.set[len(b.set):])
	}
	return uint(cnt)
}
268026
func (u *Ugen) Difsqr(val Input) Input {
	return binOpDifsqr(u.Rate, u, val, u.NumOutputs)
}
1183622
func (api *DiskAPI) FilterMultiBy(key string, value interface{}) *DiskAPI {
	api.filterBy(key, value, true)
	return api
}
486533
func (b *PCMBuffer) calculateIntBitDepth() uint8 {
	if b == nil {
		return 0
	}
	bitDepth := b.SourceBitDepth
	if bitDepth != 0 {
		return bitDepth
	}
	var max int64
	switch b.DataType {
	case DataTypeI8:
		var i8max int8
		for _, s := range b.I8 {
			if s > i8max {
				i8max = s
			}
		}
		max = int64(i8max)
	case DataTypeI16:
		var i16max int16
		for _, s := range b.I16 {
			if s > i16max {
				i16max = s
			}
		}
		max = int64(i16max)
	case DataTypeI32:
		var i32max int32
		for _, s := range b.I32 {
			if s > i32max {
				i32max = s
			}
		}
		max = int64(i32max)
	default:
		// This method is only meant to be used on int buffers.
		return bitDepth
	}
	bitDepth = 8
	if max > 127 {
		bitDepth = 16
	}
	// greater than int16, expecting int24
	if max > 32767 {
		bitDepth = 24
	}
	// int 32
	if max > 8388607 {
		bitDepth = 32
	}
	// int 64
	if max > 4294967295 {
		bitDepth = 64
	}

	return bitDepth
}
518931
func (d HypergeometicDist) CDF(k float64) float64 {
	// Based on Klotz, A Computational Approach to Statistics.
	ki := int(math.Floor(k))
	l, h := d.bounds()
	if ki < l {
		return 0
	} else if ki >= h {
		return 1
	}
	// Use symmetry to compute the smaller sum.
	flip := false
	if ki > (d.Draws+1)/(d.N+1)*(d.K+1) {
		flip = true
		ki = d.K - ki - 1
		d.Draws = d.N - d.Draws
	}
	p := d.pmf(ki) * d.sum(ki)
	if flip {
		p = 1 - p
	}
	return p
}