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
|
//------------------------------------------------------------------------------
// GB_positional_binop_ijflip: swap i and j in a binary positional op
//------------------------------------------------------------------------------
// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//------------------------------------------------------------------------------
// Flip i and j to handle the CSR/CSC variations, for ewise positional ops.
// This is not used for semirings.
#include "GB.h"
GrB_BinaryOp GB_positional_binop_ijflip // return flipped operator
(
GrB_BinaryOp op // operator to flip
)
{
ASSERT (op != NULL) ;
if (op->ztype == GrB_INT64)
{
switch (op->opcode)
{
case GB_FIRSTI_binop_code : return (GxB_FIRSTJ_INT64 ) ;
case GB_FIRSTI1_binop_code : return (GxB_FIRSTJ1_INT64 ) ;
case GB_FIRSTJ_binop_code : return (GxB_FIRSTI_INT64 ) ;
case GB_FIRSTJ1_binop_code : return (GxB_FIRSTI1_INT64 ) ;
case GB_SECONDI_binop_code : return (GxB_SECONDJ_INT64 ) ;
case GB_SECONDI1_binop_code : return (GxB_SECONDJ1_INT64) ;
case GB_SECONDJ_binop_code : return (GxB_SECONDI_INT64 ) ;
case GB_SECONDJ1_binop_code : return (GxB_SECONDI1_INT64) ;
default: ;
}
}
else
{
switch (op->opcode)
{
case GB_FIRSTI_binop_code : return (GxB_FIRSTJ_INT32 ) ;
case GB_FIRSTI1_binop_code : return (GxB_FIRSTJ1_INT32 ) ;
case GB_FIRSTJ_binop_code : return (GxB_FIRSTI_INT32 ) ;
case GB_FIRSTJ1_binop_code : return (GxB_FIRSTI1_INT32 ) ;
case GB_SECONDI_binop_code : return (GxB_SECONDJ_INT32 ) ;
case GB_SECONDI1_binop_code : return (GxB_SECONDJ1_INT32) ;
case GB_SECONDJ_binop_code : return (GxB_SECONDI_INT32 ) ;
case GB_SECONDJ1_binop_code : return (GxB_SECONDI1_INT32) ;
default: ;
}
}
// non-positional op is returned unmodified
return (op) ;
}
|