Multik 0.1 Is Out
Introducing Multik 0.1 – a new, enhanced version of our multidimensional array library! You can check out the previous post to learn about the basic features and architecture of the library.
In the new release, we added new methods from linear algebra, supported complex numbers and reading/writing .csv files, improved the performance and stability of existing functions, and added many more features that will make it easier for you to work with multidimensional arrays.
Let’s take a look at the new features this release brings to the API:
- Reading and writing CSV files
- Complex numbers
- LU factorization
- Solving linear systems
- Inverse matrix
- QR factorization
- Eigenvalues and eigenvectors
- Append, stack, and meshgrid
Reading and writing CSV files
CSV is a popular data recording format, and now Multik 0.1 allows you to read and write .csv files easily.
Complex numbers are expressed as
re + i ∙ im, where
im are real numbers and
i is the imaginary unit equal to the square root of -1;
re is the real part of the complex number and
i ∙ im is the imaginary part. Complex numbers are common in algebra and are now a part of the Multik API.
The ComplexFloat and ComplexDouble classes are created in full accordance with the Number classes, so there is no need to learn a new API.
We’ve also added ComplexFloatArrays and ComplexDoubleArrays. They support all methods that primitive arrays do, except for methods that use comparison, since complex numbers are unordered. But you can use methods such as
sortedBy, and others to define the comparison logic yourself.
After supporting complex numbers and arrays of complex numbers, we added them to multidimensional arrays.
You can do everything with them that you did with integer and float multidimensional arrays before.
We still have several open tasks for complex numbers. You can participate in the development of the library and become a contributor.
LU factorization, or lower-upper decomposition, represents a matrix as the product of a permutation matrix, a lower triangular matrix, and an upper triangular matrix:
A = P ✕ L ✕ U.
We have Introduced this in Multik.
Solving linear systems
Solving systems of linear equations is a common problem encountered in algebra. With PLU factorization, we can easily solve square linear systems. To do this, we have provided a corresponding method in
The inverse matrix of a square matrix
A-1, is such that the following equality holds:
A ✕ A-1 = A-1 ✕ A = I, where I is the square identity matrix. If
A-1 is nonsingular, then it can be calculated by solving the above expression. For convenience, we have added this method out of the box.
Another important decomposition is QR decomposition. We can decompose any square matrix A as a product Q ✕ R, where Q is an orthogonal matrix and R is an upper triangular matrix.
Eigenvalues and eigenvectors
Based on the QR decomposition, we’ve made it possible to calculate eigenvalues and eigenvectors with Multik.
Append, stack, and meshgrid
In this release, we have added functions to help you work with multidimensional arrays more easily.
For example, you can use the
append function to concatenate an array with scalars and other arrays. We’re grateful to our contributor Ansh Tyagi for implementing this feature.
Append can also be used along the ndarray axes, which then becomes equivalent to
stack allows arrays to be concatenated along a new axis.
meshgrid allows you to get a grid of coordinates from vectors.
For more details about this new release, please check out the changelog.
We want to thank our users and contributors – you help us improve the library and make it more reliable and convenient!
To use Multik in your project, add the following dependencies to your
You can use different engines, not just the default. We have
multik-jvm. Please note that on Android we only support the JVM engine.
Alternatively, you can start using Multik in Jupyter or Datalore:
If you don’t have the kotlin-kernel for Jupyter, you can read about installation here. In Datalore, everything works out of the box.
We’re looking for contributions from the community, so please don’t hesitate to join the effort! Current tasks can always be found in the issue tracker.
Try out Multik 0.1 and share your experience with us!
Subscribe to Blog updates
Thanks, we've got you!