function A = auc(csp, se)
%
%    A = auc(csp,se) computes the area under the ROC curve, where csp and
%    se  are  vectors representing (1-specificity) and (sensitivity), used to plot the ROC
%    curve. The vectors 'csp' and 'se' need to be of the same length.
%
csp=csp(:); se = se(:);
if length(csp) ~= length(se)
    error('Input vectors (1-specificity) and (sensitivity) should have the same length')
end
A = sum((csp(2:end) - csp(1:end-1)) .* (se(2:end)+se(1:end-1))/2 );
A=abs(A); %added to make auc insensitive to the order of csp's.
