Automatic Differentiation
 
Loading...
Searching...
No Matches
i_times.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_SCAL_FUN_I_TIMES_HPP
2#define STAN_MATH_PRIM_SCAL_FUN_I_TIMES_HPP
3
4#include <complex>
5
6namespace stan {
7namespace math {
8
19template <typename T>
20inline std::complex<T> i_times(const std::complex<T>& z) {
21 return {-z.imag(), z.real()};
22}
23
35template <typename T>
36inline std::complex<T> neg_i_times(const std::complex<T>& z) {
37 return {z.imag(), -z.real()};
38}
39
47template <typename V>
48inline std::complex<V> complex_negate(const std::complex<V>& z) {
49 return {-z.real(), -z.imag()};
50}
51
52} // namespace math
53} // namespace stan
54
55#endif
std::complex< T > i_times(const std::complex< T > &z)
Return the specified complex number multiplied by i.
Definition i_times.hpp:20
std::complex< T > neg_i_times(const std::complex< T > &z)
Return the specified complex number multiplied by -i.
Definition i_times.hpp:36
std::complex< V > complex_negate(const std::complex< V > &z)
Return the complex negation of the specified complex argument.
Definition i_times.hpp:48
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...