File: GrB_get_set_Semiring.tex

package info (click to toggle)
suitesparse 1%3A7.10.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 254,920 kB
  • sloc: ansic: 1,134,743; cpp: 46,133; makefile: 4,875; fortran: 2,087; java: 1,826; sh: 996; ruby: 725; python: 495; asm: 371; sed: 166; awk: 44
file content (106 lines) | stat: -rw-r--r-- 4,472 bytes parent folder | download | duplicates (2)
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106

%-------------------------------------------------------------------------------
\newpage
\subsection{{\sf GrB\_Semiring} Options}
\label{get_set_semiring}
%-------------------------------------------------------------------------------

\begin{mdframed}[userdefinedwidth=6in]
{\footnotesize
\begin{verbatim}
GrB_Info GrB_get (GrB_Semiring semiring, GrB_Scalar value, int f) ;
GrB_Info GrB_get (GrB_Semiring semiring, char *     value, int f) ;
GrB_Info GrB_get (GrB_Semiring semiring, int32_t *  value, int f) ;
GrB_Info GrB_get (GrB_Semiring semiring, size_t *   value, int f) ;
GrB_Info GrB_get (GrB_Semiring semiring, void *     value, int f) ;

GrB_Info GrB_set (GrB_Semiring semiring, GrB_Scalar value, int f) ;
\end{verbatim}
}\end{mdframed}

\noindent
{\small
\begin{tabular}{|l|l|l|p{2.8in}|}
\hline
\verb'int field'                   & R/W  & C type        & description \\
\hline
\verb'GrB_INP0_TYPE_CODE'          & R    & \verb'int32_t'& 1st input type code (see \verb'GrB_Type_code')
    of the multiplicative operator \\
\verb'GrB_INP1_TYPE_CODE'          & R    & \verb'int32_t'& 2nd input type code
    of the multiplicative operator \\
\verb'GrB_OUTP_TYPE_CODE'          & R    & \verb'int32_t'& output type code 
    of the multiplicative operator,
    and the monoid type. \\
\verb'GxB_THETA_TYPE_CODE'         & R    & \verb'int32_t'& $\Theta$ type code, if any \\
\verb'GrB_INP0_TYPE_STRING'        & R    & \verb'char *' & name of the 1st input type
    of the multiplicative operator \\
\verb'GrB_INP1_TYPE_STRING'        & R    & \verb'char *' & name of the 2nd input type
    of the multiplicative operator \\
\verb'GrB_OUTP_TYPE_STRING'        & R    & \verb'char *' & name of the output type
    of the multiplicative operator,
    and the monoid type. \\
\verb'GxB_THETA_TYPE_STRING'       & R    & \verb'char *' & name of the $\Theta$ type, if any \\
\hline
\verb'GrB_NAME'                     & R/W1 & \verb'char *' &    % GrB_ALREADY_SET (semiring)
    name of the semiring.  For built-in semirings, this returns the GraphBLAS
    name (\verb'"GrB_LOR_LAND_SEMIRING_BOOL"' for \verb'GrB_LOR_LAND_SEMIRING_BOOL',
    for example).  For user-defined semirings, the name can be any string of any
    length.  It is not used by the JIT.  It can be set at most once. \\
\verb'GxB_THETA' & R & \verb'GrB_Scalar' &
    value of \verb'Theta', if any.
    The type of the \verb'GrB_Scalar'
    must match the \verb'Theta' type of the underlying
    index-binary operator exactly. \\
\hline
\end{tabular}
}

\noindent
{\small
\begin{tabular}{|l|l|l|p{2.5in}|}
\hline
\verb'int field'                    & R/W  & C type        & description \\
\hline
\verb'GxB_MONOID_IDENTITY'          & R  & \verb'GrB_Scalar' &
    identity value of the monoid.  The type of the \verb'GrB_Scalar'
    must match the monoid type exactly. \\
\verb'GxB_MONOID_TERMINAL'          & R  & \verb'GrB_Scalar' &
    terminal value of a terminal monoid.  The type of the \verb'GrB_Scalar'
    must match the monoid type exactly.  If the monoid is not terminal,
    the \verb'GrB_Scalar' is returned with no entry. \\
\hline
\verb'GxB_MONOID_OPERATOR'          & R  & \verb'void *' &
    binary operator of the monoid, as a \verb'GrB_BinaryOp';
    See Section~\ref{get_set_monoid} \\
\verb'GxB_SEMIRING_MONOID'          & R  & \verb'void *' &
    monoid of the semiring, as a \verb'GrB_Monoid' \\
\verb'GxB_SEMIRING_MULTIPLY'        & R  & \verb'void *' &
    multiplicative operator of the semiring, as a \verb'GrB_BinaryOp' \\
\hline
\end{tabular}
}

Built-in semirings cannot be modified by \verb'GrB_set'.

The \verb'GxB_SEMIRING_MONOID' option returns the \verb'GrB_Monoid' of the
semiring.  The \verb'GxB_SEMIRING_MULTIPLY' option returns the
\verb'GrB_BinaryOp' for the multiplicative operator of the semiring.  For
example:

    {\footnotesize
    \begin{verbatim}
    // getting an alias to the monoid and multiply operator using GrB_get:
    GrB_BinaryOp op ;
    GrB_Monoid mon ;
    GrB_Semiring semiring = GrB_PLUS_TIMES_FP32 ;
    GrB_get (semiring, (void *) &mon, GxB_SEMIRING_MONOID) ;
    GrB_get (semiring, (void *) &op, GxB_SEMIRING_MULTIPLY) ;
    assert (op == GrB_TIMES_FP32) ;
    assert (mon == GrB_PLUS_MONOID_FP32) ; \end{verbatim} }

The binary op and monoid returned are aliases, not new objects.

The \verb'*THETA*' options can only be used in the multiplicative binary
operator of the semiring was created by \verb'GxB_BinaryOp_new_IndexOp'.