% This computes function value for IPM_pK. 
%
% Jan 12, 2012

function [fval,KtinvX,W,invX] = function_value(X,w,p,K,mu)

[V,D] = svd(X);
invX = V*diag(diag(D).^(-1))*V';
KtinvX = K'*invX;
W = KtinvX*K;
D = svd(W);

fval = sum(D.^(-p)) - mu*sum(log(w)) - mu*log(1 - sum(w));
