matrix diagrams