From: "v.srikrishnan@..." Date: 2006-09-12T02:15:32+09:00 Subject: Re: Matrix Thanks everyone. I had seen the same answers in the post i mentioned (2-3 yrs now i think). i was wondering why these small things had not been added. In my humble opinion having these small things in the basic Matrix class would be helpful to beginners. I do not say that the basic class should have numerical stuff like SVD, LU decomposition or other linear algebra stuff etc. but these things would help. Also,if someone wants to "freeze" a matrix i think ruby has an operation for it(am learning ruby). Thanks again krishnan Paul Lutus wrote: > v.srikrishnan@gmail.com wrote: > > > Hi all, > > a) Is there a way to create a non-square matrix in ruby? > > Another poster has answered this one. > > > b) How does one set any arbitrary element of an array? > > Like this: > > ------------------------------------------- > > #! /usr/bin/ruby > > size = 9 > > # create, preset value > > array = Array.new(size) { Array.new(size) {"."} } > > # change one value > > array[4][4] = '*' > > # show it > > array.each do |b| > b.each do |i| > print b[i] > end > puts "" > end > > Output: > > ......... > ......... > ......... > ......... > ....*.... > ......... > ......... > ......... > ......... > > -- > Paul Lutus > http://www.arachnoid.com