Design metadata and type hierarchy to capture matrix types and design for optimization (operator elision and rewrite rules)