Automatic Differentiation
 
Loading...
Searching...
No Matches
log10.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_LOG10_HPP
2#define STAN_MATH_PRIM_FUN_LOG10_HPP
3
9#include <cmath>
10#include <complex>
11
12namespace stan {
13namespace math {
14
22template <typename T, require_arithmetic_t<T>* = nullptr>
23inline auto log10(const T x) {
24 return std::log10(x);
25}
26
34template <typename T, require_complex_bt<std::is_arithmetic, T>* = nullptr>
35inline auto log10(const T x) {
36 return std::log10(x);
37}
38
46struct log10_fun {
47 template <typename T>
48 static inline auto fun(const T& x) {
49 return log10(x);
50 }
51};
52
60template <typename Container, require_ad_container_t<Container>* = nullptr>
61inline auto log10(const Container& x) {
63}
64
73template <typename Container,
75inline auto log10(const Container& x) {
76 return apply_vector_unary<Container>::apply(
77 x, [](const auto& v) { return v.array().log10(); });
78}
79
80namespace internal {
88template <typename V>
89inline std::complex<V> complex_log10(const std::complex<V>& z) {
90 static constexpr double inv_log_10 = 1.0f / LOG_TEN;
91 return log(z) * inv_log_10;
92}
93} // namespace internal
94
95} // namespace math
96} // namespace stan
97
98#endif
require_t< container_type_check_base< is_container, base_type_t, TypeCheck, Check... > > require_container_bt
Require type satisfies is_container.
std::complex< V > complex_log10(const std::complex< V > &z)
Return the base 10 logarithm of the complex argument.
Definition log10.hpp:89
static constexpr double LOG_TEN
The natural logarithm of 10, .
fvar< T > log(const fvar< T > &x)
Definition log.hpp:18
static constexpr double log10()
Returns the natural logarithm of ten.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Base template class for vectorization of unary scalar functions defined by a template class F to a sc...
static auto fun(const T &x)
Definition log10.hpp:48
Structure to wrap log10() so it can be vectorized.
Definition log10.hpp:46