Added function map for matrix