add optimization flags to build
Simplified output functors

Abstracted a common output functor pattern to a base class to reduce boilerplate
Utility functions for common matrices
Combination base class and simplified traversal