13
13
namespace stan {
14
14
namespace math {
15
15
16
- /* *
17
- * Arithmetic version of `cos()`
18
- * @tparam T An `Arithmetic` type.
19
- * @param x Arithmetic scalar.
20
- */
21
- template <typename T, require_arithmetic_t <T>* = nullptr >
22
- inline auto cos (T x) {
23
- return std::cos (x);
24
- }
25
-
26
16
/* *
27
17
* Structure to wrap `cos()` so it can be vectorized.
28
18
*
@@ -33,6 +23,7 @@ inline auto cos(T x) {
33
23
struct cos_fun {
34
24
template <typename T>
35
25
static inline T fun (const T& x) {
26
+ using std::cos ;
36
27
return cos (x);
37
28
}
38
29
};
@@ -47,7 +38,6 @@ struct cos_fun {
47
38
*/
48
39
template <typename Container,
49
40
require_not_container_st<std::is_arithmetic, Container>* = nullptr ,
50
- require_not_stan_scalar_t <Container>* = nullptr ,
51
41
require_not_var_matrix_t <Container>* = nullptr ,
52
42
require_all_not_nonscalar_prim_or_rev_kernel_expression_t <
53
43
Container>* = nullptr >
@@ -67,7 +57,7 @@ template <typename Container,
67
57
require_container_st<std::is_arithmetic, Container>* = nullptr >
68
58
inline auto cos (const Container& x) {
69
59
return apply_vector_unary<Container>::apply (
70
- x, [](const auto & v) { return v.array ().cos (); });
60
+ x, [& ](const auto & v) { return v.array ().cos (); });
71
61
}
72
62
73
63
namespace internal {
0 commit comments