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. Removedatatype
property. by @forFudan in #170 - [routines][linalg] Add
det
function and auxiliary partial pilot by @forFudan in #171 - [matrix][linalg] Add Householder-based QR decomposition by @durnwalder in #172
- [core][strides][Idx] Remove
offset
property from theStrides
type and more by @forFudan in #173 - [ndarray][iterator] Return view instead of copy for iterator of
NDArray
by @forFudan in #174 - [ndarray][data buffer] Add
OwnData
as container of data buffer by @forFudan in #175 - [new][core] add support for complex arrays
ComplexNDArray
,ComplexSIMD
,CDType
by @shivasankarka in #165 - [core][ndarray]
Idx
->Item
, fix__setitem__
with variant by @forFudan in #176 - [core][matrix] Integrate
mat
sub-package intocore
androutines
by @forFudan in #177 - [Matrix][NDArray] Change data buffer of
Matrix
toOwnData
and betterflags
by @forFudan in #178 - [ndarray]
__getitem__
from list of ints and bools for arbitrary dimension by @forFudan in #180 - [shape] Update
NDArrayShape
, makingsize
a method by @forFudan in #181 - [ndarray] Allows
getitem
by indices array and mask array of higher dimensions by @forFudan in #182 - [ndarray][utility] Add
to_tensor
andfrom_tensor
that convert between array and tensor by @forFudan in #184 - [core][item] Update
Item
type to allow generic int-like values +repr
method by @forFudan in #185 - Temporarily convert README to all Markdown by @carolinefrasca in #187
- [ndarray] Better string presentation and print for
NDArray
by @forFudan in #186 - [ndarray][nditer] Add
NDIter
struct to iterate items inNDArray
+ addcopy
method by @forFudan in #188 - [ComplexNDArray][NDArray] New features in
NDArray
&ComplexNDArray
+TypeCoercions
to math functions by @shivasankarka in #189 - [io][formatting] Add
PrintOptions
to define behaviors of printing arrays by @shivasankarka in #190 - [formatting] Auto-adjusted width of formatted values during
print
by @forFudan in #191 - Update version in init.mojo by @MadAlex1997 in #193
- [io][formatting] Corrected scientific formatting and do this when
formatted_width > 14
by @forFudan in #192 - [doc] Set up ReadTheDocs page generation for the numojo website by @MadAlex1997 in #194
- [Creation routines][ComplexNDArray] Implementing basic creation routines for
ComplexNDArray
by @shivasankarka in #195 - [doc] Update changelog for release of v0.5 by @forFudan in #161
- [Update] Updated README by @shivasankarka in #196
- [doc] Add
gitattributes
file to avoid comparing auto-generated files + update toml by @forFudan in #198 - [release] Merge
pre-0.5
branch tomain
branch for release by @MadAlex1997 in #197
New Contributors
- @durnwalder made their first contribution in #172
- @carolinefrasca made their first contribution in #187
Full Changelog: v0.4...v0.5