NuMojo V0.5 Complex Array, Readthedocs, and More!

NuMojo v0.5 Release: Exciting New Features and Improvements

We’re thrilled to announce the release of NuMojo v0.5, packed with exciting new features, enhancements, and fixes designed to make working with numerical computations in Mojo more efficient and powerful. Below, we’ll dive into the highlights of this release. For more details, be sure to visit our updated documentation site.


:star: New Features

Complex Arrays Support

NuMojo now supports complex number arrays with the introduction of ComplexNDArray, ComplexSIMD, and CDType. This includes creation routines for complex arrays, providing a robust foundation for advanced numerical computations.

Type Coercion in Math Operations

We’ve added a TypeCoercion struct that automatically calculates the resultant type when performing operations between two different data types. Type coercion is now applied across all math functions for seamless operations.

Enhanced Data Buffer Management

The new OwnData type serves as a container for data buffers in NDArray and Matrix, replacing UnsafePointer. This enhancement paves the way for array views and better memory management in the future.

Iterators for Arrays

Introducing NDIter, an iterator for traversing array items based on memory layout. Use NDArray.nditer() to leverage this feature for more flexible data traversal.

Tensor Conversion

Easily convert between NDArray and MAX Tensor using the new to_tensor and from_tensor functions.

Linear Algebra Enhancements

  • Determinant Calculation: Use the det function for matrix determinant calculations.
  • QR Decomposition: Implemented Householder-based QR decomposition for efficient matrix factorization.

:butterfly: Changes and Improvements

Array Manipulation

  • Memory Layout Flags: Added a flags property to NDArray and Matrix, storing details about memory layout (e.g., C-continuous, F-continuous).
  • Reshape Improvements: Refined reshape, resize, flatten, and ravel to work with any dimensions and orders.

Updated Methods

  • Safe load and store: Renamed and enhanced the safety of these methods by adding boundary checks.
  • Advanced Indexing: Expanded support for indexing with lists, multi-dimensional arrays, and boolean masks.

Print Customization

Added PrintOption for controlling string representations of arrays, shapes, and strides, with customizable formatting options.


:x: Deprecated or Removed

  • The order and datatype properties of NDArray have been replaced with the more robust flags and dtype properties.
  • Removed offset and coefficient properties in favor of simplified memory layout management.

:hammer_and_wrench: Fixes

  • Fixed an issue where negative index values caused overflows in get and set methods.
  • Enhanced __setitem__ to handle variants of integers and slices more effectively.

:books: Documentation Updates

We’ve launched our official documentation site! This includes:

  • Comprehensive guides for all NuMojo features.
  • Examples and tutorials for getting started with new APIs.
  • Detailed descriptions of recent changes and enhancements.

We hope you enjoy the new features and improvements in NuMojo v0.5! Don’t forget to explore our documentation for in-depth insights.

5 Likes