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
|
//------------------------------------------------------------------------------
// gb_mxclass_to_mxstring: type of a built-in matrix
//------------------------------------------------------------------------------
// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//------------------------------------------------------------------------------
#include "gb_interface.h"
mxArray *gb_mxclass_to_mxstring (mxClassID class, bool is_complex)
{
switch (class)
{
// a built-in sparse or full matrix, valid for G = GrB (X), or
// for inputs to any GrB.method.
case mxLOGICAL_CLASS : return (mxCreateString ("logical")) ;
case mxINT8_CLASS : return (mxCreateString ("int8")) ;
case mxINT16_CLASS : return (mxCreateString ("int16")) ;
case mxINT32_CLASS : return (mxCreateString ("int32")) ;
case mxINT64_CLASS : return (mxCreateString ("int64")) ;
case mxUINT8_CLASS : return (mxCreateString ("uint8")) ;
case mxUINT16_CLASS : return (mxCreateString ("uint16")) ;
case mxUINT32_CLASS : return (mxCreateString ("uint32")) ;
case mxUINT64_CLASS : return (mxCreateString ("uint64")) ;
case mxSINGLE_CLASS :
if (is_complex)
{
return (mxCreateString ("single complex")) ;
}
else
{
return (mxCreateString ("single")) ;
}
break ;
case mxDOUBLE_CLASS :
if (is_complex)
{
return (mxCreateString ("double complex")) ;
}
else
{
return (mxCreateString ("double")) ;
}
break ;
// a built-in struct, cell, char, void, function, or unknown
case mxSTRUCT_CLASS : return (mxCreateString ("struct")) ;
case mxCELL_CLASS : return (mxCreateString ("cell")) ;
case mxCHAR_CLASS : return (mxCreateString ("char")) ;
case mxVOID_CLASS : return (mxCreateString ("void")) ;
case mxFUNCTION_CLASS : return (mxCreateString ("function_handle")) ;
case mxUNKNOWN_CLASS :
default : return (mxCreateString ("unknown")) ;
}
}
|