Note
Access to this page requires authorization. You can try signing in or .
Access to this page requires authorization. You can try .
SqlServerDbFunctionsExtensions.VectorDistance<T> Method
Definition
- Namespace:
- Microsoft.EntityFrameworkCore
- Assembly:
- Microsoft.EntityFrameworkCore.SqlServer.dll
- Package:
- Microsoft.EntityFrameworkCore.SqlServer v10.0.0
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.
Calculates the distance between two vectors using a specified distance metric.
public static double VectorDistance<T>(this Microsoft.EntityFrameworkCore.DbFunctions _, string distanceMetric, Microsoft.Data.SqlTypes.SqlVector<T> vector1, Microsoft.Data.SqlTypes.SqlVector<T> vector2) where T : struct;
static member VectorDistance : Microsoft.EntityFrameworkCore.DbFunctions * string * Microsoft.Data.SqlTypes.SqlVector<'T (requires 'T : struct)> * Microsoft.Data.SqlTypes.SqlVector<'T (requires 'T : struct)> -> double (requires 'T : struct)
<Extension()>
Public Function VectorDistance(Of T As Structure) (_ As DbFunctions, distanceMetric As String, vector1 As SqlVector(Of T), vector2 As SqlVector(Of T)) As Double
Type Parameters
- T
Parameters
The DbFunctions instance.
- distanceMetric
- String
A string with the name of the distance metric to use to calculate the distance between the two given vectors. The following distance
metrics are supported: cosine, euclidean or dot.
- vector1
- SqlVector<T>
The first vector.
- vector2
- SqlVector<T>
The second vector.
Returns
Remarks
Vector distance is always exact and doesn't use any vector index, even if available.
Applies to
Entity Framework
Feedback
Was this page helpful?
