From d05644e2cd762b6c13b03f2467a4c092f1e7e3f0 Mon Sep 17 00:00:00 2001 From: Erik Welch Date: Fri, 23 Jun 2023 13:39:42 -0500 Subject: [PATCH 1/2] Clarify in docs that monoids are commutative and associative --- docs/user_guide/operators.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/user_guide/operators.rst b/docs/user_guide/operators.rst index 9499562f2..5ce8f8b2a 100644 --- a/docs/user_guide/operators.rst +++ b/docs/user_guide/operators.rst @@ -89,9 +89,10 @@ registered from numpy are located in ``graphblas.binary.numpy``. Monoids ------- -Monoids extend the concept of a binary operator to require a single domain for all inputs and -the output. Monoids are also associative, so the order of the inputs does not matter. And finally, -monoids have a default identity such that ``A op identity == A``. +Monoids extend the concept of a binary operator to require a single domain for all inputs and the output. +Monoids are also associative and commutative, so the order of operations and inputs do not matter +(for example, ``(a + b) + c == b + (c + a)``). +And finally, monoids have a default identity such that ``A op identity == A``. Monoids are commonly for reductions, collapsing all elements down to a single value. From 480e7a79866e22831779e49ba3cba373397be533 Mon Sep 17 00:00:00 2001 From: Erik Welch Date: Tue, 27 Jun 2023 21:30:59 -0500 Subject: [PATCH 2/2] Refine language about commutative monoids. --- docs/user_guide/operators.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/user_guide/operators.rst b/docs/user_guide/operators.rst index 5ce8f8b2a..ec28e2fba 100644 --- a/docs/user_guide/operators.rst +++ b/docs/user_guide/operators.rst @@ -90,8 +90,10 @@ Monoids ------- Monoids extend the concept of a binary operator to require a single domain for all inputs and the output. -Monoids are also associative and commutative, so the order of operations and inputs do not matter -(for example, ``(a + b) + c == b + (c + a)``). +Monoids are also associative so the order of operations does not matter +(for example, ``(a + b) + c == a + (b + c)``). +GraphBLAS primarily uses *commutative monoids* (for example, ``a + b == b + a``), +and all standard monoids in python-graphblas commute. And finally, monoids have a default identity such that ``A op identity == A``. Monoids are commonly for reductions, collapsing all elements down to a single value.