示例#1
0
func (this *Spherical) Hash(p []float64) []int32 {
	ri := 0
	var h int32
	g := make([]int32, this.l)
	for i := 0; i < this.l; i++ {
		g[i] = 0
		for j := 0; j < this.k; j++ {
			vs := this.vAll[ri]
			h = utils.Argmaxi(p, vs, this.d)
			g[i] |= (h << (uint(this.hbits * j)))
			ri++
		}
	}
	return g
}
示例#2
0
func (this *Spherical) Hash(p []float64) []int64 {
	ri := 0
	var h int64
	g := make([]int64, this.numSearchCopies)
	for i := 0; i < this.numSearchCopies; i++ {
		g[i] = 0
		for j := 0; j < this.numHashFuncs; j++ {
			vs := this.vAll[ri]
			h = utils.Argmaxi(p, vs, this.numDimensions)
			g[i] |= (h << (uint(this.hbits * j)))
			ri++
		}
	}
	return g
}