public Matrix forwardSubstitution(Matrix b) {
		if(rows != cols) {
			throw new IllegalArgumentException("Matrica nije kvadratna!");
		}
		
		if(b.rows != rows || b.cols != 1) {
			throw new IllegalArgumentException("Krivi format vektora!");
		}
		
		double[] y = new double[rows];
		
		for(int i = 0; i < rows; i++) {
			y[i] = b.get(i, 0);
			
			for(int j = 0; j <= i - 1; j++) {
				y[i] -= y[j] * matrix[i][j];
			}
		}
		
		return new Matrix(y);
	}