fix bug in quadratic optimizer: T.inv is not matrix inverse