Rewrite creation of displacement matrix