added a function that converts dictionary to matrix