DOT_PRODUCT

Dot product. NOTE: this similarity is intended as an optimized way to perform cosine similarity. In order to use it, all vectors must be normalized, including both document and query vectors. Using dot product with vectors that are not normalized can result in errors or poor search results. Floating point vectors must be normalized to be of unit length, while byte vectors should simply all have the same norm.

Properties

Link copied to clipboard
expect val name: String
Link copied to clipboard
expect val ordinal: Int

Functions

Link copied to clipboard
abstract fun compare(v1: ByteArray, v2: ByteArray): Float

Calculates a similarity score between the two vectors with a specified function. Higher similarity scores correspond to closer vectors. Each (signed) byte represents a vector dimension.

abstract fun compare(v1: FloatArray, v2: FloatArray): Float

Calculates a similarity score between the two vectors with a specified function. Higher similarity scores correspond to closer vectors.