public static void  qrsolv( double [][] a,   double [] c, double [] d, double [] b)
 {
    int  i, j;
   double   sum, tau;

    int n = a.length;
    for (j = 0;j < n-1; j++) {
        for (sum = 0.0, i = j ; i < n; i++) sum += a[i][j]*b[i];
        tau = sum / c[j];
        for (i = j; i < n; i++ ) b[i] -= tau*a[i][j];
    }
    rsolv(a, d, b);
}