This is a working document to come up with a notation for typesetting the pseudocode of LAGraph algorithms.
We would like to come up with a consistent notation in LaTeX that also has an ASCII counterpart (and it should also work in WYSIWYG presentation software).
It would be nice if the LaTeX one could be mapped to PowerPoint's equation editor (Gabor).
- There are multiple notations in the 2011 GALLA book.
- The specification's notation in https://people.eecs.berkeley.edu/~aydin/GraphBLAS_API_C_v13.pdf#page=84.
- Tim Davis's notation in https://people.engr.tamu.edu/davis/GraphBLAS_files/toms_graphblas.pdf#page=8 and in the SuiteSparse User Guide.
- Scott McMillan's notation in https://resources.sei.cmu.edu/asset_files/Presentation/2016_017_001_474272.pdf#page=15
- Manoj Kumar et al.'s notation in the CF'18 paper, https://dl.acm.org/doi/10.1145/3203217.3205342, Table 2.
-
How to differentiate matrices/vectors from each other? (bold/regular, lowercase/uppercase, ...)
- There seems to be a consensus to use bold for both A and w.
- Uppercase for matrices, lowercase for vectors?
-
How to denote the transpose operation (superscript
Tor')?Tseems more popular in LaTeX-based notations.'is used in MATLAB.
-
Do we differentiate row vectors from column vectors, i.e., do we use
q'Aor justqA?- I think there's no need to differentiate between them. (Gabor)
-
How to typeset arrays (italic, bold, uppercase, lowercase, ...)?
- Italic, i.e., J?
- Italic bold, i.e., J?
-
How to denote masks with the 'replace' flag?
- The spec has a separate parameter,
z. - Kumar et al.'s notation uses a symbol, the double dagger
‡to denote the 'replace' flag. - We could use
<<M>>for replace. (Gabor)
- The spec has a separate parameter,
-
How to denote masks with the 'structure' flag?
<M>(value) and<M.S>(structure)
-
For matrix multiplication of
AandB, do we writeABor spell outA ⊕.⊗ B?- ?
-
Is it allowed to use a
+=-style notation for the accumulator, e.g., expressC = C MIN AasC MIN= A?- ?
-
How to denote common mathematical operations such 'logical and' and 'logical or'?
- By spelling our the operator's name, i.e.,
LAND/LOR, or with wedge/vee symbols. - Same for their binary counterparts
BAND/BOR, or&/|.
- By spelling our the operator's name, i.e.,
-
How to denote the
extractElementandsetElementoperations?- Seems fairly simple to have
s = C(i,j)andC(i,j) = s.
- Seems fairly simple to have
-
How to denote common operations such as
nvals/nrows/ncols,clear,size?- It is probably simplest to just spell them out.
-
How to denote the Kronecker operation?
- I've seen the double circled times symbol and the 'kron' string used for this.
-
How to spell the
FIRSTandSECONDoperators?1ST/FIRST,2ND/SECOND)?- For me,
FIRST/SECONDseem better due to less havig less numbers. (Gabor)
- For me,
-
How to denote element-wise operations such as element-wise division?
- Division:
DIV,/or circled/. (See alsoMINV.) - Minus:
MINUS,-or circled-.
- Division:
-
How to handle corner cases where an operator needs unusual element-wise semantics? E.g., sometimes it is desirable to evaluate
GrB_PLUSwith element-wise multiplication semantics.- Kumar et al.'s notation handles this by passing the separate operator.
- Put the intersection/union symbol there?
-
What syntax (if any) should be used for initializing matrices/vectors? While the memory allocation itself isn't very important in a pseudocode, the dimensions of the matrix and the precise types (
UINTxxinstead ofN) would be useful to display.- Do we use the mathematical symbols for number sets (
Q/Rvs.FPxx,Nvs.UINTxx,Zvs.INTxx)?
- Do we use the mathematical symbols for number sets (
-
How to state the domain(s) of the semiring that an operation is evaluated on?
- Kumar et al.'s notation handles this by defining the semirings
S1,S2, ... used in each algorithm.
- Kumar et al.'s notation handles this by defining the semirings
-
How to typeset the logical variables
true/True/TRUEor1or the 'top' symbol?
-
How to handle conversions (both implicit and explicit) such as
floattoboolean?- ?
- Does the indexing start from 0 or 1?
- I'm strongly inclined towards 0-based indexing as the API is defined in C. It's also orthogonal to the rest of the notation. (Gabor)