changed quad_over_lin to take a matrix first arg