function mustBeSparse(A)
    %MUSTBESPARSE Validate that value is a sparse matrix
    %
    %   mustBeSparse validates that a function input is a sparse matrix.
    %   This validator throws an assertion if the input is not sparse.
    %
    %   In code generation, this validator asserts at compile time that a value
    %   has a sparse attribute.
    %
    %   Example:
    %     function out = multiplyByThree(in)
    %         arguments
    %             in (3,4) double {mustBeSparse(in)}
    %         end
    %         out = in*3;
    %     end
    %
    %   Copyright 2022 The MathWorks, Inc.

     %#codegen

        narginchk(1,1);
        coder.internal.allowEnumInputs;
        coder.internal.allowHalfInputs;
        coder.internal.assert(issparse(A), 'MATLAB:validators:mustBeSparse');
    end
