Automatic Differentiation
 
Loading...
Searching...
No Matches
operator_multiplication.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_FWD_CORE_OPERATOR_MULTIPLICATION_HPP
2#define STAN_MATH_FWD_CORE_OPERATOR_MULTIPLICATION_HPP
3
7
8namespace stan {
9namespace math {
10
19template <typename T>
20inline fvar<T> operator*(const fvar<T>& x, const fvar<T>& y) {
21 return fvar<T>(x.val_ * y.val_, x.d_ * y.val_ + x.val_ * y.d_);
22}
23
32template <typename T>
33inline fvar<T> operator*(double x, const fvar<T>& y) {
34 return fvar<T>(x * y.val_, x * y.d_);
35}
36
45template <typename T>
46inline fvar<T> operator*(const fvar<T>& x, double y) {
47 return fvar<T>(x.val_ * y, x.d_ * y);
48}
49
58template <typename T>
59inline std::complex<stan::math::fvar<T>> operator*(
60 const std::complex<stan::math::fvar<T>>& x,
61 const std::complex<stan::math::fvar<T>>& y) {
62 return internal::complex_multiply(x, y);
63}
64
74template <typename T>
75inline std::complex<stan::math::fvar<T>> operator*(
76 const std::complex<double>& x, const std::complex<stan::math::fvar<T>>& y) {
77 return internal::complex_multiply(x, y);
78}
79
89template <typename T>
90inline std::complex<stan::math::fvar<T>> operator*(
91 const std::complex<stan::math::fvar<T>>& x, const std::complex<double>& y) {
92 return internal::complex_multiply(x, y);
93}
94
95} // namespace math
96} // namespace stan
97#endif
complex_return_t< U, V > complex_multiply(const U &lhs, const V &rhs)
Return the product of the specified arguments.
fvar< T > operator*(const fvar< T > &x, const fvar< T > &y)
Return the product of the two arguments.
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...
Definition fvar.hpp:9
Scalar val_
The value of this variable.
Definition fvar.hpp:49
Scalar d_
The tangent (derivative) of this variable.
Definition fvar.hpp:61
This template class represents scalars used in forward-mode automatic differentiation,...
Definition fvar.hpp:40