/// <summary> /// Add to the destination by scale and source into a new result. /// </summary> /// <param name="scale">The scale to add by.</param> /// <param name="source">The source values.</param> /// <param name="destination">The destination values.</param> /// <param name="result">A new collection of values to be returned.</param> /// <param name="count">The count of items.</param> public static void AddScaleCopy(float scale, ReadOnlySpan <float> source, ReadOnlySpan <float> destination, Span <float> result, int count) { Contracts.AssertNonEmpty(source); Contracts.AssertNonEmpty(destination); Contracts.AssertNonEmpty(result); Contracts.Assert(count > 0); Contracts.Assert(count <= source.Length); Contracts.Assert(count <= destination.Length); Contracts.Assert(count <= result.Length); if (Avx.IsSupported) { AvxIntrinsics.AddScaleCopyU(scale, source, destination, result, count); } else if (Sse.IsSupported) { SseIntrinsics.AddScaleCopyU(scale, source, destination, result, count); } else { for (int i = 0; i < count; i++) { result[i] = scale * source[i] + destination[i]; } } }
public void ManagedAddScaleCopyUPerf() { SseIntrinsics.AddScaleCopyU(DEFAULT_SCALE, new Span <float>(src, 0, LEN), new Span <float>(dst, 0, LEN), new Span <float>(result, 0, LEN)); }
public void AddScaleCopyU() => SseIntrinsics.AddScaleCopyU(DEFAULT_SCALE, new Span <float>(src, 0, LEN), new Span <float>(dst, 0, LEN), new Span <float>(result, 0, LEN));
public void AddScaleCopyU() => SseIntrinsics.AddScaleCopyU(DefaultScale, src, dst, result, Length);
public void AddScaleCopyU() => SseIntrinsics.AddScaleCopyU(DefaultScale, new Span <float>(src, 0, Length), new Span <float>(dst, 0, Length), new Span <float>(result, 0, Length));