CosmosDbFunctionsExtensions.VectorDistance Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
VectorDistance(DbFunctions, ReadOnlyMemory<Byte>, ReadOnlyMemory<Byte>)
Returns the distance between two vectors, using the distance function and data type defined using IsVector(PropertyBuilder, DistanceFunction, Int32) .
[System.Diagnostics.CodeAnalysis.Experimental("EF9103")]
public static double VectorDistance (this Microsoft.EntityFrameworkCore.DbFunctions _, ReadOnlyMemory<byte> vector1, ReadOnlyMemory<byte> vector2);
[<System.Diagnostics.CodeAnalysis.Experimental("EF9103")>]
static member VectorDistance : Microsoft.EntityFrameworkCore.DbFunctions * ReadOnlyMemory<byte> * ReadOnlyMemory<byte> -> double
<Extension()>
Public Function VectorDistance (_ As DbFunctions, vector1 As ReadOnlyMemory(Of Byte), vector2 As ReadOnlyMemory(Of Byte)) As Double
Parameters
The DbFunctions instance.
- vector1
- ReadOnlyMemory<Byte>
The first vector.
- vector2
- ReadOnlyMemory<Byte>
The second vector.
Returns
- Attributes
Applies to
VectorDistance(DbFunctions, ReadOnlyMemory<SByte>, ReadOnlyMemory<SByte>)
Returns the distance between two vectors, using the distance function and data type defined using IsVector(PropertyBuilder, DistanceFunction, Int32) .
[System.Diagnostics.CodeAnalysis.Experimental("EF9103")]
public static double VectorDistance (this Microsoft.EntityFrameworkCore.DbFunctions _, ReadOnlyMemory<sbyte> vector1, ReadOnlyMemory<sbyte> vector2);
[<System.Diagnostics.CodeAnalysis.Experimental("EF9103")>]
static member VectorDistance : Microsoft.EntityFrameworkCore.DbFunctions * ReadOnlyMemory<sbyte> * ReadOnlyMemory<sbyte> -> double
<Extension()>
Public Function VectorDistance (_ As DbFunctions, vector1 As ReadOnlyMemory(Of SByte), vector2 As ReadOnlyMemory(Of SByte)) As Double
Parameters
The DbFunctions instance.
- vector1
- ReadOnlyMemory<SByte>
The first vector.
- vector2
- ReadOnlyMemory<SByte>
The second vector.
Returns
- Attributes
Applies to
VectorDistance(DbFunctions, ReadOnlyMemory<Single>, ReadOnlyMemory<Single>)
Returns the distance between two vectors, using the distance function and data type defined using IsVector(PropertyBuilder, DistanceFunction, Int32) .
[System.Diagnostics.CodeAnalysis.Experimental("EF9103")]
public static double VectorDistance (this Microsoft.EntityFrameworkCore.DbFunctions _, ReadOnlyMemory<float> vector1, ReadOnlyMemory<float> vector2);
[<System.Diagnostics.CodeAnalysis.Experimental("EF9103")>]
static member VectorDistance : Microsoft.EntityFrameworkCore.DbFunctions * ReadOnlyMemory<single> * ReadOnlyMemory<single> -> double
<Extension()>
Public Function VectorDistance (_ As DbFunctions, vector1 As ReadOnlyMemory(Of Single), vector2 As ReadOnlyMemory(Of Single)) As Double
Parameters
The DbFunctions instance.
- vector1
- ReadOnlyMemory<Single>
The first vector.
- vector2
- ReadOnlyMemory<Single>
The second vector.
Returns
- Attributes
Applies to
VectorDistance(DbFunctions, ReadOnlyMemory<Byte>, ReadOnlyMemory<Byte>, Boolean)
Returns the distance between two vectors, given a distance function (aka similarity measure).
[System.Diagnostics.CodeAnalysis.Experimental("EF9103")]
public static double VectorDistance (this Microsoft.EntityFrameworkCore.DbFunctions _, ReadOnlyMemory<byte> vector1, ReadOnlyMemory<byte> vector2, bool useBruteForce);
[<System.Diagnostics.CodeAnalysis.Experimental("EF9103")>]
static member VectorDistance : Microsoft.EntityFrameworkCore.DbFunctions * ReadOnlyMemory<byte> * ReadOnlyMemory<byte> * bool -> double
<Extension()>
Public Function VectorDistance (_ As DbFunctions, vector1 As ReadOnlyMemory(Of Byte), vector2 As ReadOnlyMemory(Of Byte), useBruteForce As Boolean) As Double
Parameters
The DbFunctions instance.
- vector1
- ReadOnlyMemory<Byte>
The first vector.
- vector2
- ReadOnlyMemory<Byte>
The second vector.
- useBruteForce
- Boolean
A bool
specifying how the computed value is used in an ORDER BY
expression. If true
, then brute force is used, otherwise any index defined on the vector
property is leveraged.
Returns
- Attributes
Applies to
VectorDistance(DbFunctions, ReadOnlyMemory<SByte>, ReadOnlyMemory<SByte>, Boolean)
Returns the distance between two vectors, given a distance function (aka similarity measure).
[System.Diagnostics.CodeAnalysis.Experimental("EF9103")]
public static double VectorDistance (this Microsoft.EntityFrameworkCore.DbFunctions _, ReadOnlyMemory<sbyte> vector1, ReadOnlyMemory<sbyte> vector2, bool useBruteForce);
[<System.Diagnostics.CodeAnalysis.Experimental("EF9103")>]
static member VectorDistance : Microsoft.EntityFrameworkCore.DbFunctions * ReadOnlyMemory<sbyte> * ReadOnlyMemory<sbyte> * bool -> double
<Extension()>
Public Function VectorDistance (_ As DbFunctions, vector1 As ReadOnlyMemory(Of SByte), vector2 As ReadOnlyMemory(Of SByte), useBruteForce As Boolean) As Double
Parameters
The DbFunctions instance.
- vector1
- ReadOnlyMemory<SByte>
The first vector.
- vector2
- ReadOnlyMemory<SByte>
The second vector.
- useBruteForce
- Boolean
A bool
specifying how the computed value is used in an ORDER BY
expression. If true
, then brute force is used, otherwise any index defined on the vector
property is leveraged.
Returns
- Attributes
Applies to
VectorDistance(DbFunctions, ReadOnlyMemory<Single>, ReadOnlyMemory<Single>, Boolean)
Returns the distance between two vectors, given a distance function (aka similarity measure).
[System.Diagnostics.CodeAnalysis.Experimental("EF9103")]
public static double VectorDistance (this Microsoft.EntityFrameworkCore.DbFunctions _, ReadOnlyMemory<float> vector1, ReadOnlyMemory<float> vector2, bool useBruteForce);
[<System.Diagnostics.CodeAnalysis.Experimental("EF9103")>]
static member VectorDistance : Microsoft.EntityFrameworkCore.DbFunctions * ReadOnlyMemory<single> * ReadOnlyMemory<single> * bool -> double
<Extension()>
Public Function VectorDistance (_ As DbFunctions, vector1 As ReadOnlyMemory(Of Single), vector2 As ReadOnlyMemory(Of Single), useBruteForce As Boolean) As Double
Parameters
The DbFunctions instance.
- vector1
- ReadOnlyMemory<Single>
The first vector.
- vector2
- ReadOnlyMemory<Single>
The second vector.
- useBruteForce
- Boolean
A bool
specifying how the computed value is used in an ORDER BY
expression. If true
, then brute force is used, otherwise any index defined on the vector
property is leveraged.
Returns
- Attributes
Applies to
VectorDistance(DbFunctions, ReadOnlyMemory<Byte>, ReadOnlyMemory<Byte>, Boolean, DistanceFunction)
Returns the distance between two vectors, given a distance function (aka similarity measure).
[System.Diagnostics.CodeAnalysis.Experimental("EF9103")]
public static double VectorDistance (this Microsoft.EntityFrameworkCore.DbFunctions _, ReadOnlyMemory<byte> vector1, ReadOnlyMemory<byte> vector2, bool useBruteForce, Microsoft.Azure.Cosmos.DistanceFunction distanceFunction);
[<System.Diagnostics.CodeAnalysis.Experimental("EF9103")>]
static member VectorDistance : Microsoft.EntityFrameworkCore.DbFunctions * ReadOnlyMemory<byte> * ReadOnlyMemory<byte> * bool * Microsoft.Azure.Cosmos.DistanceFunction -> double
<Extension()>
Public Function VectorDistance (_ As DbFunctions, vector1 As ReadOnlyMemory(Of Byte), vector2 As ReadOnlyMemory(Of Byte), useBruteForce As Boolean, distanceFunction As DistanceFunction) As Double
Parameters
The DbFunctions instance.
- vector1
- ReadOnlyMemory<Byte>
The first vector.
- vector2
- ReadOnlyMemory<Byte>
The second vector.
- useBruteForce
- Boolean
A bool
specifying how the computed value is used in an ORDER BY
expression. If true
, then brute force is used, otherwise any index defined on the vector
property is leveraged.
- distanceFunction
- DistanceFunction
The distance function to use.
Returns
- Attributes
Applies to
VectorDistance(DbFunctions, ReadOnlyMemory<SByte>, ReadOnlyMemory<SByte>, Boolean, DistanceFunction)
Returns the distance between two vectors, given a distance function (aka similarity measure).
[System.Diagnostics.CodeAnalysis.Experimental("EF9103")]
public static double VectorDistance (this Microsoft.EntityFrameworkCore.DbFunctions _, ReadOnlyMemory<sbyte> vector1, ReadOnlyMemory<sbyte> vector2, bool useBruteForce, Microsoft.Azure.Cosmos.DistanceFunction distanceFunction);
[<System.Diagnostics.CodeAnalysis.Experimental("EF9103")>]
static member VectorDistance : Microsoft.EntityFrameworkCore.DbFunctions * ReadOnlyMemory<sbyte> * ReadOnlyMemory<sbyte> * bool * Microsoft.Azure.Cosmos.DistanceFunction -> double
<Extension()>
Public Function VectorDistance (_ As DbFunctions, vector1 As ReadOnlyMemory(Of SByte), vector2 As ReadOnlyMemory(Of SByte), useBruteForce As Boolean, distanceFunction As DistanceFunction) As Double
Parameters
The DbFunctions instance.
- vector1
- ReadOnlyMemory<SByte>
The first vector.
- vector2
- ReadOnlyMemory<SByte>
The second vector.
- useBruteForce
- Boolean
A bool
specifying how the computed value is used in an ORDER BY
expression. If true
, then brute force is used, otherwise any index defined on the vector
property is leveraged.
- distanceFunction
- DistanceFunction
The distance function to use.
Returns
- Attributes
Applies to
VectorDistance(DbFunctions, ReadOnlyMemory<Single>, ReadOnlyMemory<Single>, Boolean, DistanceFunction)
Returns the distance between two vectors, given a distance function (aka similarity measure).
[System.Diagnostics.CodeAnalysis.Experimental("EF9103")]
public static double VectorDistance (this Microsoft.EntityFrameworkCore.DbFunctions _, ReadOnlyMemory<float> vector1, ReadOnlyMemory<float> vector2, bool useBruteForce, Microsoft.Azure.Cosmos.DistanceFunction distanceFunction);
[<System.Diagnostics.CodeAnalysis.Experimental("EF9103")>]
static member VectorDistance : Microsoft.EntityFrameworkCore.DbFunctions * ReadOnlyMemory<single> * ReadOnlyMemory<single> * bool * Microsoft.Azure.Cosmos.DistanceFunction -> double
<Extension()>
Public Function VectorDistance (_ As DbFunctions, vector1 As ReadOnlyMemory(Of Single), vector2 As ReadOnlyMemory(Of Single), useBruteForce As Boolean, distanceFunction As DistanceFunction) As Double
Parameters
The DbFunctions instance.
- vector1
- ReadOnlyMemory<Single>
The first vector.
- vector2
- ReadOnlyMemory<Single>
The second vector.
- useBruteForce
- Boolean
A bool
specifying how the computed value is used in an ORDER BY
expression. If true
, then brute force is used, otherwise any index defined on the vector
property is leveraged.
- distanceFunction
- DistanceFunction
The distance function to use.
Returns
- Attributes
Applies to
Entity Framework