Esempio n. 1
0
func NewMultiDecoder(dimension int, innerDec types.Decoder) *MultiDecoder {
	rounds := int(math.Ceil(float64(dimension) / float64(innerDec.GetDimensionality())))
	return &MultiDecoder{
		dimension: dimension,
		rounds:    rounds,
		innerDec:  innerDec,
		distance:  -1.0,
	}
}
Esempio n. 2
0
func NewLSH(hash types.Hash,
	decoder types.Decoder,
	projector types.Projector) *LSH {
	radius := decoder.GetErrorRadius() / float64(decoder.GetDimensionality())
	return &LSH{
		hash:      hash,
		decoder:   decoder,
		projector: projector,
		distance:  0.0,
		noise:     nil,
		radius:    radius,
	}
}