function validateLDPCParityCheckMatrix(parityMat)
%
%   Warning: This undocumented function may be removed in a future release.

%validateLDPCParityCheckMatrix validate the LDPC parity check matrix
%   validateLDPCParityCheckMatrix(PARITYMAT) errors out if PARITYMAT is an
%   invalid LDPC parity check matrix.

% Copyright 2010-2019 The MathWorks, Inc.

if ~issparse(parityMat)
  error(message('comm:validateLDPCParityCheckMatrix:NonSparseParityCheckMatrix'));
end

N = size(parityMat,2);
K = N - size(parityMat,1);

if N <= 0
  error(message('comm:validateLDPCParityCheckMatrix:InvalidNumColumns'));
end

if K <= 0
  error(message('comm:validateLDPCParityCheckMatrix:TooFewColumns'));
end

if ~isempty(find(nonzeros(parityMat)~=1, 1))
    error(message('comm:validateLDPCParityCheckMatrix:NotBinaryValued'));
end

if ~isempty(find(full(sum(parityMat,1)==0), 1))
  error(message('comm:validateLDPCParityCheckMatrix:EmptyColumn'));
end

if ~isempty(find(full(sum(parityMat,2)==0), 1))
  error(message('comm:validateLDPCParityCheckMatrix:EmptyRow'));
end
