function z = round(z, ~, ~, ~, ~)
%ROUND  rounds towards nearest integer
%   Y = ROUND(X)
%
%   The output Y has the same data format, if any, as the input X.
%
%   The syntaxes ROUND(X,N), ROUND(X,N,'decimal'), and
%   ROUND(X,N,'significant') are not supported.
%
%   See also ROUND, DLARRAY.

%   Copyright 2019-2023 The MathWorks, Inc.

if nargin > 1
    % This is valid syntax for builtin round but not supported by dlarray
    error(message('deep:dlarray:RoundOneInputOnly'));
end

% If this file is modified to not be a standard unary element-wise
% function, please also remove the following template tags.
%!define $UnaryFunction round($zdata)
%!template $UnaryElementWiseTemplate
% Code generated and inserted by deep.dev.generateDlarrayMethods.

% Extract data to work on and create a template output object.
[z, fdz, zdata] = extractUnaryElwiseData(z);

zdata = round(matlab.lang.internal.move(zdata));

z = restoreUnaryElwiseData(z, ...
    matlab.lang.internal.move(fdz), ...
    matlab.lang.internal.move(zdata));
%!template

end
