Advertisement
Guest User

Untitled

a guest
Mar 24th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public Matrix extractMinor(int riga, int colonna) {
  2.         if (this.isSquared()) {
  3.             Matrix minore = new Matrix(this.getRows() - 1, this.getCols() - 1);
  4.             int r = 0, c = 0;
  5.             for (int i = 0; i < this.getRows(); ++i) {
  6.                 if (i != riga) {
  7.                     for (int j = 0; j < this.getCols(); ++j) {
  8.                         if (j != colonna) {
  9.                             minore.setValue(r, c, this.getValue(i, j));
  10.                             c++;
  11.                         }
  12.                     }
  13.                     c = 0;
  14.                     ++r;
  15.                 }
  16.             }
  17.             return minore;
  18.         } else
  19.             return null;
  20.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement