1#ifndef STAN_MATH_REV_FUN_SQUARE_HPP
2#define STAN_MATH_REV_FUN_SQUARE_HPP
37 x.adj() += vi.adj() * 2.0 * x.val();
48template <
typename T, require_var_matrix_t<T>* =
nullptr>
51 (x.val().array().square()).matrix(), [x](
const auto& vi)
mutable {
52 x.adj() += (2.0 * x.val().array() * vi.adj().array()).matrix();
var_value< plain_type_t< T > > make_callback_var(T &&value, F &&functor)
Creates a new var initialized with a callback_vari with a given value and reverse-pass callback funct...
fvar< T > square(const fvar< T > &x)
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...