milvus/internal/indexnode/index_test.go
Jiquan Long f8d9bc919d
Unify interface of vector index & scalar index. (#15959)
Signed-off-by: dragondriver <jiquan.long@zilliz.com>
2022-03-21 14:23:24 +08:00

30 lines
486 B
Go

package indexnode
import "math/rand"
const (
dim = 8
nb = 10000
nprobe = 8
)
func generateFloatVectors() []float32 {
vectors := make([]float32, 0)
for i := 0; i < nb; i++ {
for j := 0; j < dim; j++ {
vectors = append(vectors, rand.Float32())
}
}
return vectors
}
func generateBinaryVectors() []byte {
vectors := make([]byte, 0)
for i := 0; i < nb; i++ {
for j := 0; j < dim/8; j++ {
vectors = append(vectors, byte(rand.Intn(8)))
}
}
return vectors
}