All pastes #728739 Raw Edit

Anonymous

public text v1 · immutable
·published 2007-10-07 09:39 UTC
rendered paste body
    private double metodoMontante(double[][] a, double pa) {
    Pivote p = new Pivote(a);
    int fp = p.getX();
    int cp = p.getY();
    if (a.length == 2) {
      int i, j;
      if (fp == cp) 
        i = j = (fp == 0) ? 1 : 0;
      else {
        i = cp; 
        j = fp;
      }
      return transformaElemento(p.getValue(), a[i][j], 
                a[i][fp], a[cp][j], pa);
    }
    double[][] nmat = new double[a.length-1][a.length-1];
    int x = 0, y = 0;
    for (int i = 0; i < a.length; i++) {
      if (i == fp) continue;
      for (int j = 0; j < a[0].length; j++) {
        if (j == cp) continue;
        nmat[x][y++] = transformaElemento(p.getValue(), a[i][j],
                        a[i][fp], a[cp][j], pa);
      }
      ++x; y = 0;
    }
    return metodoMontante(nmat, p.getValue());
  }