added function 'residulaMatrix'
minor style