function res = isdiag( A )
%ISDIAG  Determine whether a codistributed matrix is diagonal.
%   ISDIAG(X)
%   
%   Example:
%   spmd
%      X = codistributed.eye(1000);
%      isdiag(X)
%   end
%   
%   See also ISDIAG, CODISTRIBUTED, CODISTRIBUTED.EYE.
%   


%   Copyright 2014-2022 The MathWorks, Inc.

% This function works for single, double and logical
if isinteger( A )
    error(message('parallel:distributed:InvalidType','isdiag',underlyingType(A)))
end

res = checkFillPattern( A, {'Diagonal', 'ZeroMatrix'} );

end
