本文整理汇总了C++中sprout::complex类的典型用法代码示例。如果您正苦于以下问题:C++ complex类的具体用法?C++ complex怎么用?C++ complex使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了complex类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1:
inline SPROUT_CONSTEXPR sprout::math::quaternion<T>
operator*(sprout::math::quaternion<T> const& lhs, sprout::complex<T> const& rhs) {
return sprout::math::detail::mul_qc_impl(
rhs.R_component_1(), rhs.R_component_2(), rhs.R_component_3(), rhs.R_component_4(),
lhs.real(), lhs.imag()
);
}
开发者ID:bolero-MURAKAMI,项目名称:Sprout,代码行数:7,代码来源:arithmetic_operators.hpp
示例2: proj_impl
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
);
}
开发者ID:jimbeamman,项目名称:Sprout,代码行数:7,代码来源:values.hpp
示例3: copysign_mul
inline SPROUT_CONSTEXPR sprout::complex<T>
copysign_mul(T const& t, sprout::complex<T> const& z) {
return sprout::complex<T>(
sprout::math::copysign(t, z.real()),
sprout::math::copysign(t, z.imag())
);
}
开发者ID:kundor,项目名称:Sprout,代码行数:7,代码来源:copysign_mul.hpp
示例4:
inline SPROUT_CONSTEXPR sprout::complex<T>
operator*(sprout::complex<T> const& lhs, sprout::complex<T> const& rhs) {
return sprout::complex<T>(
lhs.real() * rhs.real() - lhs.imag() * rhs.imag(),
lhs.real() * rhs.imag() + lhs.imag() * rhs.real()
);
}
开发者ID:kennethho,项目名称:Sprout,代码行数:7,代码来源:operators.hpp
示例5: divides_impl
inline SPROUT_CONSTEXPR sprout::complex<T>
divides_impl(sprout::complex<T> const& lhs, sprout::complex<T> const& rhs, T const& n) {
return sprout::complex<T>(
(lhs.real() * rhs.real() + lhs.imag() * rhs.imag()) / n,
(lhs.imag() * rhs.real() - lhs.real() * rhs.imag()) / n
);
}
开发者ID:kennethho,项目名称:Sprout,代码行数:7,代码来源:operators.hpp
示例6: arg
inline SPROUT_CONSTEXPR T
arg(sprout::complex<T> const& x) {
return sprout::math::atan2(x.imag(), x.real());
}
开发者ID:LoliGothick,项目名称:Sprout,代码行数:4,代码来源:arg.hpp
示例7: T
inline SPROUT_CONSTEXPR bool
operator==(T const& lhs, sprout::complex<T> const& rhs) {
return lhs == rhs.real() && T() == rhs.imag();
}
开发者ID:kennethho,项目名称:Sprout,代码行数:4,代码来源:operators.hpp
示例8: norm
inline SPROUT_CONSTEXPR T
norm(sprout::complex<T> const& x) {
return x.real() * x.real() + x.imag() * x.imag();
}
开发者ID:jimbeamman,项目名称:Sprout,代码行数:4,代码来源:values.hpp
示例9: sqrt
inline SPROUT_CONSTEXPR sprout::complex<T>
sqrt(sprout::complex<T> const& x) {
typedef sprout::complex<T> type;
return sprout::math::isinf(x.imag()) ? type(sprout::numeric_limits<T>::infinity(), x.imag())
: sprout::math::isnan(x.real())
? sprout::math::isnan(x.imag()) ? type(sprout::numeric_limits<T>::quiet_NaN(), sprout::numeric_limits<T>::quiet_NaN())
: type(sprout::numeric_limits<T>::quiet_NaN(), sprout::numeric_limits<T>::quiet_NaN())
: sprout::math::isnan(x.imag())
? x.real() == sprout::numeric_limits<T>::infinity()
? type(sprout::numeric_limits<T>::infinity(), sprout::math::copysign(sprout::numeric_limits<T>::quiet_NaN(), x.imag()))
: x.real() == -sprout::numeric_limits<T>::infinity()
? type(
sprout::math::copysign(sprout::numeric_limits<T>::quiet_NaN(), x.imag()),
sprout::math::copysign(sprout::numeric_limits<T>::infinity(), x.imag())
)
: type(sprout::numeric_limits<T>::quiet_NaN(), sprout::numeric_limits<T>::quiet_NaN())
: x.real() == sprout::numeric_limits<T>::infinity()
? type(sprout::numeric_limits<T>::infinity(), (x.imag() == 0 ? x.imag() : sprout::math::copysign(T(0), x.imag())))
: x.real() == -sprout::numeric_limits<T>::infinity()
? type(T(0), sprout::math::copysign(T(0), x.imag()))
: x.real() == 0 && x.imag() == 0 ? type(T(0), x.imag())
: x.real() == 0 ? sprout::detail::sqrt_impl_1(x, sprout::math::sqrt(sprout::math::abs(x.imag()) / T(2)))
: sprout::detail::sqrt_impl_2(x, sprout::math::sqrt(T(2) * (sprout::abs(x) + sprout::math::abs(x.real()))))
;
}
开发者ID:bolero-MURAKAMI,项目名称:Sprout,代码行数:25,代码来源:sqrt.hpp
示例10: sqrt_impl_1
inline SPROUT_CONSTEXPR sprout::complex<T>
sqrt_impl_1(sprout::complex<T> const& x, T const& t) {
return sprout::complex<T>(t, sprout::math::signbit(x.imag()) ? -t : t);
}
开发者ID:bolero-MURAKAMI,项目名称:Sprout,代码行数:4,代码来源:sqrt.hpp
示例11: hash_value
inline SPROUT_CONSTEXPR std::size_t
hash_value(sprout::complex<T> const& v) {
return sprout::hash_values(v.real(), v.imag());
}
开发者ID:siyuano,项目名称:Sprout,代码行数:4,代码来源:hash.hpp
示例12: atanh
inline SPROUT_CONSTEXPR sprout::complex<T>
atanh(sprout::complex<T> const& x) {
typedef sprout::complex<T> type;
return sprout::math::isnan(x.real())
? sprout::math::isnan(x.imag()) ? type(x.imag(), x.imag())
: sprout::math::isinf(x.imag()) ? type(sprout::math::copysign(T(0), x.real()), sprout::math::copysign(sprout::math::half_pi<T>(), x.imag()))
: type(x.real(), x.real())
: sprout::math::isnan(x.imag())
? sprout::math::isinf(x.real()) ? type(sprout::math::copysign(T(0), x.real()), x.imag())
: x.real() == 0 ? x
: type(x.imag(), x.imag())
: sprout::math::isinf(x.real()) || sprout::math::isinf(x.imag())
? type(sprout::math::copysign(T(0), x.real()), sprout::math::copysign(sprout::math::half_pi<T>(), x.imag()))
: x.real() == 0 && x.imag() == 0 ? x
: (x.real() == 1 || x.real() == -1) && x.imag() == 0 ? type(sprout::math::copysign(sprout::numeric_limits<T>::infinity(), x.real()), x.imag())
: (sprout::log(T(1) + x) - sprout::log(T(1) - x)) / T(2)
;
}
开发者ID:qiqisteve,项目名称:Sprout,代码行数:18,代码来源:atanh.hpp
示例13: acosh
inline SPROUT_CONSTEXPR sprout::complex<T>
acosh(sprout::complex<T> const& x) {
typedef sprout::complex<T> type;
return sprout::math::isnan(x.real())
? sprout::math::isnan(x.imag()) ? x
: sprout::math::isinf(x.imag()) ? type(sprout::numeric_limits<T>::infinity(), x.real())
: type(x.real(), x.real())
: sprout::math::isnan(x.imag())
? sprout::math::isinf(x.real()) ? type(sprout::numeric_limits<T>::infinity(), x.imag())
: type(sprout::numeric_limits<T>::quiet_NaN(), x.imag())
: x.real() == sprout::numeric_limits<T>::infinity()
? sprout::math::isinf(x.imag()) ? type(sprout::numeric_limits<T>::infinity(), sprout::math::copysign(sprout::math::quarter_pi<T>(), x.imag()))
: type(sprout::numeric_limits<T>::infinity(), (x.imag() == 0 ? x.imag() : sprout::math::copysign(T(0), x.imag())))
: x.real() == -sprout::numeric_limits<T>::infinity()
? sprout::math::isinf(x.imag()) ? type(sprout::numeric_limits<T>::infinity(), sprout::math::copysign(sprout::math::three_quarters_pi<T>(), x.imag()))
: type(sprout::numeric_limits<T>::infinity(), sprout::math::copysign(sprout::math::pi<T>(), x.imag()))
: sprout::math::isinf(x.imag()) ? type(sprout::numeric_limits<T>::infinity(), sprout::math::copysign(sprout::math::half_pi<T>(), x.imag()))
: x.real() == 0 && x.imag() == 0 ? type(T(0), sprout::math::copysign(sprout::math::half_pi<T>(), x.imag()))
: T(2) * sprout::log(sprout::sqrt(sprout::math::half<T>() * (x + T(1))) + sprout::sqrt(sprout::math::half<T>() * (x - T(1))))
;
}
开发者ID:dnovick,项目名称:Sprout,代码行数:21,代码来源:acosh.hpp
示例14: acos_impl
inline SPROUT_CONSTEXPR sprout::complex<T>
acos_impl(sprout::complex<T> const& t) {
return sprout::complex<T>(sprout::math::half_pi<T>() - t.real(), -t.imag());
}
开发者ID:bolero-MURAKAMI,项目名称:Sprout,代码行数:4,代码来源:acos.hpp
示例15: log2_impl
inline SPROUT_CONSTEXPR sprout::complex<T>
log2_impl(sprout::complex<T> const& z) {
return sprout::math::isnan(z.real()) || sprout::math::isnan(z.imag()) ? z
: z / sprout::math::ln_two<T>()
;
}
开发者ID:kundor,项目名称:Sprout,代码行数:6,代码来源:log2.hpp
示例16: acos
inline SPROUT_CONSTEXPR sprout::complex<T>
acos(sprout::complex<T> const& x) {
typedef sprout::complex<T> type;
return sprout::math::isnan(x.real())
? sprout::math::isnan(x.imag()) ? x
: sprout::math::isinf(x.imag()) ? type(x.real(), -x.imag())
: type(x.real(), sprout::numeric_limits<T>::quiet_NaN())
: sprout::math::isnan(x.imag())
? sprout::math::isinf(x.real()) ? type(sprout::numeric_limits<T>::quiet_NaN(), x.real())
: x.real() == 0 ? type(sprout::math::half_pi<T>(), x.imag())
: type(sprout::numeric_limits<T>::quiet_NaN(), sprout::numeric_limits<T>::quiet_NaN())
: x.real() == sprout::numeric_limits<T>::infinity()
? sprout::math::isinf(x.imag()) ? type(sprout::math::quarter_pi<T>(), -x.imag())
: type(T(0), sprout::math::copysign(sprout::numeric_limits<T>::infinity(), -x.imag()))
: x.real() == -sprout::numeric_limits<T>::infinity()
? sprout::math::isinf(x.imag()) ? type(sprout::math::three_quarters_pi<T>(), -x.imag())
: type(sprout::math::pi<T>(), sprout::math::copysign(sprout::numeric_limits<T>::infinity(), -x.imag()))
: sprout::math::isinf(x.imag()) ? type(sprout::math::half_pi<T>(), sprout::math::copysign(sprout::numeric_limits<T>::infinity(), -x.imag()))
: x.real() == 0 && x.imag() == 0 ? type(sprout::math::half_pi<T>(), -x.imag())
: sprout::detail::acos_impl(sprout::asin(x))
;
}
开发者ID:bolero-MURAKAMI,项目名称:Sprout,代码行数:22,代码来源:acos.hpp
示例17: sqrt_impl_2_1
inline SPROUT_CONSTEXPR sprout::complex<T>
sqrt_impl_2_1(sprout::complex<T> const& x, T const& t, T const& u) {
return x.real() > T(0) ? sprout::complex<T>(u, x.imag() / t)
: sprout::complex<T>(sprout::math::abs(x.imag()) / t, sprout::math::signbit(x.imag()) ? -u : u)
;
}
开发者ID:bolero-MURAKAMI,项目名称:Sprout,代码行数:6,代码来源:sqrt.hpp
示例18: round
inline SPROUT_CONSTEXPR sprout::complex<T> round(sprout::complex<T> const& x) {
return sprout::complex<T>(sprout::round(x.real()), sprout::round(x.imag()));
}
开发者ID:darkfall,项目名称:Sprout,代码行数:3,代码来源:nearest.hpp
示例19: exp
inline SPROUT_CONSTEXPR sprout::complex<T>
exp(sprout::complex<T> const& x) {
typedef sprout::complex<T> type;
return sprout::math::isnan(x.real())
? sprout::math::isnan(x.imag()) ? type(x.real(), x.real())
: x.imag() == 0 ? type(x.real(), x.imag())
: type(x.real(), x.real())
: sprout::math::isnan(x.imag())
? x.real() == sprout::numeric_limits<T>::infinity() ? type(x.real(), x.imag())
: x.real() == -sprout::numeric_limits<T>::infinity() ? type(T(0), T(0))
: sprout::math::isinf(x.real()) ? type(sprout::numeric_limits<T>::infinity(), sprout::numeric_limits<T>::quiet_NaN())
: type(x.imag(), x.imag())
: x.real() == sprout::numeric_limits<T>::infinity()
? sprout::math::isinf(x.imag()) ? type(sprout::numeric_limits<T>::infinity(), sprout::numeric_limits<T>::quiet_NaN())
: x.imag() == 0 ? type(sprout::numeric_limits<T>::infinity(), x.imag())
: sprout::detail::copysign_mul(sprout::numeric_limits<T>::infinity(), sprout::euler(x.imag()))
: x.real() == -sprout::numeric_limits<T>::infinity()
? sprout::math::isinf(x.imag()) ? type(T(0), T(0))
: T(0) * sprout::euler(x.imag())
: sprout::math::isinf(x.imag())
? type(-sprout::numeric_limits<T>::quiet_NaN(), -sprout::numeric_limits<T>::quiet_NaN())
: x.real() == 0 && x.imag() == 0 ? type(T(1), x.imag())
: sprout::polar(sprout::math::exp(x.real()), x.imag())
;
}
开发者ID:kundor,项目名称:Sprout,代码行数:25,代码来源:exp.hpp
示例20: tanh
inline SPROUT_CONSTEXPR sprout::complex<T>
tanh(sprout::complex<T> const& x) {
typedef sprout::complex<T> type;
return sprout::math::isnan(x.real())
? sprout::math::isnan(x.imag()) ? x
: x.imag() == 0 ? x
: type(x.real(), x.real())
: sprout::math::isnan(x.imag())
? sprout::math::isinf(x.real()) ? type(T(1), T(0))
: type(x.imag(), x.imag())
: sprout::math::isinf(x.real())
? sprout::math::isinf(x.imag()) ? type(T(1), T(0))
: type(T(1), T(0) * sprout::math::sin(T(2) * x.imag()))
: sprout::math::isinf(x.imag())
? type(-sprout::numeric_limits<T>::quiet_NaN(), -sprout::numeric_limits<T>::quiet_NaN())
: x.real() == 0 && x.imag() == 0 ? x
: sprout::sinh(x) / sprout::cosh(x)
;
}
开发者ID:bolero-MURAKAMI,项目名称:Sprout,代码行数:19,代码来源:tanh.hpp
注:本文中的sprout::complex类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论