Files | Enumerations | Functions
Unary Operations

Files

file  round.hpp
 Column APIs for round.
 
file  unary.hpp
 Column APIs for unary ops.
 

Enumerations

enum  cudf::rounding_method : int32_t { HALF_UP, HALF_EVEN }
 Different rounding methods for cudf::round More...
 
enum  unary_operator : int32_t {
  SIN, COS, TAN, ARCSIN,
  ARCCOS, ARCTAN, SINH, COSH,
  TANH, ARCSINH, ARCCOSH, ARCTANH,
  EXP, LOG, SQRT, CBRT,
  CEIL, FLOOR, ABS, RINT,
  BIT_INVERT, NOT
}
 

Functions

std::unique_ptr< columncudf::round (column_view const &input, int32_t decimal_places=0, rounding_method method=rounding_method::HALF_UP, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Rounds all the values in a column to the specified number of decimal places. More...
 
std::unique_ptr< cudf::columncudf::unary_operation (cudf::column_view const &input, cudf::unary_operator op, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Performs unary op on all values in column. More...
 
std::unique_ptr< cudf::columncudf::is_null (cudf::column_view const &input, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Creates a column of type_id::BOOL8 elements where for every element in input true indicates the value is null and false indicates the value is valid. More...
 
std::unique_ptr< cudf::columncudf::is_valid (cudf::column_view const &input, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Creates a column of type_id::BOOL8 elements where for every element in input true indicates the value is valid and false indicates the value is null. More...
 
std::unique_ptr< columncudf::cast (column_view const &input, data_type out_type, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Casts data from dtype specified in input to dtype specified in output. More...
 
std::unique_ptr< columncudf::is_nan (cudf::column_view const &input, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Creates a column of type_id::BOOL8 elements indicating the presence of NaN values in a column of floating point values. The output element at row i is true if the element in input at row i is NAN, else false More...
 
std::unique_ptr< columncudf::is_not_nan (cudf::column_view const &input, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
 Creates a column of type_id::BOOL8 elements indicating the absence of NaN values in a column of floating point values. The output element at row i is false if the element in input at row i is NAN, else true More...
 

Detailed Description

Enumeration Type Documentation

◆ rounding_method

enum cudf::rounding_method : int32_t
strong

Different rounding methods for cudf::round

Info on HALF_UP rounding: https://en.wikipedia.org/wiki/Rounding#Round_half_up Info on HALF_EVEN rounding: https://en.wikipedia.org/wiki/Rounding#Round_half_to_even

Definition at line 36 of file round.hpp.

Function Documentation

◆ cast()

std::unique_ptr<column> cudf::cast ( column_view const &  input,
data_type  out_type,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Casts data from dtype specified in input to dtype specified in output.

Supports only fixed-width types.

Parameters
column_viewInput column
out_typeDesired datatype of output column
mrDevice memory resource used to allocate the returned column's device memory
Returns
Column of same size as input containing result of the cast operation
Exceptions
cudf::logic_errorif out_type is not a fixed-width type

◆ is_nan()

std::unique_ptr<column> cudf::is_nan ( cudf::column_view const &  input,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Creates a column of type_id::BOOL8 elements indicating the presence of NaN values in a column of floating point values. The output element at row i is true if the element in input at row i is NAN, else false

Exceptions
cudf::logic_errorif input is a non-floating point type
Parameters
inputA column of floating-point elements
mrDevice memory resource used to allocate the returned column's device memory.
Returns
A non-nullable column of type_id::BOOL8 elements with true representing NAN values

◆ is_not_nan()

std::unique_ptr<column> cudf::is_not_nan ( cudf::column_view const &  input,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Creates a column of type_id::BOOL8 elements indicating the absence of NaN values in a column of floating point values. The output element at row i is false if the element in input at row i is NAN, else true

Exceptions
cudf::logic_errorif input is a non-floating point type
Parameters
inputA column of floating-point elements
mrDevice memory resource used to allocate the returned column's device memory.
Returns
A non-nullable column of type_id::BOOL8 elements with false representing NAN values

◆ is_null()

std::unique_ptr<cudf::column> cudf::is_null ( cudf::column_view const &  input,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Creates a column of type_id::BOOL8 elements where for every element in input true indicates the value is null and false indicates the value is valid.

Parameters
inputA column_view as input
mrDevice memory resource used to allocate the returned column's device memory
Returns
A non-nullable column of type_id::BOOL8 elements with true representing null values.

◆ is_valid()

std::unique_ptr<cudf::column> cudf::is_valid ( cudf::column_view const &  input,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Creates a column of type_id::BOOL8 elements where for every element in input true indicates the value is valid and false indicates the value is null.

Parameters
inputA column_view as input
mrDevice memory resource used to allocate the returned column's device memory
Returns
A non-nullable column of type_id::BOOL8 elements with false representing null values.

◆ round()

std::unique_ptr<column> cudf::round ( column_view const &  input,
int32_t  decimal_places = 0,
rounding_method  method = rounding_method::HALF_UP,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Rounds all the values in a column to the specified number of decimal places.

cudf::round currently supports HALF_UP and HALF_EVEN rounding for integer, floating point and decimal32 and decimal64 numbers. For decimal32 and decimal64 numbers, negated numeric::scale is equivalent to decimal_places.

Example:

using namespace cudf;
column_view a; // contains { 1.729, 17.29, 172.9, 1729 };
auto result1 = round(a); // { 2, 17, 173, 1729 }
auto result2 = round(a, 1); // { 1.7, 17.3, 172.9, 1729 }
auto result3 = round(a, -1); // { 0, 20, 170, 1730 }
column_view b; // contains { 1.5, 2.5, 1.35, 1.45, 15, 25 };
auto result4 = round(b, 0, rounding_method::HALF_EVEN); // { 2, 2, 1, 1, 15, 25};
auto result5 = round(b, 1, rounding_method::HALF_EVEN); // { 1.5, 2.5, 1.4, 1.4, 15, 25};
auto result6 = round(b, -1, rounding_method::HALF_EVEN); // { 0, 0, 0, 0, 20, 20};
Parameters
inputColumn of values to be rounded
decimal_placesNumber of decimal places to round to (default 0). If negative, this specifies the number of positions to the left of the decimal point.
methodRounding method
mrDevice memory resource used to allocate the returned column's device memory
Returns
std::unique_ptr<column> Column with each of the values rounded

◆ unary_operation()

std::unique_ptr<cudf::column> cudf::unary_operation ( cudf::column_view const &  input,
cudf::unary_operator  op,
rmm::mr::device_memory_resource mr = rmm::mr::get_current_device_resource() 
)

Performs unary op on all values in column.

Note: For decimal32 and decimal64, only ABS, CEIL and FLOOR are supported.

Parameters
inputA column_view as input
opoperation to perform
mrDevice memory resource used to allocate the returned column's device memory
Returns
Column of same size as input containing result of the operation
cudf::column_view
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
Definition: column_view.hpp:294
cudf::round
std::unique_ptr< column > round(column_view const &input, int32_t decimal_places=0, rounding_method method=rounding_method::HALF_UP, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Rounds all the values in a column to the specified number of decimal places.
cudf
cuDF interfaces
Definition: aggregation.hpp:34