From 43e8653f4c20d250908f9a9697b997ee480b2175 Mon Sep 17 00:00:00 2001 From: aheydon-google <54654585+aheydon-google@users.noreply.github.com> Date: Mon, 5 May 2025 14:33:36 -0700 Subject: [PATCH 1/2] Fixes issues with the comments for parlay functions `tabulate`, `map`, and `delayed_tabulate`. In particular, these comments were referring to the last element of the sequence as having index `n`, when it should be `n-1`. --- include/parlay/internal/sequence_ops.h | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/include/parlay/internal/sequence_ops.h b/include/parlay/internal/sequence_ops.h index 1cdc12fb..494a377a 100644 --- a/include/parlay/internal/sequence_ops.h +++ b/include/parlay/internal/sequence_ops.h @@ -21,9 +21,9 @@ namespace parlay { namespace internal { // Return a sequence consisting of the elements -// f(0), f(1), ... f(n) +// f(0), f(1), ... f(n-1) template -auto tabulate(size_t n, UnaryOp&& f, size_t granularity=0) { +auto tabulate(size_t n, UnaryOp&& f, size_t granularity = 0) { static_assert(std::is_invocable_v); static_assert(!std::is_void_v>); static_assert(!std::is_array_v>); @@ -32,9 +32,9 @@ auto tabulate(size_t n, UnaryOp&& f, size_t granularity=0) { } // Return a sequence consisting of the elements -// f(0), f(1), ... f(n) +// f(0), f(1), ... f(n-1) template -auto tabulate(size_t n, UnaryOp&& f, size_t granularity=0) { +auto tabulate(size_t n, UnaryOp&& f, size_t granularity = 0) { static_assert(std::is_invocable_v); static_assert(!std::is_void_v>); static_assert(!std::is_array_v>); @@ -44,6 +44,7 @@ auto tabulate(size_t n, UnaryOp&& f, size_t granularity=0) { // Return a sequence consisting of the elements // f(r[0]), f(r[1]), ..., f(r[n-1]) +// where n is the size of r. template auto map(R&& r, UnaryOp&& f, size_t granularity=0) { static_assert(is_random_access_range_v); @@ -54,7 +55,7 @@ auto map(R&& r, UnaryOp&& f, size_t granularity=0) { } // Return a delayed sequence consisting of the elements -// f(0), f(1), ... f(n) +// f(0), f(1), ... f(n-1) template auto delayed_tabulate(size_t n, F f) { static_assert(std::is_invocable_v); @@ -65,7 +66,7 @@ auto delayed_tabulate(size_t n, F f) { } // Return a delayed sequence consisting of the elements -// f(0), f(1), ... f(n) +// f(0), f(1), ... f(n-1) template auto delayed_tabulate(size_t n, F f) { static_assert(std::is_invocable_v); @@ -74,7 +75,7 @@ auto delayed_tabulate(size_t n, F f) { } // Return a delayed sequence consisting of the elements -// f(0), f(1), ... f(n) +// f(0), f(1), ... f(n-1) template auto delayed_tabulate(size_t n, F f) { static_assert(std::is_invocable_v); @@ -84,6 +85,7 @@ auto delayed_tabulate(size_t n, F f) { // Return a delayed sequence consisting of the elements // f(r[0]), f(r[1]), ..., f(r[n-1]) +// where n is the size of r. // // If r is a temporary, the delayed sequence will take // ownership of it by moving it. If r is a reference, From 3b135fb95eb26d473b38b2a6f2e3c69b60ecab84 Mon Sep 17 00:00:00 2001 From: aheydon-google <54654585+aheydon-google@users.noreply.github.com> Date: Tue, 6 May 2025 11:27:51 -0700 Subject: [PATCH 2/2] Update Parlay version number. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 59388488..228615ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,7 @@ cmake_minimum_required(VERSION 3.14) -project(PARLAY VERSION 2.3.1 +project(PARLAY VERSION 2.3.2 DESCRIPTION "A collection of parallel algorithms and other support for parallelism in C++" LANGUAGES CXX)