Skip to content

NuMojo v0.5 for Mojo 24.6

Latest
Compare
Choose a tag to compare
@forFudan forFudan released this 26 Jan 15:12
· 1 commit to main since this release
4229b76

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 for NDArray and Matrix. The property _buf is changed from UnsafePointer to OwnData. Introduced RefData struct and Bufferable 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. Use NDArray.nditer() to construct the iterator (PR #188).
  • Add an additional data type mapping for NDArray.to_numpy, i.e., DType.index is mapped to numpy.intp (PR #157).
  • Add method NDArray.resize that reshapes the array in-place (PR #158).
  • Add a new property flags for NDArray and Matrix 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 and from_tensor (also an overload of array) that convert between NDArray and MAX Tensor (Issue #183, PR #184).
  • Add several functions for linear algebra:
    • Add det function calculating the determinant of array (PR #171).
    • Add Householder-based QR decomposition for matrix (PR #172).

🦋 Changed

  • Update several methods of NDArray type:
    • Make load and store methods safer by imposing boundary checks. Rename get as load and rename set as store (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) and a.item(1,2) = 10 (PR #176).
    • Refine the __init__ overloads (PR #170).
  • Allow getting items from NDArray with a list or array of indices, while the array can be multi-dimensional. Allow getting items from NDArray 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 as Item.You can get scalar from array using a[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 into core and routines modules, so that users can use a uniformed way to call functions for both Matrix and NDArray 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 code A.reshape(A.shape, "F")). Also refine functions flatten, ravel (PR #158).
  • Remove size property from NDArrayShape and add size_of_array method to get the size of the corresponding array (PR #181).
  • Add PrintOption type to customize string representation of NDArray, NDArrayShape, NDArrayStrides, and Item, e.g., str(), repr(), print(). Allow customized separators, paddings, number of items to display, width of formatting, etc, for NDArray._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 and datatype property from NDArray. You can use a.flags and a.dtype instead (PR #170).
  • Remove the property coefficient of NDArray type (PR #166).
  • Remove offset property from the NDArrayStrides type (PR #173).

🛠️ Fixed

  • Removes mut keyword before self from NDArray.__add__.
  • The methods get and set of NDArray 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, and magic run p for the magic CLI. They first clear the terminal before running test,final, and package.
  • 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 and cumprod by any axis by @forFudan in #160
  • [fix][ndarray] Fix overflow due to negative index argument for get and set of NDArray 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 replaces order property. Remove datatype 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 the Strides 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 into core and routines by @forFudan in #177
  • [Matrix][NDArray] Change data buffer of Matrix to OwnData and better flags by @forFudan in #178
  • [ndarray] __getitem__ from list of ints and bools for arbitrary dimension by @forFudan in #180
  • [shape] Update NDArrayShape, making size 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 and from_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 in NDArray + add copy 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 to main branch for release by @MadAlex1997 in #197

New Contributors

Full Changelog: v0.4...v0.5