Beispiel #1
0
        public static void MulElementWise(ReadOnlySpan <float> left, ReadOnlySpan <float> right, Span <float> destination, int count)
        {
            Contracts.AssertNonEmpty(left);
            Contracts.AssertNonEmpty(right);
            Contracts.AssertNonEmpty(destination);
            Contracts.Assert(count > 0);
            Contracts.Assert(count <= left.Length);
            Contracts.Assert(count <= right.Length);
            Contracts.Assert(count <= destination.Length);

            if (Avx.IsSupported)
            {
                AvxIntrinsics.MulElementWiseU(left, right, destination, count);
            }
            else if (Sse.IsSupported)
            {
                SseIntrinsics.MulElementWiseU(left, right, destination, count);
            }
            else
            {
                for (int i = 0; i < count; i++)
                {
                    destination[i] = left[i] * right[i];
                }
            }
        }
        public static void MulElementWise(ReadOnlySpan <float> src1, ReadOnlySpan <float> src2, Span <float> dst, int count)
        {
            Contracts.AssertNonEmpty(src1);
            Contracts.AssertNonEmpty(src2);
            Contracts.AssertNonEmpty(dst);
            Contracts.Assert(count > 0);
            Contracts.Assert(count <= src1.Length);
            Contracts.Assert(count <= src2.Length);
            Contracts.Assert(count <= dst.Length);

            if (Avx.IsSupported)
            {
                AvxIntrinsics.MulElementWiseU(src1, src2, dst, count);
            }
            else if (Sse.IsSupported)
            {
                SseIntrinsics.MulElementWiseU(src1, src2, dst, count);
            }
            else
            {
                for (int i = 0; i < count; i++)
                {
                    dst[i] = src1[i] * src2[i];
                }
            }
        }
Beispiel #3
0
 private static void MulElementWise(Span <float> src1, Span <float> src2, Span <float> dst)
 {
     if (Sse.IsSupported)
     {
         SseIntrinsics.MulElementWiseU(src1, src2, dst);
     }
     else
     {
         for (int i = 0; i < dst.Length; i++)
         {
             dst[i] = src1[i] * src2[i];
         }
     }
 }