1#ifndef STAN_MATH_REV_FUN_COS_HPP
2#define STAN_MATH_REV_FUN_COS_HPP
48 a.adj() -= vi.adj() * std::sin(a.val());
60template <
typename VarMat, require_var_matrix_t<VarMat>* =
nullptr>
61inline auto cos(
const VarMat& a) {
63 a.val().array().cos().matrix(), [a](
const auto& vi)
mutable {
64 a.adj() -= vi.adj().cwiseProduct(a.val().array().sin().matrix());
73inline std::complex<var>
cos(
const std::complex<var>& z) {
std::complex< T > complex_cos(const std::complex< T > &z)
Return the cosine of the complex argument.
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 > cos(const fvar< T > &x)
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...