Matrix in Ruby

What is the best way to create a matrix whose size is m x n?
The value of m and n may be different, and the values in each cell
should be zeroed.

Can anybody help me?

Sincerely,
Minkoo Seo

I've found it by myself:

a = Matrix[(0..3).map { Array.new(5) }]

Minkoo Seo wrote:

···

What is the best way to create a matrix whose size is m x n?
The value of m and n may be different, and the values in each cell
should be zeroed.

Can anybody help me?

Sincerely,
Minkoo Seo

if you're going to be working with large matrices and doing lots of number
crunching you'll want

   require 'narray'

   a = NArray.int 3, 5

it's on the raa.

cheers.

-a

···

On Sat, 11 Mar 2006, Minkoo Seo wrote:

I've found it by myself:

a = Matrix[(0..3).map { Array.new(5) }]

--
share your knowledge. it's a way to achieve immortality.
- h.h. the 14th dali lama