From: Mathieu Bouchard Date: 2006-03-11T13:34:07+09:00 Subject: Re: how to introduce reference objects into ruby On Fri, 10 Mar 2006, Hugh Sasse wrote: > # There may well be a faster way, but you don't need pointers to do > # this. > class Durations > def initialize() > @matrix = Hash.new > end > def insert(i,j,duration) > @matrix[[i,j]] = duration > end If the dim of the matrix is less than 32768 by 32768, replace the [i,j] subscript by 32768*i+j and it'll be faster because it'll be a Fixnum. (note: The biggest Fixnum is 32768**2-1) _ _ __ ___ _____ ________ _____________ _____________________ ... | Mathieu Bouchard - t�l:+1.514.383.3801 - http://artengine.ca/matju | Freelance Digital Arts Engineer, Montr�al QC Canada