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
|
function codegen_axb_compare_template (multop, bmult, mult)
%CODEGEN_AXB_COMPARE_TEMPLATE create a function for a semiring with a TxT -> bool multiplier
% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2025, All Rights Reserved.
% SPDX-License-Identifier: Apache-2.0
fprintf ('\n%-7s', multop) ;
% lor monoid
update = 'warg |= targ' ;
addfunc = 'zarg = xarg || yarg' ;
codegen_axb_method ('lor', multop, update, addfunc, bmult, 'bool', 'bool' , 'false', 'true') ;
codegen_axb_method ('lor', multop, update, addfunc, mult, 'bool', 'int8_t' , 'false', 'true') ;
codegen_axb_method ('lor', multop, update, addfunc, mult, 'bool', 'uint8_t' , 'false', 'true') ;
codegen_axb_method ('lor', multop, update, addfunc, mult, 'bool', 'int16_t' , 'false', 'true') ;
codegen_axb_method ('lor', multop, update, addfunc, mult, 'bool', 'uint16_t', 'false', 'true') ;
codegen_axb_method ('lor', multop, update, addfunc, mult, 'bool', 'int32_t' , 'false', 'true') ;
codegen_axb_method ('lor', multop, update, addfunc, mult, 'bool', 'uint32_t', 'false', 'true') ;
codegen_axb_method ('lor', multop, update, addfunc, mult, 'bool', 'int64_t' , 'false', 'true') ;
codegen_axb_method ('lor', multop, update, addfunc, mult, 'bool', 'uint64_t', 'false', 'true') ;
codegen_axb_method ('lor', multop, update, addfunc, mult, 'bool', 'float' , 'false', 'true') ;
codegen_axb_method ('lor', multop, update, addfunc, mult, 'bool', 'double' , 'false', 'true') ;
% any monoid
update = 'warg = targ' ;
addfunc = 'zarg = yarg' ;
codegen_axb_method ('any', multop, update, addfunc, bmult, 'bool', 'bool' , 'false', '(any value)') ;
codegen_axb_method ('any', multop, update, addfunc, mult, 'bool', 'int8_t' , 'false', '(any value)') ;
codegen_axb_method ('any', multop, update, addfunc, mult, 'bool', 'uint8_t' , 'false', '(any value)') ;
codegen_axb_method ('any', multop, update, addfunc, mult, 'bool', 'int16_t' , 'false', '(any value)') ;
codegen_axb_method ('any', multop, update, addfunc, mult, 'bool', 'uint16_t', 'false', '(any value)') ;
codegen_axb_method ('any', multop, update, addfunc, mult, 'bool', 'int32_t' , 'false', '(any value)') ;
codegen_axb_method ('any', multop, update, addfunc, mult, 'bool', 'uint32_t', 'false', '(any value)') ;
codegen_axb_method ('any', multop, update, addfunc, mult, 'bool', 'int64_t' , 'false', '(any value)') ;
codegen_axb_method ('any', multop, update, addfunc, mult, 'bool', 'uint64_t', 'false', '(any value)') ;
codegen_axb_method ('any', multop, update, addfunc, mult, 'bool', 'float' , 'false', '(any value)') ;
codegen_axb_method ('any', multop, update, addfunc, mult, 'bool', 'double' , 'false', '(any value)') ;
% land monoid
update = 'warg &= targ' ;
addfunc = 'zarg = xarg && yarg' ;
codegen_axb_method ('land', multop, update, addfunc, bmult, 'bool', 'bool' , 'true', 'false') ;
codegen_axb_method ('land', multop, update, addfunc, mult, 'bool', 'int8_t' , 'true', 'false') ;
codegen_axb_method ('land', multop, update, addfunc, mult, 'bool', 'uint8_t' , 'true', 'false') ;
codegen_axb_method ('land', multop, update, addfunc, mult, 'bool', 'int16_t' , 'true', 'false') ;
codegen_axb_method ('land', multop, update, addfunc, mult, 'bool', 'uint16_t', 'true', 'false') ;
codegen_axb_method ('land', multop, update, addfunc, mult, 'bool', 'int32_t' , 'true', 'false') ;
codegen_axb_method ('land', multop, update, addfunc, mult, 'bool', 'uint32_t', 'true', 'false') ;
codegen_axb_method ('land', multop, update, addfunc, mult, 'bool', 'int64_t' , 'true', 'false') ;
codegen_axb_method ('land', multop, update, addfunc, mult, 'bool', 'uint64_t', 'true', 'false') ;
codegen_axb_method ('land', multop, update, addfunc, mult, 'bool', 'float' , 'true', 'false') ;
codegen_axb_method ('land', multop, update, addfunc, mult, 'bool', 'double' , 'true', 'false') ;
% lxor monoid
update = 'warg ^= targ' ;
addfunc = 'zarg = (xarg != yarg)' ;
codegen_axb_method ('lxor', multop, update, addfunc, bmult, 'bool', 'bool' , 'false', [ ]) ;
codegen_axb_method ('lxor', multop, update, addfunc, mult, 'bool', 'int8_t' , 'false', [ ]) ;
codegen_axb_method ('lxor', multop, update, addfunc, mult, 'bool', 'uint8_t' , 'false', [ ]) ;
codegen_axb_method ('lxor', multop, update, addfunc, mult, 'bool', 'int16_t' , 'false', [ ]) ;
codegen_axb_method ('lxor', multop, update, addfunc, mult, 'bool', 'uint16_t', 'false', [ ]) ;
codegen_axb_method ('lxor', multop, update, addfunc, mult, 'bool', 'int32_t' , 'false', [ ]) ;
codegen_axb_method ('lxor', multop, update, addfunc, mult, 'bool', 'uint32_t', 'false', [ ]) ;
codegen_axb_method ('lxor', multop, update, addfunc, mult, 'bool', 'int64_t' , 'false', [ ]) ;
codegen_axb_method ('lxor', multop, update, addfunc, mult, 'bool', 'uint64_t', 'false', [ ]) ;
codegen_axb_method ('lxor', multop, update, addfunc, mult, 'bool', 'float' , 'false', [ ]) ;
codegen_axb_method ('lxor', multop, update, addfunc, mult, 'bool', 'double' , 'false', [ ]) ;
% eq (lxnor) monoid. Cannot be done with OpenMP atomic
update = 'warg = (warg == targ)' ;
addfunc = 'zarg = (xarg == yarg)' ;
codegen_axb_method ('eq', multop, update, addfunc, bmult, 'bool', 'bool' , 'true', [ ]) ;
codegen_axb_method ('eq', multop, update, addfunc, mult, 'bool', 'int8_t' , 'true', [ ]) ;
codegen_axb_method ('eq', multop, update, addfunc, mult, 'bool', 'uint8_t' , 'true', [ ]) ;
codegen_axb_method ('eq', multop, update, addfunc, mult, 'bool', 'int16_t' , 'true', [ ]) ;
codegen_axb_method ('eq', multop, update, addfunc, mult, 'bool', 'uint16_t', 'true', [ ]) ;
codegen_axb_method ('eq', multop, update, addfunc, mult, 'bool', 'int32_t' , 'true', [ ]) ;
codegen_axb_method ('eq', multop, update, addfunc, mult, 'bool', 'uint32_t', 'true', [ ]) ;
codegen_axb_method ('eq', multop, update, addfunc, mult, 'bool', 'int64_t' , 'true', [ ]) ;
codegen_axb_method ('eq', multop, update, addfunc, mult, 'bool', 'uint64_t', 'true', [ ]) ;
codegen_axb_method ('eq', multop, update, addfunc, mult, 'bool', 'float' , 'true', [ ]) ;
codegen_axb_method ('eq', multop, update, addfunc, mult, 'bool', 'double' , 'true', [ ]) ;
|