function ns = norm_schatten(A, p)

% ns = norm_schatten(A, p)
%
% DESC:
% calculates the p Schatten norm of a matrix
%
% AUTHOR
% Marco Zuliani - zuliani@ece.ucsb.edu
%
% VERSION
% 1.1
%
% INPUT:
% A             = matrix
% p             = norm
%
% OUTPUT:
% ns            = p Schatten norm of A

sigma = svd(A);

if isfinite(p)
    temp = sigma.^p;
    if ~isfinite(temp)
        ns = max(sigma);
    else
        ns = sum(temp).^(1/p);
    end;
else
    ns = max(sigma);
end;

return