本人 CUDA小白一枚,要是有什么不对,还望各位大佬指点。
本文及后面的几篇将分别从几个方面来大概阐述一下Thrust的一些接口。原来的网址在这里
7.1 Complex Numbers 复数
template <typename T>
struct thrust::complex;
typedef see below thrust::complex::value_type;
// 复数
__host__ __device__
thrust::complex::complex(const T & re);
__host__ __device__
thrust::complex::complex(const T & re, const T & im);
template <typename U>
__host__ __device__
thrust::complex::complex(const complex< U > & z);
__host__ __device__
thrust::complex::complex(const std::complex< T > & z);
template <typename U>
__host__ __device__
thrust::complex::complex(const std::complex< U > & z);
// =重构
__host__ __device__ complex &
thrust::complex::operator=(const T & re);
complex & thrust::complex::operator=(const complex< T > & z) = default;
template <typename U>
__host__ __device__ complex &
thrust::complex::operator=(const complex< U > & z);
__host__ __device__ complex &
thrust::complex::operator=(const std::complex< T > & z);
template <typename U>
__host__ __device__ complex &
thrust::complex::operator=(const std::complex< U > & z);
// += 重构
template <typename U>
__host__ __device__ complex< T > &
thrust::complex::operator+=(const complex< U > & z);
// -= 重构
template <typename U>
__host__ __device__ complex< T > &
thrust::complex::operator-=(const complex< U > & z);
// *= 重构
template <typename U>
__host__ __device__ complex< T > &
thrust::complex::operator*=(const complex< U > & z);
// /= 重构
template <typename U>
__host__ __device__ complex< T > &
thrust::complex::operator/=(const complex< U > & z);
// += 重构
template <typename U>
__host__ __device__ complex< T > &
thrust::complex::operator+=(const U & z);
// -= 重构
template <typename U>
__host__ __device__ complex< T > &
thrust::complex::operator-=(const U & z);
// *= 重构
template <typename U>
__host__ __device__ complex< T > &
thrust::complex::operator*=(const U & z);
// /= 重构
template <typename U>
__host__ __device__ complex< T > &
thrust::complex::operator/=(const U & z);
// 返回实部
__host__ __device__ T
thrust::complex::real() const;
// 返回虚部
__host__ __device__ T
thrust::complex::imag() const;
// 返回实部
__host__ __device__ T
thrust::complex::real() const;
// 返回虚部
__host__ __device__ T
thrust::complex::imag() const;
// 返回实部
__host__ __device__ void
thrust::complex::real(T re);
// 返回虚部
__host__ __device__ void
thrust::complex::imag(T im);
// 返回实部
__host__ __device__ void
thrust::complex::real(T re);
// 返回虚部
__host__ __device__ void
thrust::complex::imag(T im);
__host__
thrust::complex::complex< T >() const;
// 返回绝对值
template <typename T>
__host__ __device__ T
thrust::abs(const complex< T > & z);
// 返回弧度制的相位角
template <typename T>
__host__ __device__ T
thrust::arg(const complex< T > & z);
// 返回复数的平方根
template <typename T>
__host__ __device__ T
thrust::norm(const complex< T > & z);
// 返回复共轭
template <typename T>
__host__ __device__ complex< T >
thrust::conj(const complex< T > & z);
// 返回特定复数平方根和特定相位的复数
template <typename T0, typename T1>
__host__ __device__ complex< typename detail::promoted_numerical_type< T0, T1 >::type >
thrust::polar(const T0 & m,
const T1 & theta = T1());
// 返回复数在黎曼球面上面的投影
template <typename T>
__host__ __device__ complex< T >
thrust::proj(const T & z);
// + 重构
template <typename T0, typename T1>
__host__ __device__ complex< typename detail::promoted_numerical_type< T0, T1 >::type >
thrust::operator+(
const complex< T0 > & x,
const complex< T1 > & y);
// + 重构
template <typename T0, typename T1>
__host__ __device__ complex< typename detail::promoted_numerical_type< T0, T1 >::type >
thrust::operator+(
const complex< T0 > & x,
const T1 & y);
// + 重构
template <typename T0, typename T1>
__host__ __device__ complex< typename detail::promoted_numerical_type< T0, T1 >::type >
thrust::operator+(
const T0 & x,
const complex< T1 > & y);
// + 重构
template <typename T0,
typename T1>
__host__ __device__ complex< typename detail::promoted_numerical_type< T0, T1 >::type >
thrust::operator-(const complex< T0 > & x,
const complex< T1 > & y);
// - 重构
template <typename T0, typename T1>
__host__ __device__ complex< typename detail::promoted_numerical_type< T0, T1 >::type >
thrust::operator-(
const complex< T0 > & x,
const T1 & y);
// - 重构
template <typename T0, typename T1>
__host__ __device__ complex< typename detail::promoted_numerical_type< T0, T1 >::type >
thrust::operator-(
const T0 & x,
const complex< T1 > & y);
// * 重构
template <typename T0, typename T1>
__host__ __device__ complex< typename detail::promoted_numerical_type< T0, T1 >::type >
thrust::operator*(
const complex< T0 > & x,
const complex< T1 > & y);
// * 重构
template <typename T0, typename T1>
__host__ __device__ complex< typename detail::promoted_numerical_type< T0, T1 >::type >
thrust::operator*(
const complex< T0 > & x,
const T1 & y);
// * 重构
template <typename T0, typename T1>
__host__ __device__ complex< typename detail::promoted_numerical_type< T0, T1 >::type >
thrust::operator*(
const T0 & x,
const complex< T1 > & y);
// / 重构
template <typename T0, typename T1>
__host__ __device__ complex< typename detail::promoted_numerical_type< T0, T1 >::type >
thrust::operator/(const complex< T0 > & x,
const complex< T1 > & y);
// / 重构
template <typename T0,
typename T1>
__host__ __device__ complex< typename detail::promoted_numerical_type< T0, T1 >::type >
thrust::operator/(const complex< T0 > & x,
const T1 & y);
// / 重构
template <typename T0,
typename T1>
__host__ __device__ complex< typename detail::promoted_numerical_type< T0, T1 >::type >
thrust::operator/(const T0 & x,
const complex< T1 > & y);
// + 重构
template <typename T>
__host__ __device__ complex< T >
thrust::operator+(const complex< T > & y);
// - 重构
template <typename T>
__host__ __device__ complex< T >
thrust::operator-(const complex< T > & y);
// e指数
template <typename T>
__host__ __device__ complex< T >
thrust::exp(const complex< T > & z);
// 对数
template <typename T>
__host__ __device__ complex< T >
thrust::log(const complex< T > & z);
// 10底对数
template <typename T>
__host__ __device__ complex< T >
thrust::log10(const complex< T > & z);
// 次方
template <typename T0, typename T1>
__host__ __device__ complex< typename detail::promoted_numerical_type< T0, T1 >::type >
thrust::pow(
const complex< T0 > & x,
const complex< T1 > & y);
// 次方
template <typename T0, typename T1>
__host__ __device__ complex< typename detail::promoted_numerical_type< T0, T1 >::type >
thrust::pow(
const complex< T0 > & x,
const T1 & y);
// 次方
template <typename T0, typename T1>
__host__ __device__ complex< typename detail::promoted_numerical_type< T0, T1 >::type >
thrust::pow(const T0 & x,
const complex< T1 > & y);
// 求根
template <typename T>
__host__ __device__ complex< T >
thrust::sqrt(const complex< T > & z);
// 余弦
template <typename T>
__host__ __device__ complex< T >
thrust::cos(const complex< T > & z);
// 正弦
template <typename T>
__host__ __device__ complex< T >
thrust::sin(const complex< T > & z);
// 正切
template <typename T>
__host__ __device__ complex< T >
thrust::tan(const complex< T > & z);
// 双曲余弦
template <typename T>
__host__ __device__ complex< T >
thrust::cosh(const complex< T > & z);
// 双曲正弦
template <typename T>
__host__ __device__ complex< T >
thrust::sinh(const complex< T > & z);
// 双曲正切
template <typename T>
__host__ __device__ complex< T >
thrust::tanh(const complex< T > & z);
// 反余弦
template <typename T>
__host__ __device__ complex< T >
thrust::acos(const complex< T > & z);
// 反正弦
template <typename T>
__host__ __device__ complex< T >
thrust::asin(const complex< T > & z);
// 反正切
template <typename T>
__host__ __device__ complex< T >
thrust::atan(const complex< T > & z);
// 反双曲余弦
template <typename T>
__host__ __device__ complex< T >
thrust::acosh(const complex< T > & z);
// 反双曲正弦
template <typename T>
__host__ __device__ complex< T >
thrust::asinh(const complex< T > & z);
// 反双曲正切
template <typename T>
__host__ __device__ complex< T >
thrust::atanh(const complex< T > & z);
// << 重构
template <typename T, typename CharT, typename Traits>
std::basic_ostream< CharT, Traits > &
thrust::operator<<(
std::basic_ostream< CharT, Traits > & os,
const complex< T > & z);
// >> 重构
template <typename T, typename CharT, typename Traits>
__host__ std::basic_istream< CharT, Traits > &
thrust::operator>>(
std::basic_istream< CharT, Traits > & is,
complex< T > & z);
// == 重构
template <typename T0, typename T1>
__host__ __device__ bool
thrust::operator==(
const complex< T0 > & x,
const complex< T1 > & y);
// == 重构
template <typename T0, typename T1>
__host__ __device__ bool
thrust::operator==(
const complex< T0 > & x,
const std::complex< T1 > & y);
// == 重构
template <typename T0, typename T1>
__host__ __device__ bool
thrust::operator==(
const std::complex< T0 > & x,
const complex< T1 > & y);
// == 重构
template <typename T0, typename T1>
__host__ __device__ bool
thrust::operator==(
const T0 & x,
const complex< T1 > & y);
// == 重构
template <typename T0, typename T1>
__host__ __device__ bool
thrust::operator==(
const complex< T0 > & x,
const T1 & y);
// == 重构
template <typename T0, typename T1>
__host__ __device__ bool
thrust::operator!=(
const complex< T0 > & x,
const complex< T1 > & y);
// != 重构
template <typename T0, typename T1>
__host__ __device__ bool
thrust::operator!=(
const complex< T0 > & x,
const std::complex< T1 > & y);
// != 重构
template <typename T0, typename T1>
__host__ __device__ bool
thrust::operator!=(
const std::complex< T0 > & x,
const complex< T1 > & y);
// != 重构
template <typename T0, typename T1>
__host__ __device__ bool
thrust::operator!=(
const T0 & x,
const complex< T1 > & y);
// != 重构
template <typename T0, typename T1>
__host__ __device__ bool
thrust::operator!=(
const complex< T0 > & x,
const T1 & y);