require "algebra"
a = Map[0=>2, 1=>2, 2=>0]
b = Map[0=>1, 1=>1, 2=>1]
p a * b #=> {0=>2, 1=>2, 2=>2}


syntax highlighted by Code2HTML, v. 0.9.1