function tf = hasInf(A)
% Common implementation to check for Infs in A.
% For codistributed inputs, check meta data for information and create it 
% if necessary.

%   Copyright 2016-2019 The MathWorks, Inc.

if isa(A, "codistributed")
    if ~A.Metadata.HasInf.isKnown()
        getFillPattern(A); % Force recalculation of fill-related metadata
    end
    tf = A.Metadata.HasInf.get();
else
    tf = any(isinf(A), "all") == true;
end
end
