public void solve(final double[] b, final double[] x) {
    int i,k;
    double sum;
    if (b.length != n || x.length != n) throw new IllegalArgumentException("bad lengths in Cholesky");
    for (i=0;i<n;i++) {
      for (sum=b[i],k=i-1;k>=0;k--) sum -= el[i][k]*x[k];
      x[i]=sum/el[i][i];
    }
    for (i=n-1;i>=0;i--) {
      for (sum=x[i],k=i+1;k<n;k++) sum -= el[k][i]*x[k];
      x[i]=sum/el[i][i];
    }   
  }