github.com/weaviate/weaviate@v1.24.6/adapters/repos/db/vector/common/vector_util.go (about)

     1  //                           _       _
     2  // __      _____  __ ___   ___  __ _| |_ ___
     3  // \ \ /\ / / _ \/ _` \ \ / / |/ _` | __/ _ \
     4  //  \ V  V /  __/ (_| |\ V /| | (_| | ||  __/
     5  //   \_/\_/ \___|\__,_| \_/ |_|\__,_|\__\___|
     6  //
     7  //  Copyright © 2016 - 2024 Weaviate B.V. All rights reserved.
     8  //
     9  //  CONTACT: hello@weaviate.io
    10  //
    11  
    12  package common
    13  
    14  func VectorsEqual(vecA, vecB []float32) bool {
    15  	if len(vecA) != len(vecB) {
    16  		return false
    17  	}
    18  	if vecA == nil && vecB != nil {
    19  		return false
    20  	}
    21  	if vecA != nil && vecB == nil {
    22  		return false
    23  	}
    24  	for i := range vecA {
    25  		if vecA[i] != vecB[i] {
    26  			return false
    27  		}
    28  	}
    29  	return true
    30  }