You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+8-4Lines changed: 8 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Please follow the Mojo standard library style guide for all contributions. Consi
10
10
- Write concise, well-documented code.
11
11
- Adhere to formatting conventions for indentation, spacing, and line breaks.
12
12
13
-
Additionally refer to `style guide.md` for docstring and nameing conventions.
13
+
Additionally refer to `style guide.md` for docstring and naming conventions.
14
14
15
15
## Pull Requests
16
16
@@ -50,16 +50,20 @@ Following this structure ensures that similar functionalities are grouped togeth
50
50
```
51
51
52
52
4.**Make Your Changes**: Implement your changes in your branch.
53
-
5.**Commit Your Changes**: Commit your changes with a clear and descriptive commit message.
53
+
5.**Run Tests**: NuMojo now uses the `Magic` package manager by Modular. To ensure that all unit tests pass, the NuMojo module packages correctly, and the .mojo files are properly formatted, run the following command:
54
+
```sh
55
+
magic run final
56
+
```
57
+
6.**Commit Your Changes**: Commit your changes with a clear and descriptive commit message.
54
58
55
59
```sh
56
60
git commit -m "Add feature XYZ"
57
61
```
58
62
59
-
6.**Push Your Changes**: Push your branch to your fork on GitHub.
63
+
7.**Push Your Changes**: Push your branch to your fork on GitHub.
60
64
61
65
```sh
62
66
git push origin feature-name
63
67
```
64
68
65
-
7.**Submit a Pull Request**: Open a pull request to the `main` branch of the original repository.
69
+
8.**Submit a Pull Request**: Open a pull request to the `main` branch of the original repository.
Copy file name to clipboardExpand all lines: README.MD
+40-16Lines changed: 40 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,10 +13,19 @@
13
13
NuMojo is a library for numerical computing in Mojo 🔥 similar to NumPy, SciPy in Python.
14
14
<br />
15
15
<!-- when we create docs -->
16
-
<a href="https://github.com/Mojo-Numerics-and-Algorithms-group/NuMojo-Examples-and-Benchmarks/blob/main/docs/README.md"><strong>Explore the docs» </strong></a>
17
-
<br>
18
-
<a href="https://discord.com/channels/1149778565756366939/1149778566603620455"><strong>Check out our Discord» </strong></a>
NuMojo intends to capture a wide swath of numerics capability present in the Python packages NumPy, SciPy and Scikit.
57
66
58
-
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.
59
67
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.
60
68
61
-
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
69
+
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
62
70
63
71
### What NuMojo is not
64
72
@@ -88,14 +96,30 @@ An example goes as follows.
88
96
89
97
```mojo
90
98
import numojo as nm
99
+
from numojo.prelude import *
91
100
92
101
fn main() raises:
93
102
# Generate two 1000x1000 matrices with random float64 values
94
-
var A = nm.NDArray[nm.f64](shape=List[Int](1000,1000), random=True)
95
-
var B = nm.NDArray[nm.f64](1000,1000, random=True)
103
+
var A = nm.random.randn[f64](shape=List[Int](1000, 1000))
104
+
var B = nm.random.randn[f64](shape=List[Int](1000, 1000))
105
+
106
+
# Generate a 3x2 matrix from string representation
107
+
var X = nm.fromstring[f32]("[[1.1, -0.32, 1], [0.1, -3, 2.124]]")
108
+
109
+
# Print array
110
+
print(A)
111
+
112
+
# Array multiplication
113
+
var C = A @ B
114
+
115
+
# Array inversion
116
+
var I = nm.inv(A)
117
+
118
+
# Array slicing
119
+
var A_slice = A[1:3, 4:19]
96
120
97
-
# Print AB
98
-
print(nm.linalg.matmul_parallelized(A, B))
121
+
# Get scalar from array
122
+
var A_item = A.item(291, 141)
99
123
```
100
124
101
125
Please find all the available functions [here](features.md)
@@ -109,10 +133,10 @@ There are two approach to install and use the Numojo package.
109
133
This approach invovles building a standalone package file `mojopkg`.
110
134
111
135
1. Clone the repository.
112
-
1. Build the package using `mojo pacakge numojo`
113
-
1. Move the numojo.mojopkg into the directory containing the your code.
136
+
2. Build the package using `mojo package numojo`
137
+
3. Move the numojo.mojopkg into the directory containing the your code.
114
138
115
-
### Inlcude NuMojo's path for compiler and LSP
139
+
### Include NuMojo's path for compiler and LSP
116
140
117
141
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:
118
142
@@ -125,11 +149,11 @@ This is more flexible as you are able to edit the NuMojo source files when testi
125
149
In order to allow VSCode LSP to resolve the imported `numojo` package, you can:
126
150
127
151
1. Go to preference page of VSCode.
128
-
1. Got to `Mojo › Lsp: Include Dirs`
129
-
1. Click `add item` and write the path where the Numojo repository is located, e.g. `/Users/Name/Programs/NuMojo`.
130
-
1. Restart the Mojo LSP server.
152
+
2. Go to `Mojo › Lsp: Include Dirs`
153
+
3. Click `add item` and write the path where the Numojo repository is located, e.g. `/Users/Name/Programs/NuMojo`.
154
+
4. Restart the Mojo LSP server.
131
155
132
-
Now VSCode can show function hints for the Numojo pakcage!
156
+
Now VSCode can show function hints for the Numojo package!
This is a list of RELEASED changes for the NuMojo Package.
4
+
5
+
## 14/10/2024 (v0.3)
6
+
7
+
### ⭐️ New
8
+
9
+
- Add support for `magic` system and MAX 24.5 (PR #91#109 by @shivasankarka).
10
+
- Add some basic functions, e.g., `diagflat`, `tri`, `trace`, `T` (PR #91 by @shivasankarka).
11
+
- Add a constructor which reads arrays from numpy arrays (PR #91 by @shivasankarka).
12
+
- Add functions `solve` and `inv` for solving linear algebra `AX = Y` for `X`, finding inverse of a matrix, and conducting LU decomposition (PR #101#104#105 by @forFudan).
13
+
- Add `itemset` method to fill a scalar into an `NDArray` (PR #102 by @forFudan).
14
+
- Add `Idx` struct to represent the index of an `NDArray` (PR #118 by @shivasankarka).
15
+
- Add NDArray initialization from numpy arrays (PR #118 by @shivasankarka).
16
+
- Created a new `io` module with some basic functions, e.g., `format_float_scientific`, `loadtxt`, `savetxt` (PR #118 by @shivasankarka).
17
+
18
+
### 🦋 Changed
19
+
20
+
- Make some methods, e.g., `sort`, `flatten`, `inplace` (Issue #87 by @mmenendezg, PR #91 by @shivasankarka).
21
+
- Modify initialization of NDArray (PR #97 by @MadAlex1997)
22
+
- Added `Formattable` trait and fixed the `print` function (PR #108 by @shivasankarka)
23
+
- Refine the `NDArray` initializers and array creation routines (Discussion #90, Issue #110).
24
+
- Remove `random` argument from `NDArray` constructors. Make random initializer a standalone functions (Issue #96 by @MadAlex1997, PR #97 by @MadAlex1997, PR #98 by @shivasankarka).
25
+
- Remove initializers from `String`. Make `fromstring` a standalone function (#113 by @forFudan).
26
+
- Add several `array` overloads for initializing `NDArray` (PR #118 by @shivasankarka).
27
+
- Modify the behavior of `__get__` and `__set__`. Passing in a sequence of `Int` or `Slice` returns an `NDArray`. Passing in an `Idx` returns a scalar. Allow users to set a multiple items in one `NDArray` with another `NDArray`, using `__set__` (PR #118 by @shivasankarka, Discussion #70).
28
+
29
+
### ❌ Removed
30
+
31
+
- Removed all instances of getters and setters with `List[Int]`, `VariadicList[Int]` (PR #118 by @shivasankarka).
32
+
33
+
### 🛠️ Fixed
34
+
35
+
- Fix the issues in parallelization (due to Max 24.5) for some linear algebra functions, e.g, `matmul`, `solve`, `inv`, etc (PR #115#117 by @forFudan).
36
+
37
+
### 📚 Documentary and testing
38
+
39
+
- Add workflows with unit tests and linting (PR #95 by @sandstromviktor).
40
+
- Add multi-lingual support (Chinese, Japanese) for the readme file (PR #99#120 by @forFudan, PR #100 by @shivasankarka).
41
+
- Update the test flow file to accommodate MAX 24.5 and the `magic` system (PR #116 by @forFudan).
42
+
43
+
## 17/08/2024 (V0.2)
44
+
45
+
### ⭐️ New
46
+
47
+
Array operations:
48
+
49
+
- Introduced `diagflat()` method for creating diagonal arrays
50
+
- Implemented most basic array creation routines
51
+
- Implemented initializer from string `numojo.NDArray("[[1,2,3],[4,5,6]]")`
52
+
- Enhanced `NDArray` constructor methods
53
+
- Added boolean masking for NDArrays
54
+
- Introduced new mathematical methods: `floordiv`, `mod`, and more
55
+
-`__getitem__` and `__setitem__` now fully compatible with NumPy behavior
56
+
57
+
Others:
58
+
59
+
- Introduced Rust-like data type aliases (e.g., `DType.float64` → `f64`)
60
+
- Implemented function overloading for core mathematical operations (add, sub, etc.)
61
+
- Added a new differentiation module
62
+
63
+
### 🦋 Changed
64
+
65
+
- Improved slicing functionality to match NumPy behavior
66
+
67
+
### ❌ Removed
68
+
69
+
- Removed `in_dtype` and `out_dtype` parameters for simplified type handling
70
+
71
+
### 📚 Documentatory and testing
72
+
73
+
Documentation updates:
74
+
75
+
- Expanded and updated README
76
+
- Improved docstrings for functions
77
+
- Added style guide and examples
78
+
79
+
Testing updates:
80
+
81
+
- Introduced new test files that are compatible with `mojo test`.
0 commit comments