1#ifndef STAN_MATH_REV_FUN_COS_HPP
2#define STAN_MATH_REV_FUN_COS_HPP
45 a.adj() -= vi.adj() * std::sin(a.val());
57template <
typename VarMat, require_var_matrix_t<VarMat>* =
nullptr>
58inline auto cos(
const VarMat& a) {
60 a.val().array().cos().matrix(), [a](
const auto& vi)
mutable {
61 a.adj() -= vi.adj().cwiseProduct(a.val().array().sin().matrix());
70inline 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 ...