FsMath 0.0.1
dotnet add package FsMath --version 0.0.1
NuGet\Install-Package FsMath -Version 0.0.1
<PackageReference Include="FsMath" Version="0.0.1" />
<PackageVersion Include="FsMath" Version="0.0.1" />
<PackageReference Include="FsMath" />
paket add FsMath --version 0.0.1
#r "nuget: FsMath, 0.0.1"
#:package FsMath@0.0.1
#addin nuget:?package=FsMath&version=0.0.1
#tool nuget:?package=FsMath&version=0.0.1
FsMath - Fast & Friendly Numerical Foundation for F#
FsMath is a lightweight maths library designed for modern F# workflows. It focuses on zero-friction interop with existing array-centric libraries ( FSharp.Stats, Math.NET Numerics, libtorch via TorchSharp, etc.) while giving you the performance head-room of SIMD-accelerated kernels and a clean, idiomatic F# API.
Why another numeric library?
Goal | What it means in practice |
---|---|
Interop first | Core types are just aliases or thin wrappers around native F# 'T [] arrays → you can pass data to any array-based .NET or C library without conversion or pinning. |
Predictable memory layout | Matrices are stored row-major (C-style) to line up with libtorch / TorchSharp, modern BLAS back-ends, and GPU kernels. |
SIMD out-of-the-box | Tight loops (dot, outer product, reductions ...) auto-detect hardware with SIMD support and pure-managed fallback otherwise. |
F#-idiomatic API | Pipelining, module functions, inline operators (.+ , .* , transpose ) and SRTP �type-class� dispatch keep your notebooks & scripts concise. |
Key features
- Vector / RowVector / Matrix - minimal, generic, and structural-equality aware.
- High-level operators -
.+
,.-
,.*
,./
, outer product, Kronecker, hadamard, etc. - SIMD optimizes - dot products, outer products, reductions, and more.
- Unsafe-free - everything is pure managed IL; no native dlls to ship.
- Perfect interop - drop-in arrays to FSharp.Stats, TorchSharp, DiffSharp, and any BLAS/LAPACK P/Invoke you like.
Getting started
open FsMath
open FSharp.Stats.Distributions
// init vector
let v1 = vector [| 1.0; 2.0; 3.0 |]
// init vector with random samples (using FSharp.Stats)
let v2 = Array.init 3 (fun _ -> Continuous.ChiSquared.Sample 30.)
// SIMD-accelerated element-wise multiply
let result = v1 .* v2
// interop: pass 'result' straight into e.g. TorchSharp tensor
Documentation
Topic | Where |
---|---|
API reference | docs/ folder & generated markdown |
Benchmarks | benchmarks/ |
Contributing guide | CONTRIBUTING.md |
build
Check the build project to take a look at the build targets.
# Windows
./build.cmd
# Linux/mac
build.sh
running and writing tests
# Windows
./build.cmd runtests
# Linux/mac
build.sh runtests
docs
The docs are contained in .fsx
and .md
files in the docs
folder. To develop docs on a local server with hot reload, run the following in the root of the project:
# Windows
./build.cmd watchdocs
# Linux/mac
./build.sh watchdocs
pack nuget package(s)
# Windows
./build.cmd pack
# Linux/mac
build.sh pack
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. 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. |
-
net8.0
- FSharp.Core (>= 8.0.403)
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 |
---|---|---|
0.0.1 | 194 | 8/8/2025 |