File: monoidinfo.m

package info (click to toggle)
suitesparse-graphblas 7.4.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 67,112 kB
  • sloc: ansic: 1,072,243; cpp: 8,081; sh: 512; makefile: 506; asm: 369; python: 125; awk: 10
file content (59 lines) | stat: -rw-r--r-- 2,075 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
function monoidinfo (monoid, type)
%GRB.MONOIDINFO list the details of a GraphBLAS monoid.
%
%   GrB.monoidinfo
%   GrB.monoidinfo (monoid)
%   GrB.monoidinfo (monoid, type)
%
% For GrB.monoidinfo(op), the op must be a string of the form 'op.type',
% where 'op' is listed below.  The second usage allows the type to be
% omitted from the first argument, as just 'op'.  This is valid for all
% GraphBLAS operations, since the type defaults to the type of the input
% matrices.  However, GrB.monoidinfo does not have a default type and thus
% one must be provided, either in the op as GrB.monoidinfo ('+.double'), or
% in the second argument, GrB.monoidinfo ('+', 'double').
%
% A monoid is any binary operator z=f(x,y) that is commutative and
% associative, with an identity value o so that f(x,o)=f(o,x)=o.  The types
% of z, x, and y must all be identical.  For example, the plus.double
% operator is f(x,y)=x+y, with zero as the identity value (x+0 = 0+x = x).
% The times monoid has an identity value of 1 (since x*1 = 1*x = x).  The
% identity of min.double is +inf.
%
% The valid monoids for real non-logical types are:
%       '+', '*', 'max', 'min', 'any'
% For the 'logical' type:
%       '|', '&', 'xor', 'eq' (the same as 'xnor'), 'any'
% For complex types:
%       '+', '*', 'any'
% For integer types (signed and unsigned):
%       'bitor', 'bitand', 'bitxor', 'bitxnor'
%
% Some monoids have synonyms; see 'help GrB.binopinfo' for details.
%
% Example:
%
%   % valid monoids
%   GrB.monoidinfo ('+.double') ;
%   GrB.monoidinfo ('*.int32') ;
%   GrB.monoidinfo ('min.double') ;
%
%   % invalid monoids
%   GrB.monoidinfo ('1st.int32') ;
%   GrB.monoidinfo ('abs.double') ;
%   GrB.monoidinfo ('min.complex') ;
%
% See also GrB.binopinfo, GrB.descriptorinfo, GrB.selectopinfo,
% GrB.semiringinfo, GrB.unopinfo.

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

if (nargin == 0)
    help GrB.monoidinfo
elseif (nargin == 1)
    gbmonoidinfo (monoid) ;
else
    gbmonoidinfo (monoid, type) ;
end