Releases: Mojo-Numerics-and-Algorithms-group/NuMojo
Releases · Mojo-Numerics-and-Algorithms-group/NuMojo
NuMojo v0.5 for Mojo 24.6
26/01/2025 (v0.5)
⭐️ New
- Add support for complex arrays
ComplexNDArray
,ComplexSIMD
,CDType
(PR #165). Add creation routines for complex arrays (PR #195). - Add
TypeCoercion
struct that calculates the resultant type based on two initial data types. Apply type coercion to math functions (PR #164, PR #189). - Add
OwnData
type as container of data buffer forNDArray
andMatrix
. The property_buf
is changed fromUnsafePointer
toOwnData
. IntroducedRefData
struct andBufferable
trait. This step prepares for future support of array views and facilitates an easy transition once parameterized traits are integrated into Mojo (PR #175, PR #170, PR #178). - Add
NDIter
type as a iterator over the array items according to a certain memory layout. UseNDArray.nditer()
to construct the iterator (PR #188). - Add an additional data type mapping for
NDArray.to_numpy
, i.e.,DType.index
is mapped tonumpy.intp
(PR #157). - Add method
NDArray.resize
that reshapes the array in-place (PR #158). - Add a new property
flags
forNDArray
andMatrix
to store memory layout of the array, e.g., c-continuous, f-continuous, own data. The memory layout is determined by both strides and shape of the array (PR #170, PR #178). - Add functions
to_tensor
andfrom_tensor
(also an overload ofarray
) that convert betweenNDArray
and MAXTensor
(Issue #183, PR #184). - Add several functions for linear algebra:
🦋 Changed
- Update several methods of
NDArray
type:- Make
load
andstore
methods safer by imposing boundary checks. Renameget
asload
and renameset
asstore
(PR #166). - Update
item
method to allow negative index and conduct boundary checks on that (PR #167). - Update
item
function so that it allows both setting and getting values, e.g.,a.item(1,2)
anda.item(1,2) = 10
(PR #176). - Refine the
__init__
overloads (PR #170).
- Make
- Allow getting items from
NDArray
with a list or array of indices, while the array can be multi-dimensional. Allow getting items fromNDArray
with a list or array of boolean values, while the array can be both one-dimensional or multi-dimensional (PR #180, PR #182). - Rename
Idx
struct asItem
.You can get scalar from array usinga[item(1,2)]
(PR #176). - Update the constructor of the
Item
type to allow passing int-like values in (PR #185). - Integrate
mat
sub-package intocore
androutines
modules, so that users can use a uniformed way to call functions for bothMatrix
andNDArray
types (PR #177). - Update the following functions to allow operation by any axis:
- Update
matmul
to enable multiplication between two arrays of any dimensions (PR #159). - Refine the function
reshape
so that it is working on any dimensions and is working on both row-major and col-major. This also allows us to change the order with the codeA.reshape(A.shape, "F"))
. Also refine functionsflatten
,ravel
(PR #158). - Remove
size
property fromNDArrayShape
and addsize_of_array
method to get the size of the corresponding array (PR #181). - Add
PrintOption
type to customize string representation ofNDArray
,NDArrayShape
,NDArrayStrides
, andItem
, e.g.,str()
,repr()
,print()
. Allow customized separators, paddings, number of items to display, width of formatting, etc, forNDArray._array_to_string
method. Auto-adjust width of formatted values and auto-determine wether scientific notations are needed (PR #185, PR #186, PR #190, PR #191, PR #192). - Rename the auxiliary function
_get_index
as_get_offset
(PR #173). - Rename the underlying buffer of
Idx
type to_buf
(PR #173). - Return a view instead of copy for iterator of
NDArray
(PR #174).
❌ Removed
- Remove
order
property anddatatype
property fromNDArray
. You can usea.flags
anda.dtype
instead (PR #170). - Remove the property
coefficient
ofNDArray
type (PR #166). - Remove
offset
property from theNDArrayStrides
type (PR #173).
🛠️ Fixed
- Removes
mut
keyword beforeself
fromNDArray.__add__
. - The methods
get
andset
ofNDArray
does not check against big negative index values and this leads to overflows. This is fixed (PR #162). - Fix
__setitem__
method so that it can read in variant of int and slices, e.g.,a[0, Slice(2, 4)] = a[3, Slice(0, 2)]
(PR #176).
📚 Documentatory and testing
- Add
readthedocs
pages to the repo under/docs/readthedocs
(PR #194). - Add
magic run t
,magic run f
, andmagic run p
for the magic CLI. They first clear the terminal before runningtest
,final
, andpackage
. - Allow partial testing via command, e.g.,
magic run test_creation
, to avoid overheat. - Convert the readme file into pure markdown syntax (PR #187).
NuMojo v0.4 for Mojo 24.6
What's Changed
- [update][routines] Update
argsort
function to allow sorting by any axis by @forFudan in #157 - [update][manipulation routines] Refine functions
reshape
,resize
,flatten
,ravel
by @forFudan in #158 - [update][linalg] Update
matmul
to enable any dimensional arrays (n>0) by @forFudan in #159 - [fix][math routines] Allow
cumsum
andcumprod
by any axis by @forFudan in #160 - [fix][ndarray] Fix overflow due to negative
index
argument forget
andset
ofNDArray
by @forFudan in #162 - [update][manipulation] Allow
flip
by any axis by @forFudan in #163 - [update][core] Update several methods of
NDArray
type by @forFudan in #166 - [new][core] Type Coercions in Arithmetic dunder methods by @shivasankarka in #164
- [update][core] Update
item
method by @forFudan in #167 - [core][ndarray]
flags
replacesorder
property. Remove ...
NuMojo v0.4 for Mojo 24.6
This is a list of RELEASED changes for the NuMojo Package.
22/12/2024 (v0.4)
⭐️ New
- Implement a static-sized 2D Array type (
Matrix
type) innumojo.mat
sub-package.Matrix
is a special case ofNDArray
but has been optimized since the number of dimensions is known at the compile time. It is useful when users only want to work with 2-dimensional arrays. The indexing and slicing is also more consistent withnumpy
(PR #138, PR #141, PR #141). It provides:Matrix
type (2D array) with basic dunder methods and core methods.- Function to construct
Matrix
from other data objects, e.g.,List
,NDArray
,String
, andnumpy
array. - Arithmetic functions for item-wise calculation and broadcasting.
- Linear algebra: matrix mutiplication, decomposition, inverse of matrix, solve of linear system, Ordinary Least Square, etc.
- Auxilliary types, e.g.,
_MatrixIter
.
- Implement more the array creation routines from numpy and expand the NuMojo array creation functionality (PR #137).
- Add
convolve2d
and in thescience.signal
module (PR #135). - Add more detailed error messages for
NDArray
type (PR #140).
🦋 Changed
- Adapt the code to the latest update of Mojo to V24.6 (PR #148).
Slice.step
is now returningOptional[int]
. Thus, it is fixed by usingSlice.step.else_to(1)
.Formattable
is now renamed toWritable
(same applies towrite_to
andstring.write
).width
is now inferred from the SIMD's width. So this parameter must be removed when we callUnSafePointer
'sload
andstore
methods. Due to this, the functionfill_pointer
, which fill in a width of array with a scale, no longer work. It is replaced by copying with loop.Lifetime
is renamed asOrigin
(same applies to the function__origin_of
).inout
is renamed asmut
.
- Rename the data buffer from
data
to_buf
(PR #136, PR #137) - To make
matmul
flexible for different shapes of input arrays (PR #137). - Change the way to get the shape of the array:
array.shape
returns the shape of array asNDArrayShape
(PR #137). - The array creation functions are unified in such a way (PR #139).
NDAarray.__init__()
reads in shape information and initializes an empty ndarray.- All other creation routines are implemented by the functions in the
array_creation_routine
module. For example, to create an array with filled value, the functionfull
should be used. To create an array from a list, the functionarray
should be used.
- Re-organize the functions and modules by topic, so that it is more consistent with
numpy
(Issue 144, PR #146). - Rename some attributes of
NDArray
and makesize
an attribute instead of a method (PR #145). - Completely remove
import *
in init files to fix namespace leak (PR #151). - Update function
sum
(PR #149). transpose
now allows arbitrary dimensions and permutations of axes (PR #152).- Change buffer type of
NDArrayShape
andNDArrayStrides
toInt
(PR #153). sort
now allows sorting by any axis for high dimensional arrays (PR #154).
❌ Removed
- Temporarily removed negative indexing support in slices since it causes error. Will add just feature in later updates (PR #133).
- Remove
inout
beforeself
forNDArray.__getitem__
(PR #137).
🛠️ Fixed
- Fixed and rewrote the
adjust_slice
function that was causing errors (PR #133). - There is an error in fromstring that the negative signs are not read. It is fixed. Now a valid numeric should start with a digit, a dot, or a hyhen (PR #134).
📚 Documentary and testing
NuMojo v0.3.1 for Mojo 24.5
NuMojo v0.3 for Mojo 24.5
NuMojo released changelog
This is a list of RELEASED changes for the NuMojo Package.
14/10/2024 (v0.3)
⭐️ New
- Add support for
magic
system and MAX 24.5 (PR #91 #109 by @shivasankarka). - Add some basic functions, e.g.,
diagflat
,tri
,trace
,T
(PR #91 by @shivasankarka). - Add a constructor which reads arrays from numpy arrays (PR #91 by @shivasankarka).
- Add functions
solve
andinv
for solving linear algebraAX = Y
forX
, finding inverse of a matrix, and conducting LU decomposition (PR #101 #104 #105 by @forFudan). - Add
itemset
method to fill a scalar into anNDArray
(PR #102 by @forFudan). - Add
Idx
struct to represent the index of anNDArray
(PR #118 by @shivasankarka). - Add NDArray initialization from numpy arrays (PR #118 by @shivasankarka).
- Created a new
io
module with some basic functions, e.g.,format_float_scientific
,loadtxt
,savetxt
(PR #118 by @shivasankarka).
🦋 Changed
- Make some methods, e.g.,
sort
,flatten
,inplace
(Issue #87 by @mmenendezg, PR #91 by @shivasankarka). - Modify initialization of NDArray (PR #97 by @MadAlex1997)
- Added
Formattable
trait and fixed theprint
function (PR #108 by @shivasankarka) - Refine the
NDArray
initializers and array creation routines (Discussion #90, Issue #110).- Remove
random
argument fromNDArray
constructors. Make random initializer a standalone functions (Issue #96 by @MadAlex1997, PR #97 by @MadAlex1997, PR #98 by @shivasankarka). - Remove initializers from
String
. Makefromstring
a standalone function (#113 by @forFudan). - Add several
array
overloads for initializingNDArray
(PR #118 by @shivasankarka).
- Remove
- Modify the behavior of
__get__
and__set__
. Passing in a sequence ofInt
orSlice
returns anNDArray
. Passing in anIdx
returns a scalar. Allow users to set a multiple items in oneNDArray
with anotherNDArray
, using__set__
(PR #118 by @shivasankarka, Discussion #70).
❌ Removed
- Removed all instances of getters and setters with
List[Int]
,VariadicList[Int]
(PR #118 by @shivasankarka).
🛠️ Fixed
- 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).
📚 Documentary and testing
- Add workflows with unit tests and linting (PR #95 by @sandstromviktor).
- Add multi-lingual support (Chinese, Japanese) for the readme file (PR #99 #120 by @forFudan, PR #100 by @shivasankarka).
- Update the test flow file to accommodate MAX 24.5 and the
magic
system (PR #116 by @forFudan).
17/08/2024 (V0.2)
⭐️ New
Array operations:
- Introduced
diagflat()
method for creating diagonal arrays - Implemented most basic array creation routines
- Implemented initializer from string
numojo.NDArray("[[1,2,3],[4,5,6]]")
- Enhanced
NDArray
constructor methods - Added boolean masking for NDArrays
- Introduced new mathematical methods:
floordiv
,mod
, and more __getitem__
and__setitem__
now fully compatible with NumPy behavior
Others:
- Introduced Rust-like data type aliases (e.g.,
DType.float64
→f64
) - Implemented function overloading for core mathematical operations (add, sub, etc.)
- Added a new differentiation module
🦋 Changed
- Improved slicing functionality to match NumPy behavior
❌ Removed
- Removed
in_dtype
andout_dtype
parameters for simplified type handling
📚 Documentatory and testing
Documentation updates:
- Expanded and updated README
- Improved docstrings for functions
- Added style guide and examples
Testing updates:
- Introduced new test files that are compatible with
mojo test
.
Contributors
NuMojo V0.2
NuMojo V0.2 Release Notes
Major Changes
- Removed
in_dtype
andout_dtype
parameters for simplified type handling - Introduced Rust-like data type aliases (e.g.,
DType.float64
→f64
) - Implemented function overloading for core mathematical operations (add, sub, etc.)
- Added a new differentiation module
New Features
Array Operations
- Introduced
diagflat()
method for creating diagonal arrays - Implemented most basic array creation routines
- Implemented initializer from string
numojo.NDArray("[[1,2,3],[4,5,6]]")
- Enhanced
NDArray
constructor methods - Improved slicing functionality to match NumPy behavior
- Added boolean masking for NDArrays
- Introduced new mathematical methods:
floordiv
,mod
, and more __getitem__
and__setitem__
now fully compatible with NumPy behavior
Documentation Updates
- Expanded and updated README
- Improved docstrings for functions
- Added style guide and examples
Testing
- Introduced new test files that are compatible with
mojo test
.
Compatibility
- Works with Mojo 24.4
- No external dependencies required
Notes
- Binary distributions are not included due to current limitations in Mojo's packaging system
Contributors
New Contributors
- @mmenendezg made their first contribution in #88
Full Changelog: v0.1...v0.2
NuMojo v0.1 for Mojo 24.4
The first tracked version of NuMojo, is compatible with Mojo 24.4. Binaries are not included (Mojo doesn't have a packaging system yet), but no dependencies other than Mojo compiler version 24.4.