Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
b41e8b6
[Mojo] Update NuMojo to Mojo v25.4.0 (#254)
shivasankarka Jul 12, 2025
913615c
[workflow][format] Fix the linting issues and update the work flow (#…
forfudan Jul 13, 2025
591baa7
[core][Errors] Improved error handling (#258)
shivasankarka Jul 26, 2025
d08a493
[core][Mojo][Errors] Update NuMojo to Mojo 25.5 & Improve errors in N…
shivasankarka Aug 9, 2025
d53d1ea
[core][NDArray][ComplexNDArray] Improve getter and setter (#263)
shivasankarka Aug 9, 2025
0f25fec
[core][Format] Improve NDArray, ComplexNDArray printing (#264)
shivasankarka Aug 13, 2025
c3ec380
[core][NDArray][ComplexNDArray] Improve __getitem__ of NDArray and Co…
shivasankarka Sep 11, 2025
7f35e0a
[Tooling][Docs] Add `pixi-build-mojo` backend (#268)
shivasankarka Sep 12, 2025
16f41d6
[Complex] Add the Complex DType (#269)
shivasankarka Sep 23, 2025
f7f3b15
[Update][Mojo] Update NuMojo to support Mojo v0.25.6 (#270)
shivasankarka Sep 25, 2025
3876690
[core][Item][NDArrayShape][NDArrayStrides] Unify containers (#274)
shivasankarka Oct 21, 2025
ba0249e
[core][ComplexNDArray] Improve ComplexNDArray methods (#275)
shivasankarka Oct 24, 2025
44ac4ad
[core][views] Implement foundation for views (#281)
shivasankarka Oct 31, 2025
d2a1ce5
[core][Matrix][Tests] Upgrade Matrix & Tests (#284)
shivasankarka Nov 26, 2025
cb5ead4
[core][Matrix] Implement full support for Matrix views (#286)
shivasankarka Dec 4, 2025
4038c8f
[core][Matrix][Docs] Improve Matrix docstrings (#287)
shivasankarka Dec 4, 2025
0fd9b3f
[core][Complex] Improve Complex-number ecosystem (#290)
shivasankarka Dec 6, 2025
bfcf1c3
[Core] Add foundational NDArray features, API refinements, and new ar…
shivasankarka Jan 3, 2026
d9b2c5a
[Docs] Update Changelog for v0.71 release (#292)
shivasankarka Jan 4, 2026
27860bd
[README] Update README for NuMojo v0.71.0 update (#294)
shivasankarka Jan 4, 2026
f123bc6
[pixi] Update NuMojo to v0.8.0 in pixi.toml (#295)
shivasankarka Jan 5, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 43 additions & 17 deletions .github/workflows/run_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,28 +29,54 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install magic
- name: Install pixi
run: |
curl -ssL https://magic.modular.com/deb181c4-455c-4abe-a263-afcff49ccf67 | bash

- name: Add path
curl -fsSL https://pixi.sh/install.sh | bash
echo "$HOME/.pixi/bin" >> $GITHUB_PATH
export PATH="$HOME/.pixi/bin:$PATH"

- name: Pixi install
run: |
pixi install --locked

- name: Build package
run: |
pixi run mojo package numojo
cp numojo.mojopkg tests/

- name: Run Core Tests
run: |
echo "MODULAR_HOME=$HOME/.modular" >> $GITHUB_ENV
echo "$HOME/.modular/bin" >> $GITHUB_PATH
echo "$HOME/.modular/pkg/packages.modular.com_mojo/bin" >> $GITHUB_PATH
echo "Testing core modules..."
pixi run mojo run -I tests/ tests/core/test_array_indexing_and_slicing.mojo
pixi run mojo run -I tests/ tests/core/test_array_methods.mojo
pixi run mojo run -I tests/ tests/core/test_bool_masks.mojo
pixi run mojo run -I tests/ tests/core/test_complexArray.mojo
pixi run mojo run -I tests/ tests/core/test_complexSIMD.mojo
pixi run mojo run -I tests/ tests/core/test_matrix.mojo
pixi run mojo run -I tests/ -D F_CONTIGUOUS tests/core/test_matrix.mojo
pixi run mojo run -I tests/ tests/core/test_shape_strides_item.mojo

- name: Activate virtualenv
- name: Run Routine Tests
run: |
python3 -m venv $HOME/venv/
. $HOME/venv/bin/activate
echo PATH=$PATH >> $GITHUB_ENV
echo "Testing routines..."
pixi run mojo run -I tests/ tests/routines/test_creation.mojo
pixi run mojo run -I tests/ tests/routines/test_functional.mojo
pixi run mojo run -I tests/ tests/routines/test_indexing.mojo
pixi run mojo run -I tests/ tests/routines/test_io.mojo
pixi run mojo run -I tests/ tests/routines/test_linalg.mojo
pixi run mojo run -I tests/ tests/routines/test_manipulation.mojo
pixi run mojo run -I tests/ tests/routines/test_math.mojo
pixi run mojo run -I tests/ tests/routines/test_random.mojo
pixi run mojo run -I tests/ tests/routines/test_statistics.mojo
pixi run mojo run -I tests/ tests/routines/test_sorting.mojo
pixi run mojo run -I tests/ tests/routines/test_searching.mojo

- name: Install packages
- name: Run Science Tests
run: |
pip install "numpy"
echo "Testing science modules..."
pixi run mojo run -I tests/ tests/science/test_signal.mojo

- name: Run tests
- name: Cleanup
if: always()
run: |
magic install
magic run mojo test tests -I .
magic run mojo test tests/core/test_matrix.mojo -I . -D F_CONTIGUOUS
rm -f tests/numojo.mojopkg
21 changes: 14 additions & 7 deletions .github/workflows/test_pre_commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,23 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4

- name: Install magic
- name: Install Pixi
run: |
curl -ssL https://magic.modular.com/deb181c4-455c-4abe-a263-afcff49ccf67 | bash
curl -fsSL https://pixi.sh/install.sh | bash
echo "$HOME/.pixi/bin" >> $GITHUB_PATH

- name: Add Modular to Pixi
run: |
export PATH="$HOME/.pixi/bin:$PATH"
pixi install

- name: Add path
- name: Set up Modular environment
run: |
echo "MODULAR_HOME=$HOME/.modular" >> $GITHUB_ENV
echo "$HOME/.modular/bin" >> $GITHUB_PATH
echo "$HOME/.modular/pkg/packages.modular.com_mojo/bin" >> $GITHUB_PATH
echo "$HOME/.modular/bin" >> $GITHUB_PATH
echo "$HOME/.modular/pkg/packages.modular.com_mojo/bin" >> $GITHUB_PATH

- name: Activate virtualenv
- name: Setup Python virtualenv
run: |
python3 -m venv $HOME/venv/
. $HOME/venv/bin/activate
Expand All @@ -47,5 +53,6 @@ jobs:

- name: Run pre-commit
run: |
magic install
export PATH="$HOME/.pixi/bin:$PATH"
pixi install
pre-commit run --all-files
9 changes: 3 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@
# MacOs Desktop Service file
*.DS_Store

# magic environments
.magic
magic.lock
pixi.lock

# pixi environments
.pixi
/venv
Expand All @@ -32,8 +27,10 @@ numojo.mojopkg
/bench.mojo
/test*.mojo
/test*.ipynb
bench_*.mojo
/tempCodeRunnerFile.mojo
kgen.trace.*

# Auto docs
docs/readthedocs/docs.json
docs.json
docs.json
10 changes: 3 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,9 @@ repos:
hooks:
- id: mojo-format
name: mojo-format
entry: magic run mojo format
entry: pixi run mojo format
language: system
files: '\.(mojo|🔥|py)$'
stages: [pre-commit]
# - id: autodoc
# name: mautodoc
# entry: magic run doc_pages
# language: system
# files: '\.(mojo|🔥|py)$'
# stages: [pre-commit]
# pass_filenames: false # Don't pass filenames to the formatter
# always_run: true # Always run the formatter
155 changes: 111 additions & 44 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ NuMojo is a library for numerical computing in Mojo 🔥 similar to NumPy, SciPy

**[Explore the docs»](https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo-Examples-and-Benchmarks/blob/main/docs/README.md)** | **[Changelog»](https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo/blob/main/docs/changelog.md)** | **[Check out our Discord»](https://discord.gg/NcnSH5n26F)**

**[中文·简»](https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo/blob/main/docs/readme_zhs.md)** | **[中文·繁»](https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo/blob/main/docs/readme_zht.md)** | **[日本語»](https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo/blob/main/docs/readme_jp.md)**
**[中文·简»](https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo/blob/main/docs/readme_zhs.md)** | **[中文·繁»](https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo/blob/main/docs/readme_zht.md)** | **[日本語»](https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo/blob/main/docs/readme_jp.md)** |
**[한국어»](https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo/blob/main/docs/readme_kr.md)**

**Table of Contents**

Expand All @@ -23,9 +24,6 @@ NuMojo is a library for numerical computing in Mojo 🔥 similar to NumPy, SciPy
## About the project

NuMojo aims to encompass the extensive numerics capabilities found in Python packages such as NumPy, SciPy, and Scikit-learn.

=======

***What NuMojo is***

We seek to harness the full potential of Mojo, including vectorization, parallelization, and GPU acceleration (when available). Currently, NuMojo extends most (if not all) standard library math functions to support array inputs.
Expand All @@ -38,7 +36,7 @@ NuMojo is not a machine learning library and will never include back-propagation

## Features and goals

Our primary objective is to develop a fast, comprehensive numerics library in Mojo. Below are some features and long-term goals. Some have already been implemented, either fully or partially.
Our primary objective is to develop a fast, comprehensive numerics library in Mojo. Below are some features and long-term goals. Some have already been implemented (fully or partially).

Core data types:

Expand All @@ -64,7 +62,7 @@ Routines and objects:
- Statistics (`numojo.statistics`)
- etc...

Please find all the available functions and objects [here](docs/features.md).
Please find all the available functions and objects [here](docs/features.md). A living roadmap is maintained in [docs/roadmap.md](docs/roadmap.md).

For a detailed roadmap, please refer to the [docs/roadmap.md](docs/roadmap.md) file.

Expand Down Expand Up @@ -123,7 +121,7 @@ fn main() raises:
)

# Matrix slicing
var A_slice = A[1:3, 4:19]
var A_slice = A[1:3, 4:19] # returns a copy, for getting a view use `A.get(Slice(1,3), Slice(4, 19))
var B_slice = B[255, 103:241:2]

# Get scalar from matrix
Expand Down Expand Up @@ -153,20 +151,21 @@ fn main() raises:
print(nm.lstsq(A, C))
```

An example of ComplexNDArray is as follows,
An example of `ComplexNDArray` is as follows:

```mojo
import numojo as nm
from numojo.prelude import *


fn main() raises:
# Create a complexscalar 5 + 5j
var complexscalar = ComplexSIMD[f32](re=5, im=5)
# Create complex array filled with (5 + 5j)
var A = nm.full[f32](Shape(1000, 1000), fill_value=complexscalar)
# Create complex array filled with (1 + 1j)
var B = nm.ones[f32](Shape(1000, 1000))
# Create a complex scalar 5 + 5j
var complexscalar = CScalar[cf32](5) # Equivalently ComplexSIMD[cf32](5, 5)
# Also equivalently as simple as 5 + 5*`1j`!

# Create complex arrays
var A = nm.full[cf32](Shape(1000, 1000), fill_value=complexscalar) # filled with (5+5j)
var B = nm.ones[cf32](Shape(1000, 1000)) # filled with (1+1j)

# Print array
print(A)
Expand All @@ -183,63 +182,131 @@ fn main() raises:
A[item(291, 141)] = complexscalar
```

## How to install
## Installation

There are three approach to install and use the Numojo package.
NuMojo offers several installation methods to suit different development needs. Choose the method that best fits your workflow:

### Add `numojo` in `pixi.toml`
### Method 1: Git Installation with pixi-build-mojo (Recommended)

You can add the package `numojo` of a specific version in the dependencies section of your toml file.
Install NuMojo directly from the GitHub repository to access both stable releases and cutting-edge features. This method is perfect for developers who want the latest functionality or need to work with the most recent stable version.

Add the following to your existing `pixi.toml`:

```toml
[workspace]
preview = ["pixi-build"]

[package]
name = "your_project_name"
version = "0.1.0"

[package.build]
backend = {name = "pixi-build-mojo", version = "0.*"}

[package.build.config.pkg]
name = "your_package_name"

[package.host-dependencies]
modular = ">=25.7.0,<26"

[package.build-dependencies]
modular = ">=25.7.0,<26"
numojo = { git = "https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo", branch = "main"}

[package.run-dependencies]
modular = ">=25.7.0,<26"
numojo = { git = "https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo", branch = "main"}

[dependencies]
numojo = "=0.7.0"
modular = ">=25.7.0,<26"
numojo = { git = "https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo", branch = "main"}
```

Then, you can run `pixi install` to install the package.
Then run:
```bash
pixi install
```

The following table shows the version of `numojo` and the corresponding version of `mojo` that is required.
**Branch Selection:**
- **`main` branch**: Provides stable release. Currently supports NuMojo v0.7.0, compatible with Mojo 25.3.0. For earlier NuMojo versions, use Method 2.
- **`pre-x.y` branches**: Active development branch supporting the latest Mojo version (currently 25.7.0). Note that this branch receives frequent updates and may have breaking changes in features and syntax.

| `numojo` | `mojo` |
| -------- | ------ |
| v0.7.0 | ==25.3 |
| v0.6.1 | ==25.2 |
| v0.6.0 | ==25.2 |
The package will be automatically available in your Pixi environment, and VSCode LSP will provide intelligent code hints.

### Build package
### Method 2: Stable Release via Pixi (prefix.dev)

This approach involves building a standalone package file `mojopkg`.
For most users, we recommend installing a stable release through Pixi for guaranteed compatibility and reproducibility.

1. Clone the repository.
2. Build the package using `pixi run package`.
3. Move the `numojo.mojopkg` into the directory containing the your code.
Add the following to your `pixi.toml` file:

### Include NuMojo's path for compiler and LSP
```toml
[workspace]
channels = ["https://repo.prefix.dev/modular-community"]

This approach does not require building a package file. Instead, when you compile your code, you can include the path of NuMojo repository with the following command:
[dependencies]
numojo = "=0.8.0"
```

```console
mojo run -I "../NuMojo" example.mojo
Then run:
```bash
pixi install
```

This is more flexible as you are able to edit the NuMojo source files when testing your code.
**Version Compatibility:**

| NuMojo Version | Required Mojo Version |
| -------------- | -------------------- |
| v0.8.0 | ==25.7 |
| v0.7.0 | ==25.3 |
| v0.6.1 | ==25.2 |
| v0.6.0 | ==25.2 |

### Method 3: Build Standalone Package

This method creates a portable `numojo.mojopkg` file that you can use across multiple projects, perfect for offline development or hermetic builds.

1. Clone the repository:
```bash
git clone https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo.git
cd NuMojo
```

2. Build the package:
```bash
pixi run package
```

3. Copy `numojo.mojopkg` to your project directory or add its parent directory to your include paths.

### Method 4: Direct Source Integration

For maximum flexibility and the ability to modify NuMojo source code during development:

1. Clone the repository to your desired location:
```bash
git clone https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo.git
```

In order to allow VSCode LSP to resolve the imported `numojo` package, you can:
2. When compiling your code, include the NuMojo source path:
```bash
mojo run -I "/path/to/NuMojo" your_program.mojo
```

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.
3. **VSCode LSP Setup** (for code hints and autocompletion):
- Open VSCode preferences
- Navigate to `Mojo › Lsp: Include Dirs`
- Click `Add Item` and enter the full path to your NuMojo directory (e.g., `/Users/YourName/Projects/NuMojo`)
- Restart the Mojo LSP server

Now VSCode can show function hints for the Numojo package!
After setup, VSCode will provide intelligent code completion and hints for NuMojo functions!

## Contributing

Any contributions you make are **greatly appreciated**. For more details and guidelines on contributions, please check [here](CONTRIBUTING.md)
Any contributions you make are **greatly appreciated**. See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines (coding style, testing, documentation, release cadence).

## Warnings

This library is still very much a work in progress and may change at any time.
This library is still early and may introduce breaking changes between minor versions. Pin versions in production or research code.

## License

Expand Down
Loading