文件 | 函数
填充

文件

文件  filling.hpp
 用于填充、重复和序列的列 API。
 

函数

void cudf::fill_in_place (mutable_column_view &destination, size_type begin, size_type end, scalar const &value, rmm::cuda_stream_view stream=cudf::get_default_stream())
 使用标量值在列中就地填充一系列元素。 更多...
 
std::unique_ptr< columncudf::fill (column_view const &input, size_type begin, size_type end, scalar const &value, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 使用标量值在列中异地填充一系列元素。 更多...
 
std::unique_ptr< tablecudf::repeat (table_view const &input_table, column_view const &count, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 重复表的行。 更多...
 
std::unique_ptr< tablecudf::repeat (table_view const &input_table, size_type count, 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::sequence (size_type size, scalar const &init, scalar const &step, 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::sequence (size_type size, scalar const &init, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 使用由初始值和步长 1 指定的值序列填充列。 更多...
 
std::unique_ptr< cudf::columncudf::calendrical_month_sequence (size_type size, scalar const &init, size_type months, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 生成一个时间戳序列,该序列从 init 开始,并对每个连续元素按 months 递增,即对于 [0, size) 中的 i,有 output[i] = init + i * months更多...
 

详细说明

函数文档

◆ calendrical_month_sequence()

std::unique_ptr<cudf::column> cudf::calendrical_month_sequence ( size_type  size,
scalar const &  init,
size_type  months,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

生成一个时间戳序列,该序列从 init 开始,并对每个连续元素按 months 递增,即对于 [0, size) 中的 i,有 output[i] = init + i * months

如果给定日期无效,该日期将回退到该月的最后一个可用日期。

示例

size = 3
init = 2020-01-31 08:00:00
months = 1
返回 = [2020-01-31 08:00:00, 2020-02-29 08:00:00, 2020-03-31 08:00:00]
异常
cudf::logic_error如果输入数据类型不是 TIMESTAMP
参数
size要生成的时间戳数量
init初始时间戳
months要递增的月数
stream用于设备内存操作和内核启动的 CUDA 流
mr用于分配返回列的设备内存的设备内存资源
返回值
包含月份序列的时间戳列

◆ fill()

std::unique_ptr<column> cudf::fill ( column_view const &  input,
size_type  begin,
size_type  end,
scalar const &  value,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

使用标量值在列中异地填充一系列元素。

创建一个新列,如同对 input 执行了就地填充;也就是说,它就像是先创建了 input 的副本,然后用 value 覆盖了由索引 [begin, end) 指示的元素。

异常
cudf::logic_error对于无效范围(如果 begin < 0, begin > end, 或 end > destination.size())。
cudf::logic_error如果 destinationvalue 的类型不同。
参数
input用于创建新列的输入列。新列是通过用 value 替换 input 在指定范围内的值来创建的。
begin填充范围的起始索引(包含)
end填充范围中最后一个元素的索引(不包含)
value要填充的标量值
stream用于设备内存操作和内核启动的 CUDA 流
mr用于分配返回列的设备内存的设备内存资源
返回值
结果输出列

◆ fill_in_place()

void cudf::fill_in_place ( mutable_column_view destination,
size_type  begin,
size_type  end,
scalar const &  value,
rmm::cuda_stream_view  stream = cudf::get_default_stream() 
)

使用标量值在列中就地填充一系列元素。

begin 开始,用 value 填充 destination 的 N 个元素,其中 N = (end - begin)。

value 覆盖 destination 中由索引 [begin, end) 指示的元素范围。对于需要重新分配内存的用例,请使用返回 std::unique_ptr<column> 的异地填充函数。

异常
cudf::logic_error如果需要重新分配内存(例如对于可变宽度类型)。
cudf::logic_error对于无效范围(如果 begin < 0, begin > end, 或 end > destination.size())。
cudf::logic_error如果 destinationvalue 的类型不同。
cudf::logic_error如果 value 无效但 destination 不可为空。
参数
destination要填充到的预分配列
begin填充范围的起始索引(包含)
end填充范围中最后一个元素的索引(不包含)
value要填充的标量值
stream用于设备内存操作和内核启动的 CUDA 流

◆ repeat() [1/2]

std::unique_ptr<table> cudf::repeat ( table_view const &  input_table,
column_view const &  count,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

重复表的行。

通过重复 input_table 的行来创建一个新表。每个元素的重复次数由 count 中对应索引的值定义。示例

in = [4,5,6]
count = [1,2,3]
返回 = [4,5,5,6,6,6]

count 不应包含 null 值;不应包含负值;且 count 元素的总和不应超过 size_type 的限制。如果 count 包含负值或总和溢出,则此函数的行为未定义。

异常
cudf::logic_error如果 count 的数据类型不是 size_type。
cudf::logic_error如果 input_tablecount 的行数不同。
cudf::logic_error如果 count 包含 null 值。
参数
input_table输入表
count非 nullable 的整数类型列
stream用于设备内存操作和内核启动的 CUDA 流
mr用于分配返回表的设备内存的设备内存资源
返回值
包含重复行的结果表

◆ repeat() [2/2]

std::unique_ptr<table> cudf::repeat ( table_view const &  input_table,
size_type  count,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

重复表的行。

通过将 input_table 的行重复 count 次来创建一个新表。示例

in = [4,5,6]
count = 2
返回 = [4,4,5,5,6,6]
异常
cudf::logic_error如果 count 为负。
std::overflow_error如果 input_table.num_rows() * count 溢出 size_type。
参数
input_table输入表
count重复次数
stream用于设备内存操作和内核启动的 CUDA 流
mr用于分配返回表的设备内存的设备内存资源
返回值
包含重复行的结果表

◆ sequence() [1/2]

std::unique_ptr<column> cudf::sequence ( size_type  size,
scalar const &  init,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

使用由初始值和步长 1 指定的值序列填充列。

创建一个新列,并用从 init 开始并按 1 递增的 size 个值填充,生成序列 [ init, init+1, init+2, ... init + (size - 1)]

size = 3
init = 0
返回 = [0, 1, 2]
异常
cudf::logic_error如果 init 不是数字类型。
cudf::logic_error如果 size < 0。
参数
size输出列的大小
init序列中的第一个值
stream用于设备内存操作和内核启动的 CUDA 流
mr用于分配返回列的设备内存的设备内存资源
返回值
包含生成序列的结果列

◆ sequence() [2/2]

std::unique_ptr<column> cudf::sequence ( size_type  size,
scalar const &  init,
scalar const &  step,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

使用由初始值和步长指定的值序列填充列。

创建一个新列,并用从 init 开始并按 step 递增的 size 个值填充,生成序列 [ init, init+step, init+2*step, ... init + (size - 1)*step]

size = 3
init = 0
step = 2
返回 = [0, 2, 4]
异常
cudf::logic_error如果 initstep 的类型不同。
cudf::logic_error如果标量类型不是数字类型。
cudf::logic_error如果 size < 0。
参数
size输出列的大小
init序列中的第一个值
step递增值
stream用于设备内存操作和内核启动的 CUDA 流
mr用于分配返回列的设备内存的设备内存资源
返回值
包含生成序列的结果列