If you need to only create 3d-array, you do not need library for that, just add a function, creating it:
fun array3D(dim1: Int, dim2: Int, dim3: Int, def: (Int,Int,Int) -> Double = {_,_,_ ->0.0})
: Array<Array<Array<Double>>>{
return Array(dim1){ i ->
Array(dim2){ j ->
Array(dim3){ k -> def(i, j, k) }
}
}
}
For larger ndarrays, I would not recommend using java arrays due to memory allocation issues and cumbersome kotlin treatment of multi-dimensional arrays.
I think, it is time to seriously start developing kotlin math extension library. I’ve initialized the repository and will shortly move my existing code there. I currently have a very tight schedule, so I will welcome any help with the project.