move invert method to matrix class template, remove redundant file