1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124
|
function codegen_sel
%CODEGEN_SEL create functions for all selection operators
%
% This function creates all files of the form GB_sel__*.c,
% and the include file GB_sel__include.h.
% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2025, All Rights Reserved.
% SPDX-License-Identifier: Apache-2.0
fprintf ('\nselection operators:\n') ;
% addpath ('../../Test') ;
fh = fopen ('../../FactoryKernels/GB_sel__include.h', 'w') ;
fprintf (fh, '//------------------------------------------------------------------------------\n') ;
fprintf (fh, '// GB_sel__include.h: definitions for GB_sel__*.c\n') ;
fprintf (fh, '//------------------------------------------------------------------------------\n') ;
fprintf (fh, '\n') ;
fprintf (fh, '// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2025, All Rights Reserved.\n') ;
fprintf (fh, '// SPDX-License-Identifier: Apache-2.0\n\n') ;
fprintf (fh, '// This file has been automatically generated from Generator/GB_sel.h') ;
fprintf (fh, '\n#include "math/GB_math.h"\n\n') ;
fclose (fh) ;
% NONZOMBIE: name selector type
fprintf ('\nnonzombie ') ;
codegen_sel_method ('nonzombie', 'bool keep = (i >= 0)', 'bool' ) ;
codegen_sel_method ('nonzombie', 'bool keep = (i >= 0)', 'int8_t' ) ;
codegen_sel_method ('nonzombie', 'bool keep = (i >= 0)', 'int16_t' ) ;
codegen_sel_method ('nonzombie', 'bool keep = (i >= 0)', 'int32_t' ) ;
codegen_sel_method ('nonzombie', 'bool keep = (i >= 0)', 'int64_t' ) ;
codegen_sel_method ('nonzombie', 'bool keep = (i >= 0)', 'uint8_t' ) ;
codegen_sel_method ('nonzombie', 'bool keep = (i >= 0)', 'uint16_t' ) ;
codegen_sel_method ('nonzombie', 'bool keep = (i >= 0)', 'uint32_t' ) ;
codegen_sel_method ('nonzombie', 'bool keep = (i >= 0)', 'uint64_t' ) ;
codegen_sel_method ('nonzombie', 'bool keep = (i >= 0)', 'float' ) ;
codegen_sel_method ('nonzombie', 'bool keep = (i >= 0)', 'double' ) ;
codegen_sel_method ('nonzombie', 'bool keep = (i >= 0)', 'GxB_FC32_t') ;
codegen_sel_method ('nonzombie', 'bool keep = (i >= 0)', 'GxB_FC64_t') ;
% NE_THUNK name selector type
fprintf ('\nne_thunk ') ;
codegen_sel_method ('ne_thunk' , 'bool keep = (Ax [p] != y)', 'int8_t' ) ;
codegen_sel_method ('ne_thunk' , 'bool keep = (Ax [p] != y)', 'int16_t' ) ;
codegen_sel_method ('ne_thunk' , 'bool keep = (Ax [p] != y)', 'int32_t' ) ;
codegen_sel_method ('ne_thunk' , 'bool keep = (Ax [p] != y)', 'int64_t' ) ;
codegen_sel_method ('ne_thunk' , 'bool keep = (Ax [p] != y)', 'uint8_t' ) ;
codegen_sel_method ('ne_thunk' , 'bool keep = (Ax [p] != y)', 'uint16_t') ;
codegen_sel_method ('ne_thunk' , 'bool keep = (Ax [p] != y)', 'uint32_t') ;
codegen_sel_method ('ne_thunk' , 'bool keep = (Ax [p] != y)', 'uint64_t') ;
codegen_sel_method ('ne_thunk' , 'bool keep = (Ax [p] != y)', 'float' ) ;
codegen_sel_method ('ne_thunk' , 'bool keep = (Ax [p] != y)', 'double' ) ;
codegen_sel_method ('ne_thunk' , 'bool keep = GB_FC32_ne (Ax [p], y)', 'GxB_FC32_t') ;
codegen_sel_method ('ne_thunk' , 'bool keep = GB_FC64_ne (Ax [p], y)', 'GxB_FC64_t') ;
% EQ_THUNK name selector type
fprintf ('\neq_thunk ') ;
codegen_sel_method ('eq_thunk' , 'bool keep = (Ax [p] == y)', 'bool' ) ;
codegen_sel_method ('eq_thunk' , 'bool keep = (Ax [p] == y)', 'int8_t' ) ;
codegen_sel_method ('eq_thunk' , 'bool keep = (Ax [p] == y)', 'int16_t' ) ;
codegen_sel_method ('eq_thunk' , 'bool keep = (Ax [p] == y)', 'int32_t' ) ;
codegen_sel_method ('eq_thunk' , 'bool keep = (Ax [p] == y)', 'int64_t' ) ;
codegen_sel_method ('eq_thunk' , 'bool keep = (Ax [p] == y)', 'uint8_t' ) ;
codegen_sel_method ('eq_thunk' , 'bool keep = (Ax [p] == y)', 'uint16_t') ;
codegen_sel_method ('eq_thunk' , 'bool keep = (Ax [p] == y)', 'uint32_t') ;
codegen_sel_method ('eq_thunk' , 'bool keep = (Ax [p] == y)', 'uint64_t') ;
codegen_sel_method ('eq_thunk' , 'bool keep = (Ax [p] == y)', 'float' ) ;
codegen_sel_method ('eq_thunk' , 'bool keep = (Ax [p] == y)', 'double' ) ;
codegen_sel_method ('eq_thunk' , 'bool keep = GB_FC32_eq (Ax [p], y)', 'GxB_FC32_t') ;
codegen_sel_method ('eq_thunk' , 'bool keep = GB_FC64_eq (Ax [p], y)', 'GxB_FC64_t') ;
% GT_THUNK name selector type
fprintf ('\ngt_thunk ') ;
codegen_sel_method ('gt_thunk' , 'bool keep = (Ax [p] > y)', 'int8_t' ) ;
codegen_sel_method ('gt_thunk' , 'bool keep = (Ax [p] > y)', 'int16_t' ) ;
codegen_sel_method ('gt_thunk' , 'bool keep = (Ax [p] > y)', 'int32_t' ) ;
codegen_sel_method ('gt_thunk' , 'bool keep = (Ax [p] > y)', 'int64_t' ) ;
codegen_sel_method ('gt_thunk' , 'bool keep = (Ax [p] > y)', 'uint8_t' ) ;
codegen_sel_method ('gt_thunk' , 'bool keep = (Ax [p] > y)', 'uint16_t') ;
codegen_sel_method ('gt_thunk' , 'bool keep = (Ax [p] > y)', 'uint32_t') ;
codegen_sel_method ('gt_thunk' , 'bool keep = (Ax [p] > y)', 'uint64_t') ;
codegen_sel_method ('gt_thunk' , 'bool keep = (Ax [p] > y)', 'float' ) ;
codegen_sel_method ('gt_thunk' , 'bool keep = (Ax [p] > y)', 'double' ) ;
% GE_THUNK name selector type
fprintf ('\nge_thunk ') ;
codegen_sel_method ('ge_thunk' , 'bool keep = (Ax [p] >= y)', 'int8_t' ) ;
codegen_sel_method ('ge_thunk' , 'bool keep = (Ax [p] >= y)', 'int16_t' ) ;
codegen_sel_method ('ge_thunk' , 'bool keep = (Ax [p] >= y)', 'int32_t' ) ;
codegen_sel_method ('ge_thunk' , 'bool keep = (Ax [p] >= y)', 'int64_t' ) ;
codegen_sel_method ('ge_thunk' , 'bool keep = (Ax [p] >= y)', 'uint8_t' ) ;
codegen_sel_method ('ge_thunk' , 'bool keep = (Ax [p] >= y)', 'uint16_t') ;
codegen_sel_method ('ge_thunk' , 'bool keep = (Ax [p] >= y)', 'uint32_t') ;
codegen_sel_method ('ge_thunk' , 'bool keep = (Ax [p] >= y)', 'uint64_t') ;
codegen_sel_method ('ge_thunk' , 'bool keep = (Ax [p] >= y)', 'float' ) ;
codegen_sel_method ('ge_thunk' , 'bool keep = (Ax [p] >= y)', 'double' ) ;
% LT_THUNK name selector type
fprintf ('\nlt_thunk ') ;
codegen_sel_method ('lt_thunk' , 'bool keep = (Ax [p] < y)', 'int8_t' ) ;
codegen_sel_method ('lt_thunk' , 'bool keep = (Ax [p] < y)', 'int16_t' ) ;
codegen_sel_method ('lt_thunk' , 'bool keep = (Ax [p] < y)', 'int32_t' ) ;
codegen_sel_method ('lt_thunk' , 'bool keep = (Ax [p] < y)', 'int64_t' ) ;
codegen_sel_method ('lt_thunk' , 'bool keep = (Ax [p] < y)', 'uint8_t' ) ;
codegen_sel_method ('lt_thunk' , 'bool keep = (Ax [p] < y)', 'uint16_t') ;
codegen_sel_method ('lt_thunk' , 'bool keep = (Ax [p] < y)', 'uint32_t') ;
codegen_sel_method ('lt_thunk' , 'bool keep = (Ax [p] < y)', 'uint64_t') ;
codegen_sel_method ('lt_thunk' , 'bool keep = (Ax [p] < y)', 'float' ) ;
codegen_sel_method ('lt_thunk' , 'bool keep = (Ax [p] < y)', 'double' ) ;
% LE_THUNK name selector type
fprintf ('\nle_thunk ') ;
codegen_sel_method ('le_thunk' , 'bool keep = (Ax [p] <= y)', 'int8_t' ) ;
codegen_sel_method ('le_thunk' , 'bool keep = (Ax [p] <= y)', 'int16_t' ) ;
codegen_sel_method ('le_thunk' , 'bool keep = (Ax [p] <= y)', 'int32_t' ) ;
codegen_sel_method ('le_thunk' , 'bool keep = (Ax [p] <= y)', 'int64_t' ) ;
codegen_sel_method ('le_thunk' , 'bool keep = (Ax [p] <= y)', 'uint8_t' ) ;
codegen_sel_method ('le_thunk' , 'bool keep = (Ax [p] <= y)', 'uint16_t') ;
codegen_sel_method ('le_thunk' , 'bool keep = (Ax [p] <= y)', 'uint32_t') ;
codegen_sel_method ('le_thunk' , 'bool keep = (Ax [p] <= y)', 'uint64_t') ;
codegen_sel_method ('le_thunk' , 'bool keep = (Ax [p] <= y)', 'float' ) ;
codegen_sel_method ('le_thunk' , 'bool keep = (Ax [p] <= y)', 'double' ) ;
fprintf ('\n') ;
|