Esempio n. 1
0
func NewSimpleArray(X [][]float64, k int) *SimpleArray {
	var randomSeed int64 = 0
	innerDecoder := decoder.InnerDecoder()
	hashModulus := int32(2147483647)
	decoderMultiplier := 1
	decoder := decoder.NewMultiDecoder(decoderMultiplier*innerDecoder.GetDimensionality(), innerDecoder)
	numberOfProjections := 2
	numberOfBlurs := 2
	data := X
	dimension := 0
	if data != nil {
		dimension = len(data[0])
	} else {
		dimension = 0
	}
	centroids := [][]float64{}
	topIDs := []int32{}
	return &SimpleArray{
		data:                data,
		dimension:           dimension,
		numberOfProjections: numberOfProjections,
		decoderMultiplier:   decoderMultiplier,
		randomSeed:          randomSeed,
		hashModulus:         hashModulus,
		k:                   k,
		numberOfBlurs:       numberOfBlurs,
		decoder:             decoder,
		centroids:           centroids,
		topIDs:              topIDs,
	}
}
Esempio n. 2
0
func NewStreamObject(dimension, k int) *StreamObject {
	innerDecoder := decoder.InnerDecoder()
	decoderMultiplier := 1
	decoder := decoder.NewMultiDecoder(decoderMultiplier*innerDecoder.GetDimensionality(), innerDecoder)
	var centroids [][]float64
	var topIDs []int64
	return &StreamObject{
		decoder:             decoder,
		dimension:           dimension,
		randomSeed:          int64(0),
		hashModulus:         2147483647,
		decoderMultiplier:   decoderMultiplier,
		numberOfProjections: 2,
		numberOfBlurs:       2,
		k:                   k,
		data:                nil,
		topIDs:              topIDs,
		centroids:           centroids,
	}
}