mirror of
https://github.com/bolero-MURAKAMI/Sprout
synced 2025-08-03 12:49:50 +00:00
fix coding-stype
This commit is contained in:
parent
2012838899
commit
df3023db30
196 changed files with 2510 additions and 3945 deletions
|
@ -11,36 +11,44 @@
|
|||
|
||||
namespace sprout {
|
||||
template<typename T>
|
||||
SPROUT_CONSTEXPR T norm(sprout::complex<T> const& x);
|
||||
SPROUT_CONSTEXPR T
|
||||
norm(sprout::complex<T> const& x);
|
||||
|
||||
// 26.4.7, values:
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR T real(sprout::complex<T> const& x) {
|
||||
inline SPROUT_CONSTEXPR T
|
||||
real(sprout::complex<T> const& x) {
|
||||
return x.real();
|
||||
}
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR T imag(sprout::complex<T> const& x) {
|
||||
inline SPROUT_CONSTEXPR T
|
||||
imag(sprout::complex<T> const& x) {
|
||||
return x.imag();
|
||||
}
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR T abs(sprout::complex<T> const& x) {
|
||||
inline SPROUT_CONSTEXPR T
|
||||
abs(sprout::complex<T> const& x) {
|
||||
return sprout::sqrt(sprout::norm(x));
|
||||
}
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR T arg(sprout::complex<T> const& x) {
|
||||
inline SPROUT_CONSTEXPR T
|
||||
arg(sprout::complex<T> const& x) {
|
||||
return sprout::atan2(x.imag(), x.real());
|
||||
}
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR T norm(sprout::complex<T> const& x) {
|
||||
inline SPROUT_CONSTEXPR T
|
||||
norm(sprout::complex<T> const& x) {
|
||||
return x.real() * x.real() + x.imag() * x.imag();
|
||||
}
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR sprout::complex<T> conj(sprout::complex<T> const& x) {
|
||||
inline SPROUT_CONSTEXPR sprout::complex<T>
|
||||
conj(sprout::complex<T> const& x) {
|
||||
return sprout::complex<T>(x.real(), -x.imag());
|
||||
}
|
||||
namespace detail {
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR sprout::complex<T> proj_impl(sprout::complex<T> const& x, T const& den) {
|
||||
inline SPROUT_CONSTEXPR sprout::complex<T>
|
||||
proj_impl(sprout::complex<T> const& x, T const& den) {
|
||||
return sprout::complex<T>(
|
||||
T(2) * x.real() / den,
|
||||
T(2) * x.imag() / den
|
||||
|
@ -48,14 +56,16 @@ namespace sprout {
|
|||
}
|
||||
} // detail
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR sprout::complex<T> proj(sprout::complex<T> const& x) {
|
||||
inline SPROUT_CONSTEXPR sprout::complex<T>
|
||||
proj(sprout::complex<T> const& x) {
|
||||
return sprout::detail::proj_impl(
|
||||
x,
|
||||
sprout::norm(x) + T(1)
|
||||
);
|
||||
}
|
||||
template<typename T>
|
||||
inline SPROUT_CONSTEXPR sprout::complex<T> polar(T const& rho, T const& theta = 0) {
|
||||
inline SPROUT_CONSTEXPR sprout::complex<T>
|
||||
polar(T const& rho, T const& theta = 0) {
|
||||
return sprout::complex<T>(rho * sprout::cos(theta), rho * sprout::sin(theta));
|
||||
}
|
||||
} // namespace sprout
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue