%% function [cvx_optval,x] = RobMagG(rho,T)
% computes the generalised robustness of magic of the state rho
% requires as second argument the matrix T whose columns are pure stabilizer states
%
% based on Seddon et al., arXiv:2002.06181

function [cvx_optval,x] = RobMagG(rho,T)

k = size(T,2);

cvx_begin sdp

variable x(k) nonnegative

rho <= T*diag(x)*T'
minimize sum(x)

cvx_end

end