Skip to content

Missing binary boolean operators #68

@DrTimothyAldenDavis

Description

@DrTimothyAldenDavis

GraphBLAS does not have the full set of all 16 possible boolean binary operators. It has only 11 of them. See the table below:

                     x: 0 0 1 1
                     y: 0 1 0 1
                     -------------
  
        z = 0           0 0 0 0     (zero function, not predefined)
        z = (x && y)    0 0 0 1     AND, MIN, TIMES
        z = (x > y)     0 0 1 0     GT
        z = x           0 0 1 1     FIRST
  
        z = (x < y)     0 1 0 0     LT
        z = y           0 1 0 1     SECOND
        z = (x != y)    0 1 1 0     XOR, MINUS, NE
        z = (x || y)    0 1 1 1     OR, MAX, PLUS
  
        z = ~(x || y)   1 0 0 0     (nor(x,y) function, not predefined)
        z = (x == y)    1 0 0 1     LXNOR, EQ
        z = ~y          1 0 1 0     (not(y), not predefined as a binary op)
        z = (x >= y)    1 0 1 1     GE, also same as "x implies y"
  
        z = ~x          1 1 0 0     (not(x), not predefined as a binary op)
        z = (x <= y)    1 1 0 1     LE, also same as "y implies x"
        z = ~(x && y)   1 1 1 0     (nand(x,y) function, not predefined)
        z = 1           1 1 1 1     ONEB

We should add the 5 missing functions, as boolean binary operators:

GrB_ZEROB_BOOL: z = false.  This might also be GrB_ZEROB_T for any domain T.
GrB_NFIRST:  z = not(x)
GrB_NSECOND: z = not(y)
GrB_NAND: z = not (and (x,y))
GrB_NOR: z = not (or (x,y))

All domains for these binary operators are GrB_BOOL. These functions are useful in their own right, but are also required by #67

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions