Files | Enumerations | Functions
Unary Operations

Files

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

Enumerations

enum class  cudf::rounding_method : int32_t { HALF_UP , HALF_EVEN }
 Different rounding methods for cudf::round More...
 
enum class  cudf::unary_operator : int32_t {
  cudf::SIN , cudf::COS , cudf::TAN , cudf::ARCSIN ,
  cudf::ARCCOS , cudf::ARCTAN , cudf::SINH , cudf::COSH ,
  cudf::TANH , cudf::ARCSINH , cudf::ARCCOSH , cudf::ARCTANH ,
  cudf::EXP , cudf::LOG , cudf::SQRT , cudf::CBRT ,
  cudf::CEIL , cudf::FLOOR , cudf::ABS , cudf::RINT ,
  cudf::BIT_INVERT , cudf::NOT
}
 Types of unary operations that can be performed on data. More...
 

Functions

std::unique_ptr< columncudf::round (column_view const &input, int32_t decimal_places=0, rounding_method method=rounding_method::HALF_UP, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 Rounds all the values in a column to the specified number of decimal places. More...
 
template<typename Fixed , typename Floating , CUDF_ENABLE_IF(cuda::std::is_floating_point_v< Floating > &&is_fixed_point< Fixed >()) >
CUDF_HOST_DEVICE Fixed cudf::convert_floating_to_fixed (Floating floating, numeric::scale_type scale)
 Convert a floating-point value to fixed point. More...
 
template<typename Floating , typename Fixed , CUDF_ENABLE_IF(cuda::std::is_floating_point_v< Floating > &&is_fixed_point< Fixed >()) >
CUDF_HOST_DEVICE Floating cudf::convert_fixed_to_floating (Fixed fixed)
 Convert a fixed-point value to floating point. More...
 
template<typename Floating , typename Input , CUDF_ENABLE_IF(cuda::std::is_floating_point_v< Floating >) >
CUDF_HOST_DEVICE Floating cudf::convert_to_floating (Input input)
 Convert a value to floating point. More...
 
std::unique_ptr< cudf::columncudf::unary_operation (cudf::column_view const &input, cudf::unary_operator op, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 Performs unary op on all values in column. More...
 
std::unique_ptr< cudf::columncudf::is_null (cudf::column_view const &input, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 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::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 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::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 Casts data from dtype specified in input to dtype specified in output. More...
 
bool cudf::is_supported_cast (data_type from, data_type to) noexcept
 Check if a cast between two datatypes is supported. More...
 
std::unique_ptr< columncudf::is_nan (cudf::column_view const &input, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 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::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
 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_EVEN rounding: https://en.wikipedia.org/wiki/Rounding#Rounding_half_to_even Info on HALF_UP rounding: https://en.wikipedia.org/wiki/Rounding#Rounding_half_away_from_zero Note: HALF_UP means up in MAGNITUDE: Away from zero! Because of how Java and python define it

Definition at line 40 of file round.hpp.

◆ unary_operator

enum cudf::unary_operator : int32_t
strong

Types of unary operations that can be performed on data.

Enumerator
SIN 

Trigonometric sine.

COS 

Trigonometric cosine.

TAN 

Trigonometric tangent.

ARCSIN 

Trigonometric sine inverse.

ARCCOS 

Trigonometric cosine inverse.

ARCTAN 

Trigonometric tangent inverse.

SINH 

Hyperbolic sine.

COSH 

Hyperbolic cosine.

TANH 

Hyperbolic tangent.

ARCSINH 

Hyperbolic sine inverse.

ARCCOSH 

Hyperbolic cosine inverse.

ARCTANH 

Hyperbolic tangent inverse.

EXP 

Exponential (base e, Euler number)

LOG 

Natural Logarithm (base e)

SQRT 

Square-root (x^0.5)

CBRT 

Cube-root (x^(1.0/3))

CEIL 

Smallest integer value not less than arg.

FLOOR 

largest integer value not greater than arg

ABS 

Absolute value.

RINT 

Rounds the floating-point argument arg to an integer value.

BIT_INVERT 

Bitwise Not (~)

NOT 

Logical Not (!)

Definition at line 119 of file unary.hpp.

Function Documentation

◆ cast()

std::unique_ptr<column> cudf::cast ( column_view const &  input,
data_type  out_type,
rmm::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

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

Supports only fixed-width types.

Parameters
inputInput column
out_typeDesired datatype of output column
streamCUDA stream used for device memory operations and kernel launches
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

◆ convert_fixed_to_floating()

template<typename Floating , typename Fixed , CUDF_ENABLE_IF(cuda::std::is_floating_point_v< Floating > &&is_fixed_point< Fixed >()) >
CUDF_HOST_DEVICE Floating cudf::convert_fixed_to_floating ( Fixed  fixed)

Convert a fixed-point value to floating point.

Note
This conversion was moved from fixed-point member functions to free functions. This is so that the complex conversion code is not included into many parts of the code base that don't need it, and so that it's more obvious to pinpoint where these conversions are occurring.
Template Parameters
FloatingThe floating-point type to convert to
FixedThe fixed-point type to convert from
Parameters
fixedThe fixed-point value to convert
Returns
The converted floating-point value

Definition at line 84 of file unary.hpp.

◆ convert_floating_to_fixed()

template<typename Fixed , typename Floating , CUDF_ENABLE_IF(cuda::std::is_floating_point_v< Floating > &&is_fixed_point< Fixed >()) >
CUDF_HOST_DEVICE Fixed cudf::convert_floating_to_fixed ( Floating  floating,
numeric::scale_type  scale 
)

Convert a floating-point value to fixed point.

Note
This conversion was moved from fixed-point member functions to free functions. This is so that the complex conversion code is not included into many parts of the code base that don't need it, and so that it's more obvious to pinpoint where these conversions are occurring.
Template Parameters
FixedThe fixed-point type to convert to
FloatingThe floating-point type to convert from
Parameters
floatingThe floating-point value to convert
scaleThe desired scale of the fixed-point value
Returns
The converted fixed-point value

Definition at line 54 of file unary.hpp.

◆ convert_to_floating()

template<typename Floating , typename Input , CUDF_ENABLE_IF(cuda::std::is_floating_point_v< Floating >) >
CUDF_HOST_DEVICE Floating cudf::convert_to_floating ( Input  input)

Convert a value to floating point.

Template Parameters
FloatingThe floating-point type to convert to
InputThe input type to convert from
Parameters
inputThe input value to convert
Returns
The converted floating-point value

Definition at line 107 of file unary.hpp.

◆ is_nan()

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
streamCUDA stream used for device memory operations and kernel launches
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()

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
streamCUDA stream used for device memory operations and kernel launches
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()

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
streamCUDA stream used for device memory operations and kernel launches
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_supported_cast()

bool cudf::is_supported_cast ( data_type  from,
data_type  to 
)
noexcept

Check if a cast between two datatypes is supported.

Parameters
fromsource type
totarget type
Returns
true if the cast is supported.

◆ is_valid()

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
streamCUDA stream used for device memory operations and kernel launches
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::cuda_stream_view  stream = cudf::get_default_stream(),
rmm::device_async_resource_ref  mr = cudf::get_current_device_resource_ref() 
)

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};
std::unique_ptr< column > round(column_view const &input, int32_t decimal_places=0, rounding_method method=rounding_method::HALF_UP, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::device_async_resource_ref mr=cudf::get_current_device_resource_ref())
Rounds all the values in a column to the specified number of decimal places.
cuDF interfaces
Definition: aggregation.hpp:35
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
streamCUDA stream used for device memory operations and kernel launches
mrDevice memory resource used to allocate the returned column's device memory
Returns
Column with each of the values rounded

◆ unary_operation()

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
streamCUDA stream used for device memory operations and kernel launches
mrDevice memory resource used to allocate the returned column's device memory
Returns
Column of same size as input containing result of the operation