Implement matrix types.