Hi!
I'm looking for a C# library for matrix operations and preferably some linear algebra or optimization routines. Basically a NumPy/SciPy or PyTorch.
Ideally there'd be support for various backends (e.g. CPU, CUDA, OpenCL) for operations where possible.
As far as I can tell, there's Math.NET Numerics, Numpy.NET (which binds to Python's numpy), and NumSharp (which hasn't had commits since 2021), which seem to fit the bill mostly, though none are accelerated.
Otherwise, there are some libraries I've forgotten that seem to specifically target CUDA, which is too selective for my purpose. Maybe it was Hybridizer, which seems like its own compiler, which I'm not sure would work for me either.
There's also ComputeSharp which lets you write shaders directly in C#, though targets DirectX if I understand well.
The closest thing I've found is ILGPU, which seems brilliant since it JIT compiles kernels to CPU, CUDA, and OpenCL. The problem is I believe I'd need to write my own operations and kernels and essentially implement my own matrix compute library, though there seems to be some work on it, so maybe what I'm looking for is supported out of the box, minus optimization algorithms and so on.
Basically, does anyone have any pointers?
https://learn.microsoft.com/en-us/dotnet/standard/simd
Is this what you're looking for?
Unfortunately not, though I forgot about SIMD! It doesn't seem to support arbitrary-sized matrices or arrays out of the box, though I guess I could index the vector type myself. Still, it doesn't offer the operations I'd like, as far as I can tell.
Thanks though!