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(T&& x) {
24 return std::log10(x);
25}
26
34template <typename T, require_complex_bt<std::is_arithmetic, T>* = nullptr>
35inline auto log10(T&& x) {
36 return std::log10(x);
37}
38
46struct log10_fun {
47 template <typename T>
48 static inline auto fun(T&& x) {
49 return log10(std::forward<T>(x));
50 }
51};
52
60template <typename Container, require_ad_container_t<Container>* = nullptr>
61inline auto log10(Container&& x) {
63 std::forward<Container>(x));
64}
65
74template <typename Container,
76inline auto log10(Container&& x) {
77 return apply_vector_unary<Container>::apply(
78 std::forward<Container>(x), [](auto&& v) { return v.array().log10(); });
79}
80
81namespace internal {
89template <typename V>
90inline std::complex<V> complex_log10(const std::complex<V>& z) {
91 static constexpr double inv_log_10 = 1.0f / LOG_TEN;
92 return log(z) * inv_log_10;
93}
94} // namespace internal
95
96} // namespace math
97} // namespace stan
98
99#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:90
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(T &&x)
Definition log10.hpp:48
Structure to wrap log10() so it can be vectorized.
Definition log10.hpp:46