Automatic Differentiation
 
Loading...
Searching...
No Matches

◆ fma() [1/17]

template<typename T1 , typename T2 , typename T3 , require_all_stan_scalar_t< T1, T2, T3 > * = nullptr>
fvar< return_type_t< T1, T2, T3 > > stan::math::fma ( const fvar< T1 > &  x1,
const fvar< T2 > &  x2,
const fvar< T3 > &  x3 
)
inline

The fused multiply-add operation (C99).

This double-based operation delegates to fma.

The function is defined by

fma(a, b, c) = (a * b) + c.

\[ \mbox{fma}(x, y, z) = \begin{cases} x\cdot y+z & \mbox{if } -\infty\leq x, y, z \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{fma}(x, y, z)}{\partial x} = \begin{cases} y & \mbox{if } -\infty\leq x, y, z \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{fma}(x, y, z)}{\partial y} = \begin{cases} x & \mbox{if } -\infty\leq x, y, z \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

\[ \frac{\partial\, \mbox{fma}(x, y, z)}{\partial z} = \begin{cases} 1 & \mbox{if } -\infty\leq x, y, z \leq \infty \\[6pt] \textrm{NaN} & \mbox{if } x = \textrm{NaN} \end{cases} \]

Parameters
x1First value.
x2Second value.
x3Third value.
Returns
Product of the first two values plus the third.

Definition at line 60 of file fma.hpp.