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
|
//------------------------------------------------------------------------------
// GB_Operator_check: check and print any operator
//------------------------------------------------------------------------------
// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//------------------------------------------------------------------------------
#include "GB.h"
GrB_Info GB_Operator_check // check a GraphBLAS operator
(
const GB_Operator op, // GraphBLAS operator to print and check
const char *name, // name of the operator
int pr, // print level
FILE *f // file for output
)
{
//--------------------------------------------------------------------------
// check inputs
//--------------------------------------------------------------------------
if (op == NULL)
{
GBPR0 ("\n GraphBLAS Operator: %s: NULL\n",
((name != NULL) ? name : "")) ;
return (GrB_NULL_POINTER) ;
}
//--------------------------------------------------------------------------
// check the operator
//--------------------------------------------------------------------------
GB_Opcode opcode = op->opcode ;
if (GB_IS_UNARYOP_CODE (opcode))
{
return (GB_UnaryOp_check ((GrB_UnaryOp) op, name, pr, f)) ;
}
else if (GB_IS_BINARYOP_CODE (opcode))
{
return (GB_BinaryOp_check ((GrB_BinaryOp) op, name, pr, f)) ;
}
else if (GB_IS_INDEXUNARYOP_CODE (opcode))
{
return (GB_IndexUnaryOp_check ((GrB_IndexUnaryOp) op, name, pr, f)) ;
}
else if (GB_IS_SELECTOP_CODE (opcode))
{
return (GB_SelectOp_check ((GxB_SelectOp) op, name, pr, f)) ;
}
else
{
GBPR0 ("\n GraphBLAS Operator: %s: invalid opcode\n",
((name != NULL) ? name : "")) ;
return (GrB_INVALID_OBJECT) ; // bad opcode
}
}
|