Пример #1
0
        public float DotRow(ref float[] vec, int i)
        {
            var d = SIMD.DotProduct(ref Data[i], ref vec);

            Debug.Assert(!float.IsNaN(d));
            return(d);
        }
Пример #2
0
        public float DotRow(ref float[] vec, ref float[] data)
        {
            var d = SIMD.DotProduct(ref data, ref vec);

            Debug.Assert(!float.IsNaN(d));
            return(d);
        }
Пример #3
0
        public float DotRow(ReadOnlySpan <float> vec, ReadOnlySpan <float> other)
        {
            var d = SIMD.DotProduct(vec, other);

            Debug.Assert(!float.IsNaN(d));
            return(d);
        }
Пример #4
0
        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);
        }
Пример #5
0
        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())));