Refactoring QuadraticForm into QuadraticFormMatrix