% gradApprox( [ 16 26 26 26 ], X, Y, Thetas)

function D = gradApprox(arch, X, Y, Thetas, ...
                        lambda = 0, epsilon = 0.001)

	vec = unroll(Thetas);

	for i = 1:10,    %%  length(vec),
		printf('A calcular derivada %d de %d\n', i, length(vec));
		fflush(stdout);

		vecPlus = vec;
		vecMinus = vec;

		vecPlus(i) = vecPlus(i) + epsilon;
		vecMinus(i) = vecMinus(i) - epsilon;

		vecPlus = roll(vecPlus, arch);
		vecMinus = roll(vecMinus, arch);

		D(i) = (jota(X, Y, vecPlus, lambda) - ...
                jota(X, Y, vecMinus, lambda)) / (2*epsilon);
	end
end
