NuMojo’s got NDArrays! 🥳
NuMojo has just released v0.1 adding many new features the largest of which is an N dimensional array type completely independent of
* Native Vectorization of arithmetic dunder operations
* Indexing with both integers and Slices (though mixed requires using
*
* A few different
* Basic integration
* A few of the array creation routines from numpy:
* Some Sorting functions:
Our math functions were all migrated to NDArray, and a new
For those of you who are new to NuMojo
Example: The following calculates the square root of an array from 0 to 99, reshaped to 10x10, vectorized, and parallelized with 8 workers.
Tensor. Our NDArray has many features including* Native Vectorization of arithmetic dunder operations
+,-.*./ etc.* Indexing with both integers and Slices (though mixed requires using
Slice explicitly due to Mojo parser limitations).*
sum, mean, stdev both on axis and cumulative.* A few different
matmul implementations.* Basic integration
trapz.* A few of the array creation routines from numpy:
arange, ones, zeros, identity.* Some Sorting functions:
bubble_sort, quick_sort,and quick_sort_inplace.Our math functions were all migrated to NDArray, and a new
Backend was added. VectorizedParallelizedNWorkers which allows the number of workers to be set as a parameter. I have found that setting the number of workers to between half, and three-quarters of the total number of cores provides a speed-up where default parallelization caused a slowdown (on WSL).For those of you who are new to NuMojo
Backend is a trait that defines how calculations get carried out for many of the functions in our math module. The default is Vectorized which uses SIMD vectorization. In the future, all numojo functions and data types will implement backends to enable easy switching between computational methods and eventually even hardware accelerators such as GPUs.Example: The following calculates the square root of an array from 0 to 99, reshaped to 10x10, vectorized, and parallelized with 8 workers.
GitHub
NuMojo is a library for numerical computing in Mojo
similar to numpy in Python. - Mojo-Numerics-and-Algorithms-group/NuMojo
