MCPcopy
hub / github.com/redis/go-redis / encodeFloat16Vector

Function encodeFloat16Vector

search_test.go:46–55  ·  view source on GitHub ↗
(vec []float32)

Source from the content-addressed store, hash-verified

44}
45
46func encodeFloat16Vector(vec []float32) []byte {
47 buf := new(bytes.Buffer)
48 for _, v := range vec {
49 // Convert float32 to float16 (16-bit representation)
50 // This is a simplified conversion - in practice you'd use a proper float16 library
51 f16 := uint16(v * 1000) // Simple scaling for test purposes
52 binary.Write(buf, binary.LittleEndian, f16)
53 }
54 return buf.Bytes()
55}
56
57var _ = Describe("RediSearch commands Resp 2", Label("search"), func() {
58 ctx := context.TODO()

Callers 1

search_test.goFile · 0.85

Calls 2

WriteMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected