matrices code