Documentation ¶
Index ¶
- Constants
- func CalcFFBatch(dim int64, left []float32, lIndex int64, right []float32, metric string, ...)
- func CalcFloatDistance(dim int64, left, right []float32, metric string) ([]float32, error)
- func CalcHamming(dim int64, left []byte, lIndex int64, right []byte, rIndex int64) int32
- func CalcHammingBatch(dim int64, left []byte, lIndex int64, right []byte, result *[]int32)
- func CalcHammingDistance(dim int64, left, right []byte) ([]int32, error)
- func CalcIP(dim int64, left []float32, lIndex int64, right []float32, rIndex int64) float32
- func CalcL2(dim int64, left []float32, lIndex int64, right []float32, rIndex int64) float32
- func CalcTanimotoCoefficient(dim int64, hamming []int32) ([]float32, error)
- func CountOne(n uint8) int32
- func PositivelyRelated(metricType string) bool
- func SingleBitLen(dim int64) int64
- func ValidateBinaryArrayLength(dim int64, length int) error
- func ValidateFloatArrayLength(dim int64, length int) error
- func ValidateMetricType(metric string) (string, error)
- func VectorCount(dim int64, length int) int64
Constants ¶
View Source
const ( // L2 represents the Euclidean distance L2 = "L2" // IP represents the inner product distance IP = "IP" // COSINE represents the cosine distance COSINE = "COSINE" // HAMMING represents the hamming distance HAMMING = "HAMMING" // TANIMOTO represents the tanimoto distance TANIMOTO = "TANIMOTO" // JACCARD in string JACCARD = "JACCARD" // SUPERSTRUCTURE in string SUPERSTRUCTURE = "SUPERSTRUCTURE" // SUBSTRUCTURE in string SUBSTRUCTURE = "SUBSTRUCTURE" )
Variables ¶
This section is empty.
Functions ¶
func CalcFFBatch ¶
func CalcFFBatch(dim int64, left []float32, lIndex int64, right []float32, metric string, result *[]float32)
CalcFFBatch calculate the distance of @left & @right vectors in batch by given @metic, store result in @result
func CalcFloatDistance ¶
CalcFloatDistance calculate float distance by given metric it will checks input, and calculate the distance concurrently
func CalcHamming ¶
CalcHamming calculate HAMMING distance
func CalcHammingBatch ¶
CalcHammingBatch calculate HAMMING distance in batch, results are in @result
func CalcTanimotoCoefficient ¶
func PositivelyRelated ¶
PositivelyRelated return if metricType are "ip" or "IP"
func ValidateBinaryArrayLength ¶
ValidateBinaryArrayLength validates a binary array of @dim & @length
func ValidateFloatArrayLength ¶
ValidateFloatArrayLength is used validate float vector length
func ValidateMetricType ¶
ValidateMetricType returns metric text or error
func VectorCount ¶
VectorCount counts bits by @dim & @length
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.