Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo
https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo
- Owner: Mojo-Numerics-and-Algorithms-group
- License: mit
- Created: 2023-07-22T22:10:06.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-06-01T22:35:05.000Z (8 months ago)
- Last Synced: 2024-06-01T23:50:22.416Z (8 months ago)
- Language: Mojo
- Size: 207 KB
- Stars: 44
- Watchers: 2
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Roadmap: Roadmap.md
Awesome Lists containing this project
- awesome-mojo - NuMojo - A library for numerical computing in Mojo 🔥 similar to NumPy, SciPy in Python. (🗂️ Libraries / Math)
- awesome-mojo-max-mlir - Mojo-Numerics-and-Algorithms-group/NuMojo - Numerics-and-Algorithms-group/NuMojo?style=social"/> : A numerics library for the Mojo programming language. (Scientific Computation)
- awesome-mojo-max-mlir - Mojo-Numerics-and-Algorithms-group/NuMojo - Numerics-and-Algorithms-group/NuMojo?style=social"/> : A numerics library for the Mojo programming language. (Scientific Computation)
README
Table of Contents
## About the project
### What NuMojo is
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 array inputs.
We intend NuMojo 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
### What NuMojo is not
NuMojo is not a machine learning library, it will never include back-propagation in the base library.
## Goals / Roadmap
For a detailed roadmap, please refer to the [Roadmap.md](Roadmap.md) file.
Our main goal is to implement a fast, comprehensive numerics library in Mojo. Following are some brief long-term goals,
### 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## Usage
An example goes as follows.
```mojo
import numojo as nm
from numojo.prelude import *fn main() raises:
# Generate two 1000x1000 matrices with random float64 values
var A = nm.random.randn[f64](shape=List[Int](1000, 1000))
var B = nm.random.randn[f64](shape=List[Int](1000, 1000))# Generate a 3x2 matrix from string representation
var X = nm.fromstring[f32]("[[1.1, -0.32, 1], [0.1, -3, 2.124]]")# Print array
print(A)# Array multiplication
var C = A @ B# Array inversion
var I = nm.inv(A)# Array slicing
var A_slice = A[1:3, 4:19]# Get scalar from array
var A_item = A.item(291, 141)
```Please find all the available functions [here](features.md)
## How to install
There are two approach to install and use the Numojo package.
### Build package
This approach invovles building a standalone package file `mojopkg`.
1. Clone the repository.
2. Build the package using `mojo package numojo`
3. Move the numojo.mojopkg into the directory containing the your code.### Include NuMojo's path for compiler and LSP
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:
```console
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:
1. Go to preference page of VSCode.
2. Go to `Mojo › Lsp: Include Dirs`
3. Click `add item` and write the path where the Numojo repository is located, e.g. `/Users/Name/Programs/NuMojo`.
4. Restart the Mojo LSP server.Now VSCode can show function hints for the Numojo package!
## Contributing
Any contributions you make are **greatly appreciated**. For more details and guidelines on contributions, please check [here](CONTRIBUTING.md)
## Warnings
This library is still very much a work in progress and may change at any time.
## License
Distributed under the Apache 2.0 License with LLVM Exceptions. See [LICENSE](https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo/blob/main/LICENSE) and the LLVM [License](https://llvm.org/LICENSE.txt) for more information.
## Acknowledgements
* Built in native [Mojo](https://github.com/modularml/mojo) which was created by [Modular](https://github.com/modularml)