![Logo](./assets/numojo_logo.png)
NuMojo is a library for numerical computing in Mojo 🔥 similar to NumPy, SciPy in Python.
Explore the docs»
Table of Contents
NuMojo intends to capture a wide swath of numerics capability present in the Python packages NumPy, SciPy and Scikit.
NuMojo intends to try and get the most out of the capabilities of Mojo including vectorization, parallelization, and GPU acceleration(once available). Currently, NuMojo extends (most of) the standard library math functions to work on tensor inputs. NuMojo intends to try and get the most out of the capabilities of Mojo including vectorization, parallelization, and GPU acceleration(once available). Currently, NuMojo extends (most of) the standard library math functions to work on tensor inputs.
NuMojo intends to be a building block for other Mojo packages that need fast math under the hood without the added weight of a ML back and forward propagation system
NuMojo is not a machine learning library, it will never include back-propagation in the base library.
For a detailed roadmap, please refer to the Roadmap.md file.
Our main goal is to implement a fast, comprehensive numerics library in Mojo. Following are some brief long-term goals,
- Linear Algebra
- Native n-dimensional array types
- Vectorized, Parallelized math operations
- Array manipulation - vstack, slicing, concat etc.
- Calculus
- Integration & Derivatives etc
- Optimizers
- Function approximators
- Sorting
An example goes as follows.
import numojo as nm
fn main() raises:
# Generate two 1000x1000 matrices with random float64 values
var A = nm.NDArray[nm.f64](shape=List[Int](1000,1000), random=True)
var B = nm.NDArray[nm.f64](1000,1000, random=True)
# Print AB
print(nm.linalg.matmul_parallelized(A, B))
Please find all the available functions here
There are two approach to install and use the Numojo package.
This approach invovles building a standalone package file mojopkg
.
- Clone the repository.
- Build the package using
mojo pacakge numojo
- Move the numojo.mojopkg into the directory containing the your code.
This approach does not require buiding a package file. Instead, when you compile your code, you can include the path of NuMojo reporsitory with the following command:
mojo run -I "../NuMojo" example.mojo
This is more flexible as you are able to edit the NuMojo source files when testing your code.
In order to allow VSCode LSP to resolve the imported numojo
package, you can:
- Go to preference page of VSCode.
- Got to
Mojo › Lsp: Include Dirs
- Click
add item
and write the path where the Numojo repository is located, e.g./Users/Name/Programs/NuMojo
. - Restart the Mojo LSP server.
Now VSCode can show function hints for the Numojo pakcage!
Any contributions you make are greatly appreciated. For more details and guidelines on contributions, please check here
This library is still very much a work in progress and may change at any time.
Distributed under the Apache 2.0 License with LLVM Exceptions. See LICENSE and the LLVM License for more information.