CUDA初学者-Thrust - Numerics(14)

本人 CUDA小白一枚,要是有什么不对,还望各位大佬指点。
本文及后面的几篇将分别从几个方面来大概阐述一下Thrust的一些接口。原来的网址在这里

7.Numerics

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);
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值