From: Robert Klemme Date: 2011-10-26T16:16:19+09:00 Subject: Re: multi dimension array On Wed, Oct 26, 2011 at 9:13 AM, Robert Klemme wrote: > On Tue, Oct 25, 2011 at 10:40 PM, juman s. wrote: >> a=[["doc1",["hi","bye","guy"],[],[],[]],["doc2",["bye","now","is","hi","hi","hi"],[],[],[]],["doc3",["bye","now","is","hi","hi","hi","why","go","guy"],[],[],[]]] >> >> i have this array i'd like to multiply the 2nd inner array with the 3rd >> inner array and fill the 4th inner array with these results but i don't >> know how to do it. by the way the 2nd and the third inner array are of >> type float. >> anybody ca help please? >> and thanks in advance:) >> >> a.each{ >>   |x| >>    x.each{ >>     |y| >>        y.each{  #i have the error in here >> >>        } >> >> >>  } >> } >> >> and the error is >> tester.rb:50: undefined method `each' for 1:Fixnum (NoMethodError) >>  from tester.rb:48:in `each' >>  from tester.rb:48 >>  from tester.rb:46:in `each' >>  from tester.rb:46 > > Why not use any of these: http://raa.ruby-lang.org/search.rhtml?search=matrix ? PS: And there's also http://rdoc.info/stdlib/matrix/1.9.2/frames in the standard library. For fast math there's also narray gem. Cheers robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/