optimize qr solver