libcudf
23.12.00
|
Files | |
file | filling.hpp |
Column APIs for fill, repeat, and 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::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Generate a sequence of timestamps beginning at init
and incrementing by months
for each successive element, i.e., output[i] = init + i * months
for i
in [0, size)
.
If a given date is invalid, the date is scaled back to the last available day of that month.
Example:
cudf::logic_error | if input datatype is not a TIMESTAMP |
size | Number of timestamps to generate |
init | The initial timestamp |
months | Months to increment |
stream | CUDA stream used for device memory operations and kernel launches |
mr | Device memory resource used to allocate the returned column's device memory |
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::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Fills a range of elements in a column out-of-place with a scalar value.
Creates a new column as-if an in-place fill was performed into input
; i.e. it is as if a copy of input
was created first and then the elements indicated by the indices [begin
, end
) were overwritten by value
.
cudf::logic_error | for invalid range (if begin < 0, begin > end , or end > destination.size() ). |
cudf::logic_error | if destination and value have different types. |
input | The input column used to create a new column. The new column is created by replacing the values of input in the specified range with value . |
begin | The starting index of the fill range (inclusive) |
end | The index of the last element in the fill range (exclusive) |
value | The scalar value to fill |
stream | CUDA stream used for device memory operations and kernel launches |
mr | Device memory resource used to allocate the returned column's device memory |
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() |
||
) |
Fills a range of elements in-place in a column with a scalar value.
Fills N elements of destination
starting at begin
with value
, where N = (end
- begin
).
Overwrites the range of elements in destination
indicated by the indices [begin
, end
) with value
. Use the out-of-place fill function returning std::unique_ptr<column> for use cases requiring memory reallocation.
cudf::logic_error | if memory reallocation is required (e.g. for variable width types). |
cudf::logic_error | for invalid range (if begin < 0, begin > end , or end > destination.size() ). |
cudf::logic_error | if destination and value have different types. |
cudf::logic_error | if value is invalid but destination is not nullable. |
destination | The preallocated column to fill into |
begin | The starting index of the fill range (inclusive) |
end | The index of the last element in the fill range (exclusive) |
value | The scalar value to fill |
stream | CUDA stream used for device memory operations and kernel launches |
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::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Repeat rows of a Table.
Creates a new table by repeating the rows of input_table
. The number of repetitions of each element is defined by the value at the corresponding index of count
Example:
count
should not have null values; should not contain negative values; and the sum of count elements should not overflow the size_type's limit. The behavior of this function is undefined if count
has negative values or the sum overflows.
cudf::logic_error | if the data type of count is not size_type. |
cudf::logic_error | if input_table and count have different number of rows. |
cudf::logic_error | if count has null values. |
input_table | Input table |
count | Non-nullable column of an integral type |
stream | CUDA stream used for device memory operations and kernel launches |
mr | Device memory resource used to allocate the returned table's device memory |
std::unique_ptr<table> cudf::repeat | ( | table_view const & | input_table, |
size_type | count, | ||
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Repeat rows of a Table.
Creates a new table by repeating count
times the rows of input_table
. Example:
cudf::logic_error | if count is negative. |
std::overflow_error | if input_table.num_rows() * count overflows size_type. |
input_table | Input table |
count | Number of repetitions |
stream | CUDA stream used for device memory operations and kernel launches |
mr | Device memory resource used to allocate the returned table's device memory |
std::unique_ptr<column> cudf::sequence | ( | size_type | size, |
scalar const & | init, | ||
rmm::cuda_stream_view | stream = cudf::get_default_stream() , |
||
rmm::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Fills a column with a sequence of value specified by an initial value and a step of 1.
Creates a new column and fills with size
values starting at init
and incrementing by 1, generating the sequence [ init, init+1, init+2, ... init + (size - 1)]
cudf::logic_error | if init is not numeric. |
cudf::logic_error | if size is < 0. |
size | Size of the output column |
init | First value in the sequence |
stream | CUDA stream used for device memory operations and kernel launches |
mr | Device memory resource used to allocate the returned column's device memory |
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::mr::device_memory_resource * | mr = rmm::mr::get_current_device_resource() |
||
) |
Fills a column with a sequence of value specified by an initial value and a step.
Creates a new column and fills with size
values starting at init
and incrementing by step
, generating the sequence [ init, init+step, init+2*step, ... init + (size - 1)*step]
cudf::logic_error | if init and step are not the same type. |
cudf::logic_error | if scalar types are not numeric. |
cudf::logic_error | if size is < 0. |
size | Size of the output column |
init | First value in the sequence |
step | Increment value |
stream | CUDA stream used for device memory operations and kernel launches |
mr | Device memory resource used to allocate the returned column's device memory |