optimized QR algorim