use matrix dict