binaryop.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2023, NVIDIA CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <cudf/column/column.hpp>
20 #include <cudf/scalar/scalar.hpp>
21 
23 
24 #include <memory>
25 
26 namespace cudf {
27 
38 enum class binary_operator : int32_t {
39  ADD,
40  SUB,
41  MUL,
42  DIV,
43  TRUE_DIV,
44  FLOOR_DIV,
52  MOD,
53  PMOD,
56  PYMOD,
57  POW,
58  INT_POW,
60  LOG_BASE,
61  ATAN2,
62  SHIFT_LEFT,
63  SHIFT_RIGHT,
66  BITWISE_AND,
67  BITWISE_OR,
68  BITWISE_XOR,
69  LOGICAL_AND,
70  LOGICAL_OR,
71  EQUAL,
72  NOT_EQUAL,
73  LESS,
74  GREATER,
75  LESS_EQUAL,
77  NULL_EQUALS,
79  NULL_MAX,
81  NULL_MIN,
90 };
113 std::unique_ptr<column> binary_operation(
114  scalar const& lhs,
115  column_view const& rhs,
116  binary_operator op,
117  data_type output_type,
118  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
119 
142 std::unique_ptr<column> binary_operation(
143  column_view const& lhs,
144  scalar const& rhs,
145  binary_operator op,
146  data_type output_type,
147  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
148 
170 std::unique_ptr<column> binary_operation(
171  column_view const& lhs,
172  column_view const& rhs,
173  binary_operator op,
174  data_type output_type,
175  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
176 
199 std::unique_ptr<column> binary_operation(
200  column_view const& lhs,
201  column_view const& rhs,
202  std::string const& ptx,
203  data_type output_type,
204  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
205 
215  int32_t left_scale,
216  int32_t right_scale);
217 
227  cudf::data_type const& lhs,
228  cudf::data_type const& rhs);
229 
230 namespace binops {
231 
241 std::pair<rmm::device_buffer, size_type> scalar_col_valid_mask_and(
242  column_view const& col,
243  scalar const& s,
245  rmm::mr::device_memory_resource* mr = rmm::mr::get_current_device_resource());
246 
247 namespace compiled {
248 namespace detail {
249 
262  column_view const& lhs,
263  column_view const& rhs,
264  bool is_lhs_scalar,
265  bool is_rhs_scalar,
266  binary_operator op,
267  rmm::cuda_stream_view stream);
268 } // namespace detail
269 } // namespace compiled
270 } // namespace binops
271  // end of group
273 } // namespace cudf
std::pair< rmm::device_buffer, size_type > scalar_col_valid_mask_and(column_view const &col, scalar const &s, rmm::cuda_stream_view stream=cudf::get_default_stream(), rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Computes output valid mask for op between a column and a scalar.
void apply_sorting_struct_binary_op(mutable_column_view &out, column_view const &lhs, column_view const &rhs, bool is_lhs_scalar, bool is_rhs_scalar, binary_operator op, rmm::cuda_stream_view stream)
struct binary operation using NaN aware sorting physical element comparators
A non-owning, immutable view of device data as a column of elements, some of which may be null as ind...
Indicator for the logical data type of an element in a column.
Definition: types.hpp:227
A non-owning, mutable view of device data as a column of elements, some of which may be null as indic...
An owning class to represent a singular value.
Definition: scalar.hpp:48
Class definition for cudf::column.
binary_operator
Types of binary operations that can be performed on data.
Definition: binaryop.hpp:38
cudf::data_type binary_operation_fixed_point_output_type(binary_operator op, cudf::data_type const &lhs, cudf::data_type const &rhs)
Computes the data_type for a fixed_point number based on given binary operator op
std::unique_ptr< column > binary_operation(scalar const &lhs, column_view const &rhs, binary_operator op, data_type output_type, rmm::mr::device_memory_resource *mr=rmm::mr::get_current_device_resource())
Performs a binary operation between a scalar and a column.
int32_t binary_operation_fixed_point_scale(binary_operator op, int32_t left_scale, int32_t right_scale)
Computes the scale for a fixed_point number based on given binary operator op
@ INVALID_BINARY
invalid operation
@ LOGICAL_OR
operator ||
@ BITWISE_OR
operator |
@ LOG_BASE
logarithm to the base
@ DIV
operator / using common type of lhs and rhs
@ PYMOD
operator % but following Python's sign rules for negatives
@ NOT_EQUAL
operator !=
@ BITWISE_XOR
operator ^
@ GREATER_EQUAL
operator >=
@ LESS_EQUAL
operator <=
@ TRUE_DIV
operator / after promoting type to floating point
@ LOGICAL_AND
operator &&
@ BITWISE_AND
operator &
@ SHIFT_LEFT
operator <<
@ SHIFT_RIGHT
operator >>
@ ATAN2
2-argument arctangent
cuDF interfaces
Definition: aggregation.hpp:34
rmm::cuda_stream_view const get_default_stream()
Get the current default stream.
Class definitions for cudf::scalar.