function [gf, gg] = toptimg(X, coeff1, coeff2, coeff3)
%TOPTIMG Test function gradients for optimization test-suite (TOPTIM).
if coeff1==1 % Unconstrained
	gf= [-400*(X(2)-X(1)^2)*X(1)-2*(1-X(1)), 200*(X(2)-X(1)^2)];
elseif coeff1 ==2 % Constrained
	gf=[-X(2)*X(3), -X(1)*X(3), -X(1)*X(2)];
	gg = [-1, 1
		-2, 2
		-2, 2];
	%	F(1)=-X(1)*X(2)*X(3);               
	%	G(1)=-X(1)-2*X(2)-2*X(3);
	%	G(2)=X(1)+2*X(2)+2*X(3)-72;  
elseif coeff1 ==3 % Goal attainment 
	'no gradient '
	%F=sort(eig(A+B*X*C));
elseif coeff1 == 4 % Minimax
	gf=[4*X(1)-48  -1 1 -1 1
	2*X(2)-40 -3 3 -1 1];
	gg=[];
	%	F(1)=2*X(1)^2+X(2)^2-48*X(1)-40*X(2)+304; 
	%	F(2)=-X(1)-3*X(2);
  	%	F(3)=-18+X(1)+3*X(2);
 	%	F(4)=-X(1)-X(2);
 	%	F(5)=-8+X(1)+X(2);
elseif coeff1 ==5 % Leastsq
	for i=1:10 
		gf(1,i)=-i*exp(i*X(1));
		gf(2,i)=-i*exp(i*X(2));
	end
end


	
