Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Matrix extractMinor(int riga, int colonna) {
- if (this.isSquared()) {
- Matrix minore = new Matrix(this.getRows() - 1, this.getCols() - 1);
- int r = 0, c = 0;
- for (int i = 0; i < this.getRows(); ++i) {
- if (i != riga) {
- for (int j = 0; j < this.getCols(); ++j) {
- if (j != colonna) {
- minore.setValue(r, c, this.getValue(i, j));
- c++;
- }
- }
- ++r;
- }
- }
- return minore;
- } else
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement