Automatic Differentiation
 
Loading...
Searching...
No Matches
norm.hpp
Go to the documentation of this file.
1#ifndef STAN_MATH_PRIM_FUN_NORM_HPP
2#define STAN_MATH_PRIM_FUN_NORM_HPP
3
5#include <cmath>
6#include <complex>
7
8namespace stan {
9namespace math {
17template <typename V>
18inline V norm(const std::complex<V>& z) {
19 return std::norm(z);
20}
21
22namespace internal {
30template <typename V>
31inline V complex_norm(const std::complex<V>& z) {
32 return square(z.real()) + square(z.imag());
33}
34} // namespace internal
35} // namespace math
36} // namespace stan
37
38#endif
V complex_norm(const std::complex< V > &z)
Return the squared magnitude of the complex argument.
Definition norm.hpp:31
fvar< T > norm(const std::complex< fvar< T > > &z)
Return the squared magnitude of the complex argument.
Definition norm.hpp:19
fvar< T > square(const fvar< T > &x)
Definition square.hpp:12
The lgamma implementation in stan-math is based on either the reentrant safe lgamma_r implementation ...