masa16 / narray

This repository contains OLD version of NArray. Please visit NEW version =>
https://github.com/ruby-numo/numo-narray
168 stars 28 forks source link

Limit of 16 dimensions to transpose #40

Closed sotoseattle closed 10 years ago

sotoseattle commented 10 years ago

I am not sure if this is an issue so please bear with me.

There seems to be a limit in the number of dimensions that the NArray handles. Specifically, when transposing an NArray of more than 16 dimensions (axes, ranks). To replicate this issue:

require 'NArray'

arr = Array.new(16){1}

na_ok = NArray.float(*arr).random!(1.0)
na_ok.transpose(-1,0) # => works ok

# we now do the same but with one axis more
na_fail = NArray.float(1, *arr).random!(1.0)
na_fail.transpose(-1,0) # => Error in `transpose': rank doublebooking (ArgumentError)

I was able to create NArrays of more than 16 dimensions (only limited to memory constraints). But the transpose operation does not allow more than 16.

masa16 commented 10 years ago

I got rid of dimension limit. Thank you for comment. https://github.com/masa16/narray/commit/6a7d93dc1e666db87659ac14f1cb3c6bb11dd791

sotoseattle commented 10 years ago

Thanks! I am writing some code for probabilistic graphical models and NArray is a godsend.