MCPcopy Create free account
hub / github.com/evilsocket/sum / BenchmarkWrappedRecordCosine

Function BenchmarkWrappedRecordCosine

wrapper/record_benchmark_test.go:110–120  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

108}
109
110func BenchmarkWrappedRecordCosine(b *testing.B) {
111 testRecord.Data = []float32{3, 6, 9}
112 a := WrapRecord(&testRecord)
113 c := WrapRecord(&testRecord)
114
115 for i := 0; i < b.N; i++ {
116 if cos := a.Cosine(c); cos != 1.0 {
117 b.Fatalf("cosine similarity should be %f, got %f", 1.0, cos)
118 }
119 }
120}

Callers

nothing calls this directly

Calls 2

WrapRecordFunction · 0.85
CosineMethod · 0.80

Tested by

no test coverage detected