fill matrix
global working