libcudf  23.12.00
Files | Functions

Files

file  copying.hpp
 Column APIs for gather, scatter, split, slice, etc.
 

Functions

std::vector< column_viewcudf::slice (column_view const &input, host_span< size_type const > indices, rmm::cuda_stream_view stream=cudf::get_default_stream())
 Slices a column_view into a set of column_views according to a set of indices. More...
 
std::vector< column_viewcudf::slice (column_view const &input, std::initializer_list< size_type > indices, rmm::cuda_stream_view stream=cudf::get_default_stream())
 Slices a column_view into a set of column_views according to a set of indices. More...
 
std::vector< table_viewcudf::slice (table_view const &input, host_span< size_type const > indices, rmm::cuda_stream_view stream=cudf::get_default_stream())
 Slices a table_view into a set of table_views according to a set of indices. More...
 
std::vector< table_viewcudf::slice (table_view const &input, std::initializer_list< size_type > indices, rmm::cuda_stream_view stream=cudf::get_default_stream())
 Slices a table_view into a set of table_views according to a set of indices. More...
 

Detailed Description

Function Documentation

◆ 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() 
)

Slices a column_view into a set of column_views according to a set of indices.

The returned views of input are constructed from an even number indices where the ith returned column_view views the elements in input indicated by the range [indices[2*i], indices[(2*i)+1]).

For all i it is expected indices[i] <= input.size() For all i%2==0, it is expected that indices[i] <= indices[i+1]

Note
It is the caller's responsibility to ensure that the returned views do not outlive the viewed device memory.
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}, {}}
Exceptions
cudf::logic_errorif indices size is not even.
cudf::logic_errorWhen the values in the pair are strictly decreasing.
cudf::logic_errorWhen any of the values in the pair don't belong to the range [0, input.size()).
Parameters
inputView of column to slice
indicesIndices used to take slices of input
streamCUDA stream used for device memory operations and kernel launches
Returns
Vector of views of input indicated by the ranges in indices

◆ 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() 
)

Slices a column_view into a set of column_views according to a set of indices.

The returned views of input are constructed from an even number indices where the ith returned column_view views the elements in input indicated by the range [indices[2*i], indices[(2*i)+1]).

For all i it is expected indices[i] <= input.size() For all i%2==0, it is expected that indices[i] <= indices[i+1]

Note
It is the caller's responsibility to ensure that the returned views do not outlive the viewed device memory.
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}, {}}
Exceptions
cudf::logic_errorif indices size is not even.
cudf::logic_errorWhen the values in the pair are strictly decreasing.
cudf::logic_errorWhen any of the values in the pair don't belong to the range [0, input.size()).
Parameters
inputView of column to slice
indicesIndices used to take slices of input
streamCUDA stream used for device memory operations and kernel launches
Returns
Vector of views of input indicated by the ranges in indices

◆ 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() 
)

Slices a table_view into a set of table_views according to a set of indices.

The returned views of input are constructed from an even number indices where the ith returned table_view views the elements in input indicated by the range [indices[2*i], indices[(2*i)+1]).

For all i it is expected indices[i] <= input.size() For all i%2==0, it is expected that indices[i] <= indices[i+1]

Note
It is the caller's responsibility to ensure that the returned views do not outlive the viewed device memory.
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}, {}}]
Exceptions
cudf::logic_errorif indices size is not even.
cudf::logic_errorWhen the values in the pair are strictly decreasing.
cudf::logic_errorWhen any of the values in the pair don't belong to the range [0, input.size()).
Parameters
inputView of table to slice
indicesIndices used to take slices of input
streamCUDA stream used for device memory operations and kernel launches
Returns
Vector of views of input indicated by the ranges in indices

◆ 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() 
)

Slices a table_view into a set of table_views according to a set of indices.

The returned views of input are constructed from an even number indices where the ith returned table_view views the elements in input indicated by the range [indices[2*i], indices[(2*i)+1]).

For all i it is expected indices[i] <= input.size() For all i%2==0, it is expected that indices[i] <= indices[i+1]

Note
It is the caller's responsibility to ensure that the returned views do not outlive the viewed device memory.
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}, {}}]
Exceptions
cudf::logic_errorif indices size is not even.
cudf::logic_errorWhen the values in the pair are strictly decreasing.
cudf::logic_errorWhen any of the values in the pair don't belong to the range [0, input.size()).
Parameters
inputView of table to slice
indicesIndices used to take slices of input
streamCUDA stream used for device memory operations and kernel launches
Returns
Vector of views of input indicated by the ranges in indices