[skip ci] Add comment for calc_distance.go (#13079)

Signed-off-by: shaoyue.chen <shaoyue.chen@zilliz.com>
pull/13032/head
shaoyue 2021-12-09 16:13:17 +08:00 committed by GitHub
parent 0ba6f3fcb7
commit fbce4b9f0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -85,6 +85,7 @@ func CalcIP(dim int64, left []float32, lIndex int64, right []float32, rIndex int
return sum
}
// CalcFFBatch calculate the distance of @left & @right vectors in batch by given @metic, store result in @result
func CalcFFBatch(dim int64, left []float32, lIndex int64, right []float32, metric string, result *[]float32) {
rightNum := int64(len(right)) / dim
for i := int64(0); i < rightNum; i++ {
@ -98,6 +99,8 @@ func CalcFFBatch(dim int64, left []float32, lIndex int64, right []float32, metri
}
}
// CalcFloatDistance calculate float distance by given metric
// it will checks input, and calculate the distance concurrently
func CalcFloatDistance(dim int64, left, right []float32, metric string) ([]float32, error) {
if dim <= 0 {
err := errors.New("invalid dimension")