Skip to content

aka-nse/SmartVectorDotNet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SmartVectorDotNet

SmartVectorDotNet is a library to calculate the sequence by a unified signature with SIMD.


Concepts

This library has 3 layers:

  1. ScalarOp/ScalarMath
    provides generalized and backward-compatibility-enhanced operators and Math/MathF functions.

  2. VectorOp/VectorMath
    provides SIMD parallelized APIs which are corresponding with each method in ScalarOp/ScalarMath.

  3. Vectorization
    provides span based sequential operation. Their APIs are declared as strategy pattern, you can select simple loop or SIMD vectorized operation.

Usage

Generalized System.Numerics.Vector<T> calculations

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);

Simply vectirozation

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));

Release notes

v0.1.0.0

  • first releases

About

Generalized vector operation library

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages