SmartVectorDotNet is a library to calculate the sequence by a unified signature with SIMD.
This library has 3 layers:
-
ScalarOp
/ScalarMath
provides generalized and backward-compatibility-enhanced operators andMath
/MathF
functions. -
VectorOp
/VectorMath
provides SIMD parallelized APIs which are corresponding with each method inScalarOp
/ScalarMath
. -
Vectorization
provides span based sequential operation. Their APIs are declared as strategy pattern, you can select simple loop or SIMD vectorized operation.
using System;
using System.Numerics;
using SmartVectorDotNet;
var x = new Vector<double>(0, 1, 2, 3);
var sin_x_pi = VectorMath.Sin(VectorMath.Multiply(x, VectorMath.Const<double>.PI));
Console.WriteLine(sin_x_pi);
using System;
using SmartVectorDotNet;
var x = Enumerable.Range(0, 256).Select(i => (double)i).ToArray();
var tmp = new double[x.Length];
var ans = new double[x.Length];
Vectorization.SIMD.Multiply<double>(x, Math.PI, tmp);
Vectorization.SIMD.Sin<double>(tmp, ans);
Console.WriteLine(string.Join(", ", ans));
- first releases