文件 | 函数
切片

文件

文件  copying.hpp
 用于 gather、scatter、split、slice 等的列 API。
 

函数

std::vector< column_viewcudf::slice (column_view const &input, host_span< size_type const > indices, rmm::cuda_stream_view stream=cudf::get_default_stream())
 根据一组索引对 column_view 进行切片,切片结果为一组 column_view更多...
 
std::vector< column_viewcudf::slice (column_view const &input, std::initializer_list< size_type > indices, rmm::cuda_stream_view stream=cudf::get_default_stream())
 根据一组索引对 column_view 进行切片,切片结果为一组 column_view更多...
 
std::vector< table_viewcudf::slice (table_view const &input, host_span< size_type const > indices, rmm::cuda_stream_view stream=cudf::get_default_stream())
 根据一组索引对 table_view 进行切片,切片结果为一组 table_view更多...
 
std::vector< table_viewcudf::slice (table_view const &input, std::initializer_list< size_type > indices, rmm::cuda_stream_view stream=cudf::get_default_stream())
 根据一组索引对 table_view 进行切片,切片结果为一组 table_view更多...
 

详细描述

函数文档

◆ slice() [1/4]

std::vector<column_view> cudf::slice ( column_view const &  input,
host_span< size_type const >  indices,
rmm::cuda_stream_view  stream = cudf::get_default_stream() 
)

根据一组索引对 column_view 进行切片,切片结果为一组 column_view

返回的 input 视图由偶数个索引构建,其中第 i 个返回的 column_view 查看 input 中由范围 [indices[2*i], indices[(2*i)+1]) 指示的元素。

对于所有 i,期望 indices[i] <= input.size() 对于所有 i%2==0,期望 indices[i] <= indices[i+1]

注意
调用者有责任确保返回的视图不会比被查看的设备内存寿命更长。
input: {10, 12, 14, 16, 18, 20, 22, 24, 26, 28}
indices: {1, 3, 5, 9, 2, 4, 8, 8}
output: {{12, 14}, {20, 22, 24, 26}, {14, 16}, {}}
异常
std::invalid_argument如果 indices 大小不是偶数。
std::invalid_argument当对中的值严格递减时。
std::out_of_range当对中的任何值不属于范围 [0, input.size()) 时。
参数
input要切片的列视图
indices用于对 input 进行切片的索引
stream用于设备内存操作和内核启动的 CUDA 流
返回值
indices 中的范围指示的 input 视图向量

◆ slice() [2/4]

std::vector<column_view> cudf::slice ( column_view const &  input,
std::initializer_list< size_type indices,
rmm::cuda_stream_view  stream = cudf::get_default_stream() 
)

根据一组索引对 column_view 进行切片,切片结果为一组 column_view

返回的 input 视图由偶数个索引构建,其中第 i 个返回的 column_view 查看 input 中由范围 [indices[2*i], indices[(2*i)+1]) 指示的元素。

对于所有 i,期望 indices[i] <= input.size() 对于所有 i%2==0,期望 indices[i] <= indices[i+1]

注意
调用者有责任确保返回的视图不会比被查看的设备内存寿命更长。
input: {10, 12, 14, 16, 18, 20, 22, 24, 26, 28}
indices: {1, 3, 5, 9, 2, 4, 8, 8}
output: {{12, 14}, {20, 22, 24, 26}, {14, 16}, {}}
异常
std::invalid_argument如果 indices 大小不是偶数。
std::invalid_argument当对中的值严格递减时。
std::out_of_range当对中的任何值不属于范围 [0, input.size()) 时。
参数
input要切片的列视图
indices用于对 input 进行切片的索引
stream用于设备内存操作和内核启动的 CUDA 流
返回值
indices 中的范围指示的 input 视图向量

◆ slice() [3/4]

std::vector<table_view> cudf::slice ( table_view const &  input,
host_span< size_type const >  indices,
rmm::cuda_stream_view  stream = cudf::get_default_stream() 
)

根据一组索引对 table_view 进行切片,切片结果为一组 table_view

返回的 input 视图由偶数个索引构建,其中第 i 个返回的 table_view 查看 input 中由范围 [indices[2*i], indices[(2*i)+1]) 指示的元素。

对于所有 i,期望 indices[i] <= input.size() 对于所有 i%2==0,期望 indices[i] <= indices[i+1]

注意
调用者有责任确保返回的视图不会比被查看的设备内存寿命更长。
input: [{10, 12, 14, 16, 18, 20, 22, 24, 26, 28},
{50, 52, 54, 56, 58, 60, 62, 64, 66, 68}]
indices: {1, 3, 5, 9, 2, 4, 8, 8}
output: [{{12, 14}, {20, 22, 24, 26}, {14, 16}, {}},
{{52, 54}, {60, 22, 24, 26}, {14, 16}, {}}]
异常
std::invalid_argument如果 indices 大小不是偶数。
std::invalid_argument当对中的值严格递减时。
std::out_of_range当对中的任何值不属于范围 [0, input.size()) 时。
参数
input要切片的表视图
indices用于对 input 进行切片的索引
stream用于设备内存操作和内核启动的 CUDA 流
返回值
indices 中的范围指示的 input 视图向量

◆ slice() [4/4]

std::vector<table_view> cudf::slice ( table_view const &  input,
std::initializer_list< size_type indices,
rmm::cuda_stream_view  stream = cudf::get_default_stream() 
)

根据一组索引对 table_view 进行切片,切片结果为一组 table_view

返回的 input 视图由偶数个索引构建,其中第 i 个返回的 table_view 查看 input 中由范围 [indices[2*i], indices[(2*i)+1]) 指示的元素。

对于所有 i,期望 indices[i] <= input.size() 对于所有 i%2==0,期望 indices[i] <= indices[i+1]

注意
调用者有责任确保返回的视图不会比被查看的设备内存寿命更长。
input: [{10, 12, 14, 16, 18, 20, 22, 24, 26, 28},
{50, 52, 54, 56, 58, 60, 62, 64, 66, 68}]
indices: {1, 3, 5, 9, 2, 4, 8, 8}
output: [{{12, 14}, {20, 22, 24, 26}, {14, 16}, {}},
{{52, 54}, {60, 22, 24, 26}, {14, 16}, {}}]
异常
std::invalid_argument如果 indices 大小不是偶数。
std::invalid_argument当对中的值严格递减时。
std::out_of_range当对中的任何值不属于范围 [0, input.size()) 时。
参数
input要切片的表视图
indices用于对 input 进行切片的索引
stream用于设备内存操作和内核启动的 CUDA 流
返回值
indices 中的范围指示的 input 视图向量