public float DotRow(ref float[] vec, int i) { var d = SIMD.DotProduct(ref Data[i], ref vec); Debug.Assert(!float.IsNaN(d)); return(d); }
public float DotRow(ref float[] vec, ref float[] data) { var d = SIMD.DotProduct(ref data, ref vec); Debug.Assert(!float.IsNaN(d)); return(d); }
public float DotRow(ReadOnlySpan <float> vec, ReadOnlySpan <float> other) { var d = SIMD.DotProduct(vec, other); Debug.Assert(!float.IsNaN(d)); return(d); }
public float DotRow(ReadOnlySpan <float> vec, int i) { var d = SIMD.DotProduct(Data.AsSpan().Slice(i * Columns, Columns), vec); Debug.Assert(!float.IsNaN(d)); return(d); }
public float DotRow(ref float[] vec, int i) { var row = GetRowCopy(i); var d = SIMD.DotProduct(ref row, ref vec); Debug.Assert(!float.IsNaN(d)); return(d); }
public static float CosineForNormalizedVectors(ImmutableArray <float> lhs, ImmutableArray <float> rhs) => 1 - SIMD.DotProduct(lhs.AsSpan(), rhs.AsSpan());
public static float Cosine(ImmutableArray <float> lhs, ImmutableArray <float> rhs) => 1 - (SIMD.DotProduct(lhs.AsSpan(), rhs.AsSpan()) / (SIMD.Magnitude(lhs.AsSpan()) * SIMD.Magnitude(rhs.AsSpan())));