ruby-numo / numo-narray

Ruby/Numo::NArray - New NArray class library
http://ruby-numo.github.io/narray/
BSD 3-Clause "New" or "Revised" License
415 stars 41 forks source link

stack level too deep (SystemStackError) #139

Closed ankane closed 5 years ago

ankane commented 5 years ago

Hi, thanks for this awesome project 👍

When converting a large Ruby array to a Numo::NArray, I get stack level too deep (SystemStackError). It happens around 200,000 elements on my machine. Code to reproduce:

arr = [0] * 1_000_000
Numo::UInt8[*arr]

Is there a better way to do this?

masa16 commented 5 years ago

Numo::UInt8.cast(arr)

ankane commented 5 years ago

Awesome, thanks @masa16 👍