Finished root finding function for qrd.cu and qrdriver.m.