Feature diffmat

Closes #994.