Not long ago ago, at the .net, added support. https://ru.wikipedia.org/wiki/SIMD ♪ This space of names allows for a hardware acceleration. To be used http://blogs.msdn.com/b/dotnet/archive/2013/10/01/10453200.aspx Compiler, .NET 4.6 and System.Numerics.Vectors, which is set through Nuget.Example of a simple programme using that space by name:using System;
using System.Numerics;
class Program
{
static void Main(string[] args)
{
const Int32 N = 8;
Single[] a = { 41982.0F, 81.5091F, 3.14F, 42.666F, 54776.45F, 342.4556F, 6756.2344F, 4563.789F };
Single[] b = { 85989.111F, 156.5091F, 3.14F, 42.666F, 1006.45F, 9999.4546F, 0.2344F, 7893.789F };
Single[] c = new Single[N];
for (int i = 0; i < N; i += Vector<Single>.Count) // Count возвращает 16 для char, 4 для float, 2 для double и т.п.
{
var aSimd = new Vector<Single>(a, i); // создать экземпляр со смещением i
var bSimd = new Vector<Single>(b, i);
Vector<Single> cSimd = aSimd + bSimd; // или так Vector<Single> c_simd = Vector.Add(b_simd, a_simd);
cSimd.CopyTo(c, i); //копировать в массив со смещением
}
for (int i = 0; i < a.Length; i++)
{
Console.WriteLine(c[i]);
}
Console.ReadKey();
}
}
In other words, using this space of names, you can make things easier and more beautiful.