Name: Anonymous 2011-12-23 0:08
Alright /proglodites/, let's hear how all of you implement a sparse arrays that stores two-dimensional data.
def (SparseMatrix = Hash.dup).new(h); h.default = 0; h; end
# example:
sm = SparseMatrix.new( [1, 2] => 4.14, [-1, 0] => 6.23 )
p sm[[1, 2]], sm[[3, 5]]