Esempio n. 1
0
 private static void ScaleAdd(float a, float b, Span <float> dst)
 {
     if (Avx.IsSupported)
     {
         AvxIntrinsics.ScaleAddU(a, b, dst);
     }
     else if (Sse.IsSupported)
     {
         SseIntrinsics.ScaleAddU(a, b, dst);
     }
     else
     {
         for (int i = 0; i < dst.Length; i++)
         {
             dst[i] = a * (dst[i] + b);
         }
     }
 }
Esempio n. 2
0
        // destination[i] = scale * (destination[i] + addend)
        public static void ScaleAdd(float scale, float addend, Span <float> destination)
        {
            Contracts.AssertNonEmpty(destination);

            if (Avx.IsSupported)
            {
                AvxIntrinsics.ScaleAddU(scale, addend, destination);
            }
            else if (Sse.IsSupported)
            {
                SseIntrinsics.ScaleAddU(scale, addend, destination);
            }
            else
            {
                for (int i = 0; i < destination.Length; i++)
                {
                    destination[i] = scale * (destination[i] + addend);
                }
            }
        }
        // dst[i] = a * (dst[i] + b)
        public static void ScaleAdd(float a, float b, Span <float> dst)
        {
            Contracts.AssertNonEmpty(dst);

            if (Avx.IsSupported)
            {
                AvxIntrinsics.ScaleAddU(a, b, dst);
            }
            else if (Sse.IsSupported)
            {
                SseIntrinsics.ScaleAddU(a, b, dst);
            }
            else
            {
                for (int i = 0; i < dst.Length; i++)
                {
                    dst[i] = a * (dst[i] + b);
                }
            }
        }
 public void ScaleAddU()
 => AvxIntrinsics.ScaleAddU(DefaultScale, DefaultScale, new Span <float>(dst, 0, Length));
Esempio n. 5
0
 public void ManagedScaleAddUPerf()
 {
     AvxIntrinsics.ScaleAddU(DEFAULT_SCALE, DEFAULT_SCALE, new Span <float>(dst, 0, LEN));
 }
 public void ScaleAddU()
 => AvxIntrinsics.ScaleAddU(DEFAULT_SCALE, DEFAULT_SCALE, new Span <float>(dst, 0, LEN));