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
|
//------------------------------------------------------------------------------
// GB_boolean_rename_op: rename a boolean operator
//------------------------------------------------------------------------------
// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//------------------------------------------------------------------------------
// If the user requests the creation of a monoid based on a duplicate
// built-in binary operator, the unique boolean operator is used instead.
// See also GB_boolean_rename, which does this for opcodes, not operators.
// This is done before the operator is checked, so that any error messages
// reflect the renaming.
#include "GB.h"
#include "GB_binop.h"
GrB_BinaryOp GB_boolean_rename_op // return renamed op
(
const GrB_BinaryOp op // op to rename
)
{
if (op == GrB_DIV_BOOL)
{
// FIRST and DIV are the same for boolean:
return (GrB_FIRST_BOOL) ;
}
if (op == GxB_RDIV_BOOL)
{
// SECOND and RDIV are the same for boolean:
return (GrB_SECOND_BOOL) ;
}
if (op == GrB_MIN_BOOL || op == GrB_TIMES_BOOL)
{
// MIN, TIMES, and LAND are the same for boolean:
return (GrB_LAND) ;
}
if (op == GrB_MAX_BOOL || op == GrB_PLUS_BOOL)
{
// MAX, PLUS, and OR are the same for boolean:
return (GrB_LOR) ;
}
if (op == GxB_ISNE_BOOL || op == GrB_NE_BOOL || op == GrB_MINUS_BOOL
|| op == GxB_RMINUS_BOOL)
{
// ISNE, NE, MINUS, RMINUS, and XOR are the same for boolean:
return (GrB_LXOR) ;
}
if (op == GxB_ISEQ_BOOL || op == GrB_LXNOR)
{
// LXNOR, ISEQ, EQ are the same for boolean:
return (GrB_EQ_BOOL) ;
}
if (op == GxB_ISGT_BOOL)
{
// ISGT, GT are the same for boolean:
return (GrB_GT_BOOL) ;
}
if (op == GxB_ISLT_BOOL)
{
// ISLT, LT are the same for boolean:
return (GrB_LT_BOOL) ;
}
if (op == GxB_ISGE_BOOL || op == GxB_POW_BOOL)
{
// POW, ISGE, GE are the same for boolean:
return (GrB_GE_BOOL) ;
}
if (op == GxB_ISLE_BOOL)
{
// ISLE, LE are the same for boolean:
return (GrB_LE_BOOL) ;
}
// operator is not changed
return (op) ;
}
|