% This computes gradient for IPM_p.
%
% Sept 26, 2011

function [g,V,diagD] = gradient(X,w,MA,p,mu,blk)

n = size(X,1);

[V,diagD] = svd(X);
diagD = diag(diagD);

g = MA'*(svec(blk,V*diag(p*(diagD.^(p-1)))*V')) - mu*1./w + mu/(1 - sum(w));