GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - SciSharp/NumSharp: High Performance Computation for N-D Tensors in .NET, identical API to NumPy.

BranchesTags
Open more actions menu

Latest commit

 

History

4,996 Commits
4,996 Commits

Folders and files

NameName
Last commit message
Last commit date
.agents/skills/np-function
.agents/skills/np-function
 
 
.claude
.claude
 
 
.github
.github
 
 
benchmark
benchmark
 
 
coverage
coverage
 
 
docs
docs
 
 
examples
examples
 
 
refs
refs
 
 
src
src
 
 
test
test
 
 
tools
tools
 
 
.editorconfig
.editorconfig
 
 
.git-blame-ignore-revs
.git-blame-ignore-revs
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
AGENTS.md
AGENTS.md
 
 
ARCHITECTURE.md
ARCHITECTURE.md
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Directory.Build.props
Directory.Build.props
 
 
LICENSE
LICENSE
 
 
Open.snk
Open.snk
 
 
README.md
README.md
 
 
SciSharp.NumSharp.sln
SciSharp.NumSharp.sln
 
 
SciSharp.NumSharp.sln.DotSettings
SciSharp.NumSharp.sln.DotSettings
 
 
global.json
global.json
 
 

Repository files navigation

NumSharp

NumSharp

NumPy for .NET

NuGet NuGet downloads Build Docs Benchmarks License

NumSharp is a native .NET array library with a NumPy-shaped API: NDArray, broadcasting, slicing views, dtype-aware np.* functions, unmanaged storage, and runtime-generated kernels with cpu-acceleration for performance-sensitive numerical code.

The compatibility target is NumPy 2.x. When NumSharp behavior and NumPy behavior differ, NumPy is treated as the source of truth and aligns.

What Is NumSharp?

NumSharp lets C# and F# code use a NumPy-like programming model without embedding CPython. It is intended for scientific computing, numerical utilities, machine learning infrastructure, and projects that want NumPy-style array operations in ordinary .NET code.

NumSharp's edge is utilizing the power of C#'s dynamic IL generation and fused kernels translating to assembly generated with JIT optimizations and SIMD CPU acceleration. This edge leads the design of NumSharp's backend and by that to higher performance mark than NumPy on many functions as can be seen in Performance.

NumSharp focuses on:

  • NumPy-shaped API names and behavior.
  • N-dimensional arrays with shape, stride, offset, and view metadata.
  • Broadcasting without materializing repeated values.
  • Dtype-aware math, comparisons, reductions, random sampling, and formatting.
  • NumPy's text dtypes and string operations, chararray included.
  • Runtime IL generation and SIMD fast paths where layout and dtype allow it.

Click here to see code Getting Started

Features

  • NumPy-style NDArray - N-dimensional arrays with shape, strides, offsets, slicing, and view semantics. Start with NDArray fundamentals and NDArray.
  • Broadcasting - NumPy-style shape expansion without materializing repeated values. See Broadcasting.
  • Dtype-aware operations - 15 core dtypes with NumPy-oriented promotion and conversion behavior. See Dtypes and NumPy compliance.
  • Strings and character arrays - NumPy's fixed-width S / U and variable-width StringDType arrays with missing values, all of np.strings, the np.@char module and chararray (NDCharArray). See Strings, bytes and chararrays.
  • Broad np.* API surface - Creation, manipulation, math, reductions, comparisons, logic, random sampling, I/O, and formatting. Browse the API reference.
  • Generated IL and SIMD kernels - Runtime-specialized kernels for supported dtype and layout combinations. See IL generation.
  • Iterator and fusion infrastructure - NDIter-style execution and fused np.evaluate expressions for reducing intermediate allocations. See NDIter.
  • Tracked performance reports - Release snapshots with dashboard summaries, raw reports, and subsystem matrices. See the benchmark dashboard.

Features Support and Implementation Map

NumSharp's Coverage & Support Dashboard is presenting the full implementation roadmap to complete 100% NumPy porting with an explorer allowing you to quickly check your favorite functions!

NumSharp API coverage surface scoreboard NumSharp API coverage capability map

Performance

NumSharp benchmarks are published as tracked release snapshots, not ad hoc numbers. The latest checked-in snapshot compares NumSharp with NumPy 2.4.2 across the operation matrix, supported dtypes, three size tiers, and the NDIter, layout, operand, cast, and fusion subsystems.

NumSharp benchmark dashboard NumSharp benchmark function explorer

Build, Test and Install

Install the core package:

dotnet add package NumSharp

Use familiar NumPy-style calls:

using NumSharp;

var a = np.arange(12).reshape(3, 4);
var window = a[":, 1::2"];

Console.WriteLine(window);
Console.WriteLine(np.sum(window, axis: 0));

For Python readers, the intended shape is deliberately close:

import numpy as np

a = np.arange(12).reshape(3, 4)
window = a[:, 1::2]
print(window.sum(axis=0))

Build:

dotnet build test/NumSharp.Tests/NumSharp.Tests.csproj --configuration Release

Run the normal CI-style unit test filter:

dotnet test test/NumSharp.Tests/NumSharp.Tests.csproj \
  --configuration Release \
  --no-build \
  --framework net8.0 \
  --filter "TestCategory!=OpenBugs&TestCategory!=HighMemory"

CI runs on Windows, Linux, and macOS for net8.0 and net10.0.

Related Projects

If you need to call the full CPython NumPy runtime from .NET, including Python extension modules NumSharp does not implement, see Numpy.NET. NumSharp is a native .NET implementation with a NumPy-shaped API; Numpy.NET bridges into Python.

License

NumSharp is released under the Apache License 2.0.

NumSharp is part of the SciSharp ecosystem for machine learning, mathematics, science, and engineering on .NET.

About

High Performance Computation for N-D Tensors in .NET, identical API to NumPy.

scisharp.github.io/NumSharp/

Topics

aimachine-learningnumpynumsharppandas

Resources

Readme
Apache-2.0 license

Code of conduct

Code of conduct

Contributing

Contributing
Activity
Custom properties

Stars

1.5k stars

Watchers

68 watching

Forks

206 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.