All Projects → Proxem → NumNet

Proxem / NumNet

Licence: Apache-2.0 license
Numpy style scientific programming package

Programming Languages

C#
18002 projects
Batchfile
5799 projects

Projects that are alternatives of or similar to NumNet

Technicalnote
Repository to store what we have studied. 📖 We want everyone to get a job through TechnicalNote.
Stars: ✭ 206 (+1111.76%)
Mutual labels:  linear-algebra
Mlcpp
Set of examples of ML approaches implemented in C++
Stars: ✭ 251 (+1376.47%)
Mutual labels:  linear-algebra
numerics
library of numerical methods using Armadillo
Stars: ✭ 17 (+0%)
Mutual labels:  linear-algebra
Mathnet Numerics
Math.NET Numerics
Stars: ✭ 2,688 (+15711.76%)
Mutual labels:  linear-algebra
Rulinalg
A linear algebra library written in Rust
Stars: ✭ 247 (+1352.94%)
Mutual labels:  linear-algebra
Block
An intelligent block matrix library for numpy, PyTorch, and beyond.
Stars: ✭ 254 (+1394.12%)
Mutual labels:  linear-algebra
Peroxide
Rust numeric library with R, MATLAB & Python syntax
Stars: ✭ 191 (+1023.53%)
Mutual labels:  linear-algebra
PyArmadillo
PyArmadillo: an alternative approach to linear algebra in Python
Stars: ✭ 58 (+241.18%)
Mutual labels:  linear-algebra
Measurements.jl
Error propagation calculator and library for physical measurements. It supports real and complex numbers with uncertainty, arbitrary precision calculations, operations with arrays, and numerical integration.
Stars: ✭ 248 (+1358.82%)
Mutual labels:  linear-algebra
math-for-ml
Mathematical preliminaries for machine learning
Stars: ✭ 15 (-11.76%)
Mutual labels:  linear-algebra
Curso Algebra Lineal
Curso de Álgebra Lineal
Stars: ✭ 234 (+1276.47%)
Mutual labels:  linear-algebra
From 0 To Research Scientist Resources Guide
Detailed and tailored guide for undergraduate students or anybody want to dig deep into the field of AI with solid foundation.
Stars: ✭ 247 (+1352.94%)
Mutual labels:  linear-algebra
eigen-js
⚡ Eigen-js is a port of the Eigen C++ linear algebra library
Stars: ✭ 78 (+358.82%)
Mutual labels:  linear-algebra
Tutorials
AI-related tutorials. Access any of them for free → https://towardsai.net/editorial
Stars: ✭ 204 (+1100%)
Mutual labels:  linear-algebra
fastai-num-linalg-v2-zh
📖 [译] fast.ai 数值线性代数讲义 v2
Stars: ✭ 72 (+323.53%)
Mutual labels:  linear-algebra
Libflame
High-performance object-based library for DLA computations
Stars: ✭ 197 (+1058.82%)
Mutual labels:  linear-algebra
Pygraphblas
GraphBLAS for Python
Stars: ✭ 252 (+1382.35%)
Mutual labels:  linear-algebra
CNCC-2019
Computational Neuroscience Crash Course (CNCC 2019)
Stars: ✭ 26 (+52.94%)
Mutual labels:  linear-algebra
SplashGeom
Open-source C++ library for geometry and linear algebra
Stars: ✭ 22 (+29.41%)
Mutual labels:  linear-algebra
eigen
Owl's OCaml Interface to Eigen3 C++ Library
Stars: ✭ 30 (+76.47%)
Mutual labels:  linear-algebra

NumNet

NumNet is an optimized library for matrix operations and scientific programming written in C# and developed at Proxem. NumNet is inspired by python's numpy library to facilitate its use by python developers.

Table of contents

Requirements

NumNet is developed in .Net Standard 2.0 and is compatible with both .Net Framework and .Net Core thus working on Windows and Linux platform. For Mac OS users there shouldn't be any problem but we didn't test extensively.

NumNet relies on BlasNet for the low level operations on arrays. See BlasNet documentation for further information on how to use Intel's MKL for low level operations.

Examples

Matrix creations

To create an empty 2-dimensional array of dimension 3 and 4 you can use

var zeroArray = NN.Zeros(3, 4);

The following creates a 1-dimensional array with all even number from 0 to 40

var range = NN.Range(0, 40, step: 2);

To reshape the previous array to a 2-d dimension array use var 2dRange = range.Reshape(4, 5);. This operation will be a O(1) if possible but it might need to copy the values (if the initial matrix is transposed or more generally if the data in the initial array are not contiguous.)

Random initializations are also supported, here are a few examples of the supported distributions

var bern = NN.Random.Bernouilli(0.5, 2, 3);  // 2 x 3 matrix
var norm = NN.Random.Normal(0, 1, 10, 10);   // 10 x 10 normally distributed matrix
var unif = NN.Random.Uniform(-1, 1, 5, 6);   // 5 x 6 uniform matrix between -1 and 1

Accessing values

Let's start with a 2-d array of size (5 x 6)

var M = NN.Range(30).Reshape(5, 6);

To access a single value in the array we will use M[i, j]. NumNet also supports more complex slicing functions. To select the first column of the array we will use

var vector = M[Slicer._, 0]; // 'Slicer._' correspond to ':' in numpy

More control on the slices is made using the following

var v0 = M[0]; // [0, 1, 2, 3, 4, 5]
var v1 = M[Slicer.Range(0, 3), Slicer.Upto(2)]; // [[0, 1],[6, 7],[12, 13]]
var v2 = M[1, Slicer.From(1)]; // [7, 8, 9, 10, 11]
var v3 = M[Slicer.Range(3, -1), -2]; // [16, 22]

Simplifying notations

By using a static Slicer like

using static Slicer;

the above samples become

var vector = M[_, 0]; // '_' correspond to ':' in numpy

and

var v0 = M[0]; // [0, 1, 2, 3, 4, 5]
var v1 = M[Range(0, 3), Upto(2)]; // numpy's equivalent of M[0:3, :2]
var v2 = M[1, From(1)]; // numpy's equivalent of M[1, 1:]
var v3 = M[Range(3, -1), -2]; // numpy's equivalent of M[3:-1, -2]

Range(start, stop) can even be abbreviated as (start, stop):

var v1 = M[(0, 3), Upto(2)]; // numpy's equivalent of M[0:3, :2]
var v3 = M[(3, -1), -2]; // numpy's equivalent of M[3:-1, -2]

Basic operations

The syntax for operations between multi-dimensional arrays is mostly the same as numpy (with Pascal Case). For instance, matrix multiplications will be done with the following code

var M = NN.Random.Normal(0, 1, 3, 4);
var N = NN.Random.Bernouilli(0.6, 4, 5);

var MN = NN.Dot(M, N) // gives a (3 x 5) matrix
var MMNTranspose = NN.Dot(MN.T, M) // gives a (5 x 4) matrix

where MN.T stands for the transpose of MN.

More examples

Please see project NumNet.Test for other examples

Running the tests

Edit Proxem.NumNet/App.config and set "mkl:path" according to where your MKL dlls are located. In VisualStudio, either set Test|Test settings|Default Processor Architecture to X64 or load file Test.runsettings from Test|Test settings|Select Test Settings File

If no "mkl:path" is found, a default managed BLAS provider is used. Note that this provider is slow and does not implement Lapack routines.

Nuget Package

We provide a Nuget Package of NumNet to facilitate its use. It's available on Nuget.org. Symbols are also available to facilitate debugging inside the package.

Disclaimer

This is not an official Proxem product.

Contact information

If you can't make NumNet work on your computer or if you have any tracks of improvement drop us an e-mail at one of the following address:

License

NumNet is Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].