uncomplicate

Nguyen Hoai Nam 2024-05-21T05:57:35.392799Z

Does Neanderthal support higher-dimensional arrays? For example, can I create this 2 × 3 × 4 array using Neanderthal?

[[[1 2 3 4]
  [2 3 4 5]
  [3 4 5 6]]
 [[1 3 5 7]
  [2 4 6 8]
  [3 5 7 9]]]
I only need this for storage and convenience, since I want every entry to be indexable by three numbers, i, j and k. I don’t need tensor math, though—my plan is to slice regular matrices out of it (e.g., all entries with k = 2) and then do the math, so regular matrix multiplication is good enough for me.

2024-05-27T20:15:21.327489Z

Have you tried this: https://cnuernber.github.io/dtype-next/tech.v3.tensor.html This has funtiocn mget to (mget tens x y z & args) and select / slicing which looks like slicing

2024-06-04T10:21:51.173859Z

Neanderthal claims to be very fast, specially because it supports GPU, what dtype-next does not. It runs as well on 'native' BLAS, which should be faster then JVM for some cases. Dtype-next is CPU and pure JVM, which has pros and cons

Nguyen Hoai Nam 2024-05-27T05:33:29.800339Z

Thank you. It seems that deep-diamond doesn’t have any functions for indexing or slicing 3D tensors (e.g., to get a specific entry or a 2D matrix), so it might not suit my use case.

Nguyen Hoai Nam 2024-05-29T01:22:01.427379Z

Thank you. I’ve actually tried both dtype-next and core.matrix, and am using the latter. I was hoping to speed up my matrix math and thought neanderthal would be a good way to do it, but if I have to convert between neanderthal matrices and dtype-next tensors then that might negate any performance benefit.

2024-05-21T15:14:40.102209Z

Not neanderthal as such. There is deep-diamond which supports tensors of any dimension: https://github.com/uncomplicate/deep-diamond

2024-05-21T15:16:08.393769Z

So for math, you would indeed need to "slide" off and go back to naenderthal. Documentation is mainly as tests (or in the book): https://github.com/uncomplicate/deep-diamond/blob/master/test/uncomplicate/diamond/tensor_test.clj