Turi Create
4.0
unity_sarray_binary_operations.hpp
1
/* Copyright © 2017 Apple Inc. All rights reserved.
2
*
3
* Use of this source code is governed by a BSD-3-clause license that can
4
* be found in the LICENSE.txt file or at https://opensource.org/licenses/BSD-3-Clause
5
*/
6
#ifndef UNITY_LIB_UNITY_SARRAY_BINARY_OPERATIONS_HPP
7
#define UNITY_LIB_UNITY_SARRAY_BINARY_OPERATIONS_HPP
8
#include <string>
9
#include <functional>
10
#include <core/data/flexible_type/flexible_type.hpp>
11
namespace
turi
{
12
namespace
unity_sarray_binary_operations {
13
14
/**
15
* Internal function to check if two flexible type can perform a binary operation
16
* against each other. Throws a string message on encountering infeasibility.
17
*/
18
void
check_operation_feasibility(
flex_type_enum
left,
19
flex_type_enum
right,
20
std::string op);
21
22
23
/**
24
* Given a binary operation type, and the input type, returns the output type.
25
* The operation must be one of the following: "+", "-", "*", "/", "<", ">",
26
* "<=", ">=", "==", "!=". The type of the new array is dependent on the
27
* semantics of the operation. check_operation_feasibility is assumed to be true.
28
* - comparison operators always return integers
29
* - +,-,* of integer against integers always return integers
30
* - / of integer against integer always returns floats
31
* - +,-,*,/ of floats against floats always return floats
32
* - +,-,*,/ of integer against floats or floats against integers
33
* always return floats.
34
*/
35
flex_type_enum
get_output_type(
flex_type_enum
left,
36
flex_type_enum
right,
37
std::string op);
38
39
/**
40
* Given a binary operation type, returns a lambda function which computes the
41
* function on a pair of flexible_types.
42
* The operation must be one of the following: "+", "-", "*", "/", "<", ">",
43
* "<=", ">=", "==", "!=". The type of the new array is dependent on the
44
* semantics of the operation. check_operation_feasibility is assumed to be true.
45
* - comparison operators always return integers
46
* - +,-,* of integer against integers always return integers
47
* - / of integer against integer always returns floats
48
* - +,-,*,/ of floats against floats always return floats
49
* - +,-,*,/ of integer against floats or floats against integers
50
* always return floats.
51
*/
52
std::function<flexible_type(const flexible_type&, const flexible_type&)>
53
get_binary_operator(
flex_type_enum
left,
flex_type_enum
right, std::string op);
54
}
// namespace unity_sarray_binary_operations
55
}
// namespace turi
56
#endif
turi
SKD.
Definition:
capi_initialization.hpp:11
turi::flex_type_enum
flex_type_enum
Definition:
flexible_type_base_types.hpp:332
core
storage
sframe_interface
unity_sarray_binary_operations.hpp
Generated by
1.8.13