Пример #1
0
        /// <summary>
        /// Add to the destination by scale and source with indices.
        /// </summary>
        /// <param name="scale">The scale to add by.</param>
        /// <param name="source">The source values.</param>
        /// <param name="indices">The indices of value collection.</param>
        /// <param name="destination">The destination values.</param>
        /// <param name="count">The count of items.</param>
        public static void AddScale(float scale, ReadOnlySpan <float> source, ReadOnlySpan <int> indices, Span <float> destination, int count)
        {
            Contracts.AssertNonEmpty(source);
            Contracts.AssertNonEmpty(indices);
            Contracts.AssertNonEmpty(destination);
            Contracts.Assert(count > 0);
            Contracts.Assert(count <= source.Length);
            Contracts.Assert(count <= indices.Length);
            Contracts.Assert(count < destination.Length);

            if (Avx.IsSupported)
            {
                AvxIntrinsics.AddScaleSU(scale, source, indices, destination, count);
            }
            else if (Sse.IsSupported)
            {
                SseIntrinsics.AddScaleSU(scale, source, indices, destination, count);
            }
            else
            {
                for (int i = 0; i < count; i++)
                {
                    int index = indices[i];
                    destination[index] += scale * source[i];
                }
            }
        }
Пример #2
0
 public void ManagedAddScaleSUPerf()
 {
     SseIntrinsics.AddScaleSU(DEFAULT_SCALE, new Span <float>(src), new Span <int>(idx, 0, IDXLEN), new Span <float>(dst));
 }
 public void AddScaleSU()
 => SseIntrinsics.AddScaleSU(DEFAULT_SCALE, new Span <float>(src), new Span <int>(idx, 0, IDXLEN), new Span <float>(dst));
Пример #4
0
 public void AddScaleSU()
 => SseIntrinsics.AddScaleSU(DefaultScale, src, idx, dst, IndexLength);
Пример #5
0
 public void AddScaleSU()
 => SseIntrinsics.AddScaleSU(DefaultScale, new Span <float>(src), new Span <int>(idx, 0, IndexLength), new Span <float>(dst));