From 4b184f88b9b6c8ce93317f1172c02bcb64575be0 Mon Sep 17 00:00:00 2001 From: Matt Smith <mjsmith6@illinois.edu> Date: Wed, 1 Sep 2021 09:45:47 -0500 Subject: [PATCH] require reduce_func to be associative in non-recursive reductions too Co-authored-by: Alex Fikl <alexfikl@gmail.com> --- arraycontext/container/traversal.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/arraycontext/container/traversal.py b/arraycontext/container/traversal.py index 53c2986..2c1e9d6 100644 --- a/arraycontext/container/traversal.py +++ b/arraycontext/container/traversal.py @@ -303,7 +303,8 @@ def map_reduce_array_container( """Perform a map-reduce over array containers. :param reduce_func: callable used to reduce over the components of *ary* - if *ary* is an :class:`~arraycontext.ArrayContainer`. + if *ary* is an :class:`~arraycontext.ArrayContainer`. The callable + should be associative, as for :func:`rec_map_reduce_array_container`. :param map_func: callable used to map a single array of type :class:`arraycontext.ArrayContext.array_types`. Returns an array of the same type or a scalar. @@ -323,7 +324,8 @@ def multimap_reduce_array_container( r"""Perform a map-reduce over multiple array containers. :param reduce_func: callable used to reduce over the components of any - :class:`~arraycontext.ArrayContainer`\ s in *\*args*. + :class:`~arraycontext.ArrayContainer`\ s in *\*args*. The callable + should be associative, as for :func:`rec_map_reduce_array_container`. :param map_func: callable used to map a single array of type :class:`arraycontext.ArrayContext.array_types`. Returns an array of the same type or a scalar. -- GitLab