[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Matrix in Ruby

minkoo.seo@gmail.com

3/11/2006 8:52:00 AM

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

2 Answers

minkoo.seo@gmail.com

3/11/2006 12:25:00 PM

0

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

Ara.T.Howard

3/11/2006 3:15:00 PM

0