Have been playing around with Multik this weekend ...
# mathematics
p
Have been playing around with Multik this weekend and have to say nice performance out of the box (I’m using the JVM version only). One thing I couldn’t figure out how to efficiently copy/set data. What I want to do in a matrix (D2Array<Float>) is to move the last x rows to the first x rows. I use a “hack”, but I feel this is not very elegantly:
Copy code
data = data[rows-x until rows].cat(mk.zeros(rows-x, columns))
Does anyone knows a better way of doing this (performance is key) ?
a
r
сс @Pavel Gorgulov
p
In multik, you can only use set with a smaller dimension and with normal indexing. So for example for a matrix we can do:
data[x] = other[y]
For your case:
Copy code
for (i in 0 until x) {
    if (x + 1 < rows) data[i] = data[x + i]
}
p
Are there any future plans to have something equivalent to the get API (
data[0..100] = data[500..600]
)?
p
Yes, in next release I plan to rework all the internal get/set logic and add missing methods. Unfortunately, next release will not be as soon as I would like(