文件 | | 类型别名 | 枚举 | 函数 | 变量
二元运算

文件

文件  binaryop.hpp
 列的二元运算 API。
 

struct  cudf::binary_op_common_type< L, R, typename >
 二元运算通用类型默认实现。 更多...
 
struct  cudf::binary_op_common_type< L, R, std::enable_if_t< has_common_type_v< L, R > > >
 二元运算通用类型特化实现。 更多...
 

类型别名

template<typename L , typename R >
using cudf::binary_op_common_type_t = typename binary_op_common_type< L, R >::type
 二元运算通用类型助手。
 

枚举

enum class  cudf::binary_operator : int32_t {
  cudf::ADD , cudf::SUB , cudf::MUL , cudf::DIV ,
  cudf::TRUE_DIV , cudf::FLOOR_DIV , cudf::MOD , cudf::PMOD ,
  cudf::PYMOD , cudf::POW , cudf::INT_POW , cudf::LOG_BASE ,
  cudf::ATAN2 , cudf::SHIFT_LEFT , cudf::SHIFT_RIGHT , cudf::SHIFT_RIGHT_UNSIGNED ,
  cudf::BITWISE_AND , cudf::BITWISE_OR , cudf::BITWISE_XOR , cudf::LOGICAL_AND ,
  cudf::LOGICAL_OR , cudf::EQUAL , cudf::NOT_EQUAL , cudf::LESS ,
  cudf::GREATER , cudf::LESS_EQUAL , cudf::GREATER_EQUAL , cudf::NULL_EQUALS ,
  cudf::NULL_NOT_EQUALS , cudf::NULL_MAX , cudf::NULL_MIN , cudf::GENERIC_BINARY ,
  cudf::NULL_LOGICAL_AND , cudf::NULL_LOGICAL_OR , cudf::INVALID_BINARY
}
 可在数据上执行的二元运算类型。 更多...
 

函数

std::unique_ptr< columncudf::binary_operation (scalar const &lhs, column_view const &rhs, binary_operator op, data_type output_type, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 在标量和列之间执行二元运算。 更多...
 
std::unique_ptr< columncudf::binary_operation (column_view const &lhs, scalar const &rhs, binary_operator op, data_type output_type, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 在列和标量之间执行二元运算。 更多...
 
std::unique_ptr< columncudf::binary_operation (column_view const &lhs, column_view const &rhs, binary_operator op, data_type output_type, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 在两列之间执行二元运算。 更多...
 
std::unique_ptr< columncudf::binary_operation (column_view const &lhs, column_view const &rhs, std::string const &ptx, data_type output_type, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 使用用户定义的 PTX 函数在两列之间执行二元运算。 更多...
 
int32_t cudf::binary_operation_fixed_point_scale (binary_operator op, int32_t left_scale, int32_t right_scale)
 根据给定的二元运算符 op 计算 fixed_point 数值的 scale更多...
 
cudf::data_type cudf::binary_operation_fixed_point_output_type (binary_operator op, cudf::data_type const &lhs, cudf::data_type const &rhs)
 根据给定的二元运算符 op 计算 fixed_point 数值的 data_type更多...
 

变量

template<typename L , typename R >
constexpr bool cudf::binary_op_has_common_type_v
 检查二元运算类型是否具有通用类型。 更多...
 

详细描述

枚举类型文档

◆ binary_operator

enum cudf::binary_operator : int32_t
strong

可在数据上执行的二元运算类型。

枚举成员
ADD 

运算符 +

SUB 

运算符 -

MUL 

运算符 *

DIV 

使用 lhs 和 rhs 通用类型的运算符 /

TRUE_DIV 

将类型提升为浮点类型后的运算符 /

FLOOR_DIV 

运算符 // 整数除法,如果两个参数都是整数,则向负无穷方向舍入;浮点类型的向下取整除法(对混合整数/浮点参数使用 C++ 类型提升)。如果需要不同的提升语义,调用者有责任在此函数调用前手动进行提升。

MOD 

运算符 %

PMOD 

正数模运算符 如果余数是负数,则返回 (余数 + 除数) % 除数;否则返回 (被除数 % 除数)

PYMOD 

运算符 %,但遵循 Python 对负数的符号规则

POW 

lhs ^ rhs

INT_POW 

int ^ int,用于避免浮点精度损失。对于负指数返回 0。

LOG_BASE 

以 base 为底的对数

ATAN2 

双参数反正切

SHIFT_LEFT 

运算符 <<

SHIFT_RIGHT 

运算符 >>

SHIFT_RIGHT_UNSIGNED 

运算符 >>> (来自 Java) 逻辑右移。移位前转换为无符号值。

BITWISE_AND 

运算符 &

BITWISE_OR 

运算符 |

BITWISE_XOR 

运算符 ^

LOGICAL_AND 

运算符 &&

LOGICAL_OR 

运算符 ||

EQUAL 

运算符 ==

NOT_EQUAL 

运算符 !=

LESS 

运算符 <

GREATER 

运算符 >

LESS_EQUAL 

运算符 <=

GREATER_EQUAL 

运算符 >=

NULL_EQUALS 

当两个操作数都为 null 时返回 true;当一个操作数为 null 时返回 false;当两个操作数都不为 null 时返回相等性结果

NULL_NOT_EQUALS 

当两个操作数都为 null 时返回 false;当一个操作数为 null 时返回 true;当两个操作数都不为 null 时返回不等性结果

NULL_MAX 

当两个操作数都不为 null 时返回操作数的最大值;当一个操作数为 null 时返回非 null 操作数;当两个都为 null 时返回无效值

NULL_MIN 

当两个操作数都不为 null 时返回操作数的最小值;当一个操作数为 null 时返回非 null 操作数;当两个都为 null 时返回无效值

GENERIC_BINARY 

使用输入的 ptx 代码生成的通用二元运算符

NULL_LOGICAL_AND 

遵循 Spark 规则的运算符 &&:(null, null) 为 null,(null, true) 为 null,(null, false) 为 false,且 (valid, valid) == LOGICAL_AND(valid, valid)

NULL_LOGICAL_OR 

遵循 Spark 规则的运算符 ||:(null, null) 为 null,(null, true) 为 true,(null, false) 为 null,且 (valid, valid) == LOGICAL_OR(valid, valid)

INVALID_BINARY 

无效操作

定义位于行 38 文件 binaryop.hpp

函数文档

◆ binary_operation() [1/4]

std::unique_ptr<column> cudf::binary_operation ( column_view const &  lhs,
column_view const &  rhs,
binary_operator  op,
data_type  output_type,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

在两列之间执行二元运算。

输出包含所有 0 <= i < lhs.size()op(lhs[i], rhs[i]) 结果。

无论运算符是什么,输出值的有效性是两个操作数有效性的逻辑 AND,除了 NullMin 和 NullMax (逻辑 OR)。

参数
lhs左操作数列
rhs右操作数列
op二元运算符
output_type期望的输出列数据类型
stream用于设备内存操作和内核启动的 CUDA stream
mr用于分配返回列设备内存的设备内存资源
返回值
类型为 output_type 的输出列,包含二元运算的结果
异常
cudf::logic_error如果 lhsrhs 大小不同
cudf::logic_error如果 output_type dtype 对于比较和逻辑运算不是布尔类型。
cudf::logic_error如果 output_type dtype 不是固定宽度类型
cudf::data_type_error如果操作不支持 lhsrhs 的类型

◆ binary_operation() [2/4]

std::unique_ptr<column> cudf::binary_operation ( column_view const &  lhs,
column_view const &  rhs,
std::string const &  ptx,
data_type  output_type,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

使用用户定义的 PTX 函数在两列之间执行二元运算。

输出包含所有 0 <= i < lhs.size()op(lhs[i], rhs[i]) 结果。

无论运算符是什么,输出值的有效性是两个操作数有效性的逻辑 AND。

参数
lhs左操作数列
rhs右操作数列
ptx包含二元函数 PTX 代码的字符串
output_type期望的输出列数据类型。假设 output_type 与 PTX 代码中函数的输出数据类型兼容
stream用于设备内存操作和内核启动的 CUDA stream
mr用于分配返回列设备内存的设备内存资源
返回值
类型为 output_type 的输出列,包含二元运算的结果
异常
cudf::logic_error如果 lhsrhs 大小不同
cudf::logic_error如果 lhsrhs dtypes 不是数值类型
cudf::logic_error如果 output_type dtype 不是数值类型

◆ binary_operation() [3/4]

std::unique_ptr<column> cudf::binary_operation ( column_view const &  lhs,
scalar const &  rhs,
binary_operator  op,
data_type  output_type,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

在列和标量之间执行二元运算。

输出包含所有 0 <= i < lhs.size()op(lhs[i], rhs) 结果。列元素是左操作数,标量是右操作数。这种区别在非可交换二元运算中很重要

无论运算符是什么,输出值的有效性是两个操作数有效性的逻辑 AND,除了 NullMin 和 NullMax (逻辑 OR)。

参数
lhs左操作数列
rhs右操作数标量
op二元运算符
output_type期望的输出列数据类型
stream用于设备内存操作和内核启动的 CUDA stream
mr用于分配返回列设备内存的设备内存资源
返回值
类型为 output_type 的输出列,包含二元运算的结果
异常
cudf::logic_error如果 output_type dtype 不是固定宽度类型
cudf::logic_error如果 output_type dtype 对于比较和逻辑运算不是布尔类型。
cudf::data_type_error如果操作不支持 lhsrhs 的类型

◆ binary_operation() [4/4]

std::unique_ptr<column> cudf::binary_operation ( scalar const &  lhs,
column_view const &  rhs,
binary_operator  op,
data_type  output_type,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

在标量和列之间执行二元运算。

输出包含所有 0 <= i < rhs.size()op(lhs, rhs[i]) 结果。标量是左操作数,列元素是右操作数。这种区别在非可交换二元运算中很重要

无论运算符是什么,输出值的有效性是两个操作数有效性的逻辑 AND,除了 NullMin 和 NullMax (逻辑 OR)。

参数
lhs左操作数标量
rhs右操作数列
op二元运算符
output_type期望的输出列数据类型
stream用于设备内存操作和内核启动的 CUDA stream
mr用于分配返回列设备内存的设备内存资源
返回值
类型为 output_type 的输出列,包含二元运算的结果
异常
cudf::logic_error如果 output_type dtype 不是固定宽度类型
cudf::logic_error如果 output_type dtype 对于比较和逻辑运算不是布尔类型。
cudf::data_type_error如果操作不支持 lhsrhs 的类型

◆ binary_operation_fixed_point_output_type()

cudf::data_type cudf::binary_operation_fixed_point_output_type ( binary_operator  op,
cudf::data_type const &  lhs,
cudf::data_type const &  rhs 
)

根据给定的二元运算符 op 计算 fixed_point 数值的 data_type

参数
op用于两个 fixed_point 数值的 binary_operator
lhs左侧 fixed_point 数值的 cudf::data_type
rhs右侧 fixed_point 数值的 cudf::data_type
返回值
计算得到的 fixed_point 数值的 cudf::data_type

◆ binary_operation_fixed_point_scale()

int32_t cudf::binary_operation_fixed_point_scale ( binary_operator  op,
int32_t  left_scale,
int32_t  right_scale 
)

根据给定的二元运算符 op 计算 fixed_point 数值的 scale

参数
op用于两个 fixed_point 数值的 binary_operator
left_scale左侧 fixed_point 数值的 Scale
right_scale右侧 fixed_point 数值的 Scale
返回值
计算得到的 fixed_point 数值的 scale

变量文档

◆ binary_op_has_common_type_v

template<typename L , typename R >
constexpr bool cudf::binary_op_has_common_type_v
inlineconstexpr
初始值
=
detail::binary_op_has_common_type_impl<void, L, R>::value

检查二元运算类型是否具有通用类型。

定义位于行 140 文件 binaryop.hpp