Add Matrix layout

Closes #299