1function semiringinfo (s, type)
2%GRB.SEMIRINGINFO list the details of a GraphBLAS semiring.
3%
4%   GrB.semiringinfo
5%   GrB.semiringinfo (semiring)
6%   GrB.semiringinfo (semiring, type)
7%
8% For GrB.semiring(semiring), the semiring must be a string of the form
9% 'add.mult.type', where 'add' and 'mult' are binary operators.  The
10% second usage allows the type to be omitted from the first argument, as
11% just 'add.mult'.  This is valid for all GraphBLAS operations, since the
12% type defaults to the type of the input matrices.  However,
13% GrB.semiringinfo does not have a default type and thus one must be
14% provided, either in the semiring as GrB.semiringinfo ('+.*.double'), or
15% in the second argument, GrB.semiringinfo ('+.*', 'double').
16%
17% The additive operator must be the binary operator of a valid monoid (see
18% 'help GrB.monoidinfo').  The multiplicative operator can be any binary
19% operator z=f(x,y) listed by 'help GrB.binopinfo', but the type of z must
20% match the operand type of the monoid.  The type in the string
21% 'add.mult.type' is the type of x for the multiply operator z=f(x,y), and
22% the type of its z output defines the type of the monoid.
23%
24% Example:
25%
26%   % valid semirings
27%   GrB.semiringinfo ('+.*.double') ;
28%   GrB.semiringinfo ('min.1st.int32') ;
29%
30%   % invalid semiring (generates an error; since '<' is not a monoid)
31%   GrB.semiringinfo ('<.*.double') ;
32%
33% See also GrB.binopinfo, GrB.descriptorinfo, GrB.monoidinfo,
34% GrB.selectopinfo, GrB.unopinfo.
35
36% SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved.
37% SPDX-License-Identifier: GPL-3.0-or-later
38
39if (nargin == 0)
40    help GrB.semiringinfo
41elseif (nargin == 1)
42    gbsemiringinfo (s) ;
43else
44    gbsemiringinfo (s, type) ;
45end
46
47