function p = ishermitian(A,skewOption)
%MATLAB Code Generation Library Function

%   Copyright 2013-2014 The MathWorks, Inc.
%#codegen

narginchk(1,2);
if nargin == 2
    coder.internal.prefer_const(skewOption);
    if isreal(A)
        p = issymmetric(A,skewOption);
        return
    end
    SKEW = strcmpi(skewOption,'skew');
    NONSKEW = strcmpi(skewOption,'nonskew');
    eml_invariant(SKEW || NONSKEW, ...
        'MATLAB:isHermitian:inputFlag');
else
    if isreal(A)
        p = issymmetric(A);
        return
    end
    SKEW = false;
end
p = ismatrix(A) && size(A,1) == size(A,2);
if p
    if SKEW
        for j = 1:size(A,2)
            for i = 1:j
                if ~(A(i,j) == -conj(A(j,i)))
                    p = false;
                    return
                end
            end
        end
    else
        for j = 1:size(A,2)
            for i = 1:j
                if ~(A(i,j) == conj(A(j,i)))
                    p = false;
                    return
                end
            end
        end
    end
end
