# Multik: Multidimensional Arrays in Kotlin

A lot of data-heavy tasks, as well as optimization problems, boil down to performing computations over multidimensional arrays. Today we’d like to share with you the first preview of a library that aims to serve as a foundation for such computations – Multik.

Multik offers both multidimensional array data structures and implementations of mathematical operations over them. The library has a simple and straightforward API and offers optimized performance.

## Using Multik

Without further ado, here are some of the things you can do with Multik.

### Create multidimensional arrays

Create a vector:

Create a vector from a collection:

Create a matrix (two-dimensional array):

Create a fixed-shape array of zeros:

Create an identity matrix (ones on the diagonal, the rest is set to 0)

Create a 3-dimensional array (multik supports up to 4 dimensions):

### Perform mathematical operations over multidimensional arrays

### Element-wise mathematical operations

### Aggregate functions

### Iterable operations

### Indexing/Slicing/Iterating

## Multik Architecture

Initially, we attempted to add Kotlin bindings to existing solutions, such as NumPy. However, this proved cumbersome and introduced unnecessary environmental complexity while providing little benefit to justify the overhead. As a result, we have abandoned that approach and started Multik from scratch.

In Multik, the data structures are separate from the implementation of operations over them, and you need to add them as individual dependencies to your project. This approach gives you a consistent API no matter what implementation you decide to use in your project. So what are these different implementations?

Currently, there are three different ones:

`multik-jvm`

: a Kotlin/JVM implementation of the math operations.`multik-native`

: a C++ implementation. OpenBLAS is used for linear algebra.`multik-default`

: the default implementation, which combines native and JVM implementations for optimal performance.

You can also write your own!

Multik is still in the early stages of development, and we are looking forward to your feedback, feature requests, and contributions! Check out the project’s GitHub repo, try Multik, and let us know what you’d like to see in future versions. Thanks!