Line data Source code
1 : // SPDX-License-Identifier: BSD-3-Clause 2 : // Copyright (c) 2023 Scipp contributors (https://github.com/scipp) 3 : #include "scipp/core/element/special_values.h" 4 : #include "scipp/variable/special_values.h" 5 : #include "scipp/variable/transform.h" 6 : 7 : using namespace scipp::core; 8 : 9 : namespace scipp::variable { 10 : 11 10 : Variable &nan_to_num(const Variable &var, const Variable &replacement, 12 : Variable &out) { 13 10 : transform_in_place(out, var, replacement, element::nan_to_num_out_arg, 14 : "nan_to_num"); 15 6 : return out; 16 : } 17 : 18 3 : Variable &positive_inf_to_num(const Variable &var, const Variable &replacement, 19 : Variable &out) { 20 3 : transform_in_place(out, var, replacement, 21 : element::positive_inf_to_num_out_arg, 22 : "positive_inf_to_num"); 23 3 : return out; 24 : } 25 3 : Variable &negative_inf_to_num(const Variable &var, const Variable &replacement, 26 : Variable &out) { 27 3 : transform_in_place(out, var, replacement, 28 : element::negative_inf_to_num_out_arg, 29 : "negative_inf_to_num"); 30 3 : return out; 31 : } 32 : 33 4 : Variable nan_to_num(const Variable &var, const Variable &replacement) { 34 4 : return transform(var, replacement, element::nan_to_num, "nan_to_num"); 35 : } 36 : 37 1 : Variable pos_inf_to_num(const Variable &var, const Variable &replacement) { 38 : return transform(var, replacement, element::positive_inf_to_num, 39 1 : "pos_inf_to_num"); 40 : } 41 : 42 1 : Variable neg_inf_to_num(const Variable &var, const Variable &replacement) { 43 : return transform(var, replacement, element::negative_inf_to_num, 44 1 : "neg_inf_to_num"); 45 : } 46 : 47 : } // namespace scipp::variable