MatLibMini 1.0.1

dotnet add package MatLibMini --version 1.0.1
                    
NuGet\Install-Package MatLibMini -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MatLibMini" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MatLibMini" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="MatLibMini" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MatLibMini --version 1.0.1
                    
#r "nuget: MatLibMini, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MatLibMini@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MatLibMini&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=MatLibMini&version=1.0.1
                    
Install as a Cake Tool

MatLibMini

MatLibMini is a minimalist and high-performance C# library for working with matrices and vectors. It supports generic numeric types (T : unmanaged, INumber<T>) and SIMD optimizations for common operations such as addition, multiplication, transposition, and more.


🚀 Features

  • ✅ Generic numeric type support: int, float, double, etc.
  • ✅ SIMD acceleration using System.Numerics.Vector<T>
  • ✅ Core matrix operations:
    • Addition (with scalar or another matrix)
    • Multiplication (with scalar or another matrix)
    • Transposition
    • Flattening to vector
  • ✅ Vector operations:
    • Dot product
    • Arithmetic operations (add, subtract, multiply)
  • ✅ Extension-based modular design
  • ✅ No dependencies, easy integration

📦 Installation

You can either clone the repo or add it as a submodule:

git submodule add https://github.com/your-username/MatLibMini.git

Or reference the project directly in your .csproj file:

<ProjectReference Include="MatLibMini/MatLibMini.csproj" />

🧠 Example Usage

Matrix Operations

using MatLibMini;
using MatLibMini.Extensions;

var matA = new Mat<float>(new float[,] {
    {1, 2},
    {3, 4}
});

var matB = new Mat<float>(new float[,] {
    {5, 6},
    {7, 8}
});

matA.Add(matB); // matA += matB

var result = matA.Multiply(matB.Transpose());

Console.WriteLine(result);

Vector Operations

var vec1 = Vec<float>.From(stackalloc float[] {1, 2, 3});
var vec2 = Vec<float>.From(stackalloc float[] {4, 5, 6});

var dot = vec1.Dot(vec2); // 1*4 + 2*5 + 3*6 = 32
Console.WriteLine($"Dot product: {dot}");

📁 Project Structure

  • Mat<T> – Generic matrix structure
  • Vec<T> – Generic vector structure
  • MatBaseOperations – Core matrix operations (Add, Multiply, Transpose)
  • VecBaseOperations – Core vector operations (Dot, Arithmetic)
  • Extensions – Modular extension methods with SIMD support

⚙️ Requirements

  • .NET 7 or later
  • C# 11 (INumber<T> support)
  • JIT/runtime with SIMD support (System.Numerics.Vector<T>)

📄 License

This project is licensed under the MIT License — see the LICENSE file for details.


Built for performance. Designed for simplicity. 💡
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 182 4/25/2025
1.0.0 166 4/25/2025