private void inverse(double[] rinv,int nreq){
  int pos=nreq * (nreq - 1) / 2 - 1;
  int pos1=-1;
  int pos2=-1;
  double total=0.0;
  Arrays.fill(rinv,Double.NaN);
  for (int row=nreq - 1; row > 0; --row) {
    if (!this.lindep[row]) {
      final int start=(row - 1) * (nvars + nvars - row) / 2;
      for (int col=nreq; col > row; --col) {
        pos1=start;
        pos2=pos;
        total=0.0;
        for (int k=row; k < col - 1; k++) {
          pos2+=nreq - k - 1;
          if (!this.lindep[k]) {
            total+=-r[pos1] * rinv[pos2];
          }
          ++pos1;
        }
        rinv[pos]=total - r[pos1];
        --pos;
      }
    }
 else {
      pos-=nreq - row;
    }
  }
}

private void inverse ( double [ ] rinv , int nreq ) { int pos = nreq * ( nreq - 1 ) / 2 - 1 ; int pos1 = - 1 ; int pos2 = - 1 ; double total = 0.0 ; Arrays . fill ( rinv , Double . NaN ) ; for ( int row = nreq - 1 ; row > 0 ; -- row ) { if ( ! this . lindep [ row ] ) { final int start = ( row - 1 ) * ( nvars + nvars - row ) / 2 ; for ( int col = nreq ; col > row ; -- col ) { pos1 = start ; pos2 = pos ; total = 0.0 ; for ( int k = row ; k < col - 1 ; k ++ ) { pos2 += nreq - k - 1 ; if ( ! this . lindep [ k ] ) { total += - r [ pos1 ] * rinv [ pos2 ] ; } ++ pos1 ; } rinv [ pos ] = total - r [ pos1 ] ; -- pos ; } } else { pos -= nreq - row ; } } }
this internal method calculates the inverse of the upper - triangular portion of the r matrix .
