Stan Math Library
4.9.0
Automatic Differentiation
|
Return the ceiling of the specified variable (cmath).
The derivative of the ceiling function is defined and zero everywhere but at integers, and we set them to zero for convenience,
\(\frac{d}{dx} {\lceil x \rceil} = 0\).
The ceiling function rounds up. For double values, this is the smallest integral value that is not less than the specified value. Although this function is not differentiable because it is discontinuous at integral values, its gradient is returned as zero everywhere.
\[ \mbox{ceil}(x) = \begin{cases} \lceil x\rceil & \mbox{if } -\infty\leq x \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]
\[ \frac{\partial\, \mbox{ceil}(x)}{\partial x} = \begin{cases} 0 & \mbox{if } -\infty\leq x\leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]
a | Input variable. |