function tf = issymmetric( A, skew )
%ISSYMMETRIC  Determine whether a codistributed matrix is real or complex symmetric.
%   ISSYMMETRIC(X)
%   ISSYMMETRIC(X,'skew')
%   ISSYMMETRIC(X,'nonskew')
%   
%   Example:
%   spmd
%      X = codistributed(gallery('moler',1000));
%      issymmetric(X)
%   end
%   
%   See also ISSYMMETRIC, MAGIC, CODISTRIBUTED.
%   


%   Copyright 2014-2022 The MathWorks, Inc.

% This function works for numerics, logicals and chars
if ~isfloat(A) && ~islogical(A)
    error(message('MATLAB:issymmetric:inputType'))
end

if nargin<2
    skew = false;
else
    skew = iGetSkewOptionOrError(skew);
end

doConj = false;
tf = checkSymmetry( A, doConj, skew );

end

function skew = iGetSkewOptionOrError(skew)
if matlab.internal.datatypes.isScalarText(skew, false)
    isFlag = startsWith(["skew","nonskew"], skew, "ignoreCase", true);
    if isFlag(1)
        skew = true;
        return
    elseif isFlag(2)
        skew = false;
        return
    end
end
throwAsCaller(MException(message('MATLAB:issymmetric:inputFlag')));
end