File: GB_mex_semiring.c

package info (click to toggle)
suitesparse-graphblas 7.4.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 67,112 kB
  • sloc: ansic: 1,072,243; cpp: 8,081; sh: 512; makefile: 503; asm: 369; python: 125; awk: 10
file content (51 lines) | stat: -rw-r--r-- 1,304 bytes parent folder | download | duplicates (3)
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
//------------------------------------------------------------------------------
// GB_mex_semiring: parse a semiring, for testing; returns nothing
//------------------------------------------------------------------------------

// SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2022, All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0

//------------------------------------------------------------------------------

#include "GB_mex.h"

#define USAGE "GB_mex_semiring (semiring_struct))"

#define FREE_ALL                \
{                               \
    GB_mx_put_global (true) ;   \
}

void mexFunction
(
    int nargout,
    mxArray *pargout [ ],
    int nargin,
    const mxArray *pargin [ ]
)
{

    bool malloc_debug = GB_mx_get_global (true) ;
    GrB_Semiring semiring = NULL ;

    // check inputs
    if (nargin < 1 || nargin > 2 || nargout > 0)
    {
        mexErrMsgTxt ("Usage: " USAGE) ;
    }

    bool user_complex = (Complex != GxB_FC64) ;

    GB_mx_mxArray_to_Semiring (&semiring, pargin [0], "semiring", GrB_FP64,
        user_complex) ;

    int GET_SCALAR (1, int, pr, GxB_COMPLETE) ;

    GrB_Info info = GB_Semiring_check (semiring, "semiring", pr, NULL) ;
    if (info != GrB_SUCCESS)
    {
        mexErrMsgTxt ("semiring fail") ;
    }
    FREE_ALL ;
}