public void solve(final double[] b, final double[] x) {
    int i,j,k,l,mm;
    double dum;
    mm=m1+m2+1;
    l=m1;
    for (k=0;k<n;k++) x[k] = b[k];
    for (k=0;k<n;k++) {
      j=indx[k]-1;
      if (j!=k) {
        swap(x,k,j);
      }
      if (l<n) l++;
      for (j=k+1;j<l;j++) x[j] -= al[k][j-k-1]*x[k];
    }
    l=1;
    for (i=n-1;i>=0;i--) {
      dum=x[i];
      for (k=1;k<l;k++) dum -= au[i][k]*x[k+i];
      x[i]=dum/au[i][0];
      if (l<mm) l++;
    }
  }