View difference between Paste ID: L3qgwJy8 and tfWgAJtg
SHOW: | | - or go back to the newest paste.
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
	}