Partial implementation of mat class