Sorry all, I actually checked for a matrix class, but I must have missed
it (. Anyway, what I would be interested in is how you would approach the
problem WITHOUT using the matrix class.

db

On Thu, Aug 01, 2002 at 01:39:16AM +0900, Ville Mattila wrote:
> Daniel Bretoi <lists / debonair.net> writes:
> 
> > Hi all,
> > 
> > 	I'd like to see the various solutions for coming up with code to
> > 	transpose a matrix. ie. make 
> > 
> > 	a = [[1,2],[1,3],[2,4]]
> > 
> > 	look like
> > 
> > 	aT = [[1,1,2],[2,3,4]]
> > 
> > 	I haven't had time to do a solution myself, but I think it would be
> > 	interesting to see how some of you guys would tackle it while I
> > 	derive something.
> 
> irb
> irb(main):001:0> require 'matrix'
> true
> irb(main):002:0> foo = Matrix[ [1,2],[1,3],[2,4]]
> Matrix[[1, 2], [1, 3], [2, 4]]
> irb(main):003:0> foo.transpose
> Matrix[[1, 1, 2], [2, 3, 4]]
> irb(main):004:0>
> 
>         That wasn't so hard.
> 
>  - Ville

-- 
"Then we typed the G, and the  system crashed"...