|
3 | 3 |
|
4 | 4 | #include <stan/math/rev/meta.hpp> |
5 | 5 | #include <stan/math/rev/core/var.hpp> |
| 6 | +#include <stan/math/rev/core/std_complex.hpp> |
6 | 7 | #include <stan/math/rev/core/arena_matrix.hpp> |
7 | 8 | #include <stan/math/rev/core/callback_vari.hpp> |
8 | 9 | #include <stan/math/prim/fun/as_column_vector_or_scalar.hpp> |
9 | 10 | #include <stan/math/prim/fun/as_array_or_scalar.hpp> |
10 | 11 | #include <stan/math/prim/fun/constants.hpp> |
11 | 12 | #include <stan/math/prim/fun/is_any_nan.hpp> |
| 13 | +#include <stan/math/prim/core/operator_subtraction.hpp> |
12 | 14 |
|
13 | 15 | namespace stan { |
14 | 16 | namespace math { |
@@ -310,6 +312,47 @@ inline auto operator-(const VarMat1& a, const VarMat2& b) { |
310 | 312 | return subtract(a, b); |
311 | 313 | } |
312 | 314 |
|
| 315 | +/** |
| 316 | + * Return the difference of std::complex<var> arguments. |
| 317 | + * |
| 318 | + * @param[in] x first argument |
| 319 | + * @param[in] y second argument |
| 320 | + * @return subtraction of arguments |
| 321 | + */ |
| 322 | +inline std::complex<stan::math::var> |
| 323 | +operator-(const std::complex<stan::math::var>& x, |
| 324 | + const std::complex<stan::math::var>& y) { |
| 325 | + return internal::complex_subtract(x, y); |
| 326 | +} |
| 327 | + |
| 328 | +/** |
| 329 | + * Return the difference of std::complex<double> and |
| 330 | + * std::complex<var> arguments. |
| 331 | + * |
| 332 | + * @param[in] x first argument |
| 333 | + * @param[in] y second argument |
| 334 | + * @return subtraction of arguments |
| 335 | + */ |
| 336 | +inline std::complex<stan::math::var> |
| 337 | +operator-(const std::complex<double>& x, |
| 338 | + const std::complex<stan::math::var>& y) { |
| 339 | + return internal::complex_subtract(x, y); |
| 340 | +} |
| 341 | + |
| 342 | +/** |
| 343 | + * Return the difference of std::complex<double> and |
| 344 | + * std::complex<var> arguments. |
| 345 | + * |
| 346 | + * @param[in] x first argument |
| 347 | + * @param[in] y second argument |
| 348 | + * @return subtraction of arguments |
| 349 | + */ |
| 350 | +inline std::complex<stan::math::var> |
| 351 | +operator-(const std::complex<stan::math::var>& x, |
| 352 | + const std::complex<double>& y) { |
| 353 | + return internal::complex_subtract(x, y); |
| 354 | +} |
| 355 | + |
313 | 356 | } // namespace math |
314 | 357 | } // namespace stan |
315 | 358 | #endif |
0 commit comments