@Override
	public double determinant() throws IncompatibleOperandException {
		//determinantu je moguće izračunati kod kvadratnih matrica
		//ukoliko treba podržati i za ne kvadratne, poogledati Penrose-Mooreov
		//pseudoinverz
		if (this.getColsCount() != this.getRowsCount()) {
			throw new IncompatibleOperandException(
					"Determinant of nonquadratic matrix in incomputable.");
		}
		
		//iskoristi memoizaciju
		if (this.getColsCount() == 1) {
			return this.get(0, 0);
		}
		if (this.getColsCount() == 2) {
			return this.get(0,0)*this.get(1,1) - this.get(1,0)*this.get(0,1);
		}
		double determinant = 0;
		for (int i = 0; i < this.getColsCount(); i++) {
			double factor = 
					this.get(0, i)*new MatrixSubMatrixView(this, 0, i).determinant();
			factor = i%2==0 ? factor : -1*factor;
			determinant += factor;
		}
		return determinant;
	}