narray icon indicating copy to clipboard operation
narray copied to clipboard

Strange initialization?

Open dim opened this issue 14 years ago • 0 comments

Here's what I try (in an irb console):

ruby-1.9.2-p290 :001 > NArray.int(100,100,100).size
 => 1000000 # OK
ruby-1.9.2-p290 :002 > NArray.int(100,100,100,100).size
 => 100000000 # OK 
ruby-1.9.2-p290 :003 > NArray.int(100,100,100,100,100).size
 => 1410065408 # Seems to be limited to big-int precision
ruby-1.9.2-p290 :004 > NArray.int(100,100,100,100,100,100).size
 => 0 # ???
ruby-1.9.2-p290 :005 > NArray.int(100,100,100,100,100,100,1000).size
 => 0 # Ok, now I assume I can give up ... but ...
ruby-1.9.2-p290 :006 > NArray.int(100,100,100,100,100,100,100).size
 => 276447232 # Works with 7 dimensions, but limits to int precision???
ruby-1.9.2-p290 :007 > NArray.int(100,100,100,100,100,100,100,100).size
NoMemoryError: negative allocation size (or too big)
    from (irb):14:in `int'
    from (irb):14
    from /home/dim/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>'
ruby-1.9.2-p290 :008 > NArray.int(100,100,100,100,100,100,100,100,100).size
 => 0 

Any idea? Many thanks!

dim avatar Aug 26 '11 10:08 dim