function tf = checkFillPattern( A, allowedPatterns )
% Common implementation of ISTRIL, ISDIAG, etc. for codistributed array
%
%   tf = checkFillPattern(A, allowedPatterns) is true if the FillPattern
%   of A is one of the allowedPatterns, false if not.
%
%   See also: codistributed/isdiag, codistributed/istril, codistributed/istriu.

%   Copyright 2016-2020 The MathWorks, Inc.

if ~ismatrix(A)
    matrixType = 'NotTriangular';
else
    matrixType = getFillPattern(A);
end

tf = ismember(matrixType, allowedPatterns);

end