Skip to content

Commit e2a373b

Browse files
committed
Merge remote-tracking branch 'upstream/master' into SimdCartesianPartition
2 parents d8d81a4 + 2c03f81 commit e2a373b

File tree

77 files changed

+893
-342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+893
-342
lines changed

.buildkite/pipelines/main/platforms/tester_linux.arches

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# linux _armv7l false _armv7l armv7l none 60 no no no v3.2 fb359370b052a47ce5c84cc6b4a7a03ed7053b25
44
linux 32 false 32 i686 none 60 no no no v3.2 209c4db679a515befd7fb50ecc6bfbecf7ec3d32
55
# linux _ppc64le false _ppc64le powerpc64le none 60 no no no v3.2 c03a0158b19d48ac84b426834fce0d3584cdd0c7
6-
linux 64_rr false 64 x86_64 none 60 yes no no v3.2 474bf61a926b2d7fcf202284d59d4b11a04601d7
6+
linux 64_rr false 64 x86_64 none 180 yes no no v3.2 474bf61a926b2d7fcf202284d59d4b11a04601d7
77
linux 64_st false 64 x86_64 none 60 no yes no v3.2 474bf61a926b2d7fcf202284d59d4b11a04601d7
88
linux 64_mt false 64 x86_64 none 60 no no yes v3.2 474bf61a926b2d7fcf202284d59d4b11a04601d7
99
musl 64 true 64 x86_64 none 60 no no no v3.19 e6a2730e37c386c46915b2650d6aaaa398195152

NEWS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ Language changes
2222
* Newly created Task objects (`@spawn`, `@async`, etc.) now adopt the world-age for methods from their parent
2323
Task upon creation, instead of using the global latest world at start. This is done to enable inference to
2424
eventually optimize these calls. Places that wish for the old behavior may use `Base.invokelatest`. ([#41449])
25+
* `@time` and `@timev` now take an optional description to allow annotating the source of time reports.
26+
i.e. `@time "Evaluating foo" foo()` ([#42431])
27+
* New `@showtime` macro to show both the line being evaluated and the `@time` report ([#42431])
2528

2629
Compiler/Runtime improvements
2730
-----------------------------
@@ -54,6 +57,9 @@ New library features
5457
* `@test_throws "some message" triggers_error()` can now be used to check whether the displayed error text
5558
contains "some message" regardless of the specific exception type.
5659
Regular expressions, lists of strings, and matching functions are also supported. ([#41888])
60+
* `@testset foo()` can now be used to create a test set from a given function. The name of the test set
61+
is the name of the called function. The called function can contain `@test` and other `@testset`
62+
definitions, including to other function calls, while recording all intermediate test results. ([#42518])
5763

5864
Standard library changes
5965
------------------------

base/abstractarray.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,7 @@ neither mutable nor support 2 dimensions:
752752
753753
```julia-repl
754754
julia> similar(1:10, 1, 4)
755-
1×4 Array{Int64,2}:
755+
1×4 Matrix{Int64}:
756756
4419743872 4374413872 4419743888 0
757757
```
758758
@@ -771,7 +771,7 @@ different element type it will create a regular `Array` instead:
771771
772772
```julia-repl
773773
julia> similar(falses(10), Float64, 2, 4)
774-
2×4 Array{Float64,2}:
774+
2×4 Matrix{Float64}:
775775
2.18425e-314 2.18425e-314 2.18425e-314 2.18425e-314
776776
2.18425e-314 2.18425e-314 2.18425e-314 2.18425e-314
777777
```

base/accumulate.jl

Lines changed: 65 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -116,35 +116,29 @@ end
116116
"""
117117
cumsum(itr)
118118
119-
Cumulative sum an iterator. See also [`cumsum!`](@ref)
120-
to use a preallocated output array, both for performance and to control the precision of the
121-
output (e.g. to avoid overflow).
119+
Cumulative sum of an iterator.
120+
121+
See also [`accumulate`](@ref) to apply functions other than `+`.
122122
123123
!!! compat "Julia 1.5"
124124
`cumsum` on a non-array iterator requires at least Julia 1.5.
125125
126126
# Examples
127127
```jldoctest
128-
julia> cumsum([1, 1, 1])
128+
julia> cumsum(1:3)
129129
3-element Vector{Int64}:
130130
1
131-
2
132131
3
132+
6
133+
134+
julia> cumsum((true, false, true, false, true))
135+
(1, 1, 2, 2, 3)
133136
134-
julia> cumsum([fill(1, 2) for i in 1:3])
137+
julia> cumsum(fill(1, 2) for i in 1:3)
135138
3-element Vector{Vector{Int64}}:
136139
[1, 1]
137140
[2, 2]
138141
[3, 3]
139-
140-
julia> cumsum((1, 1, 1))
141-
(1, 2, 3)
142-
143-
julia> cumsum(x^2 for x in 1:3)
144-
3-element Vector{Int64}:
145-
1
146-
5
147-
14
148142
```
149143
"""
150144
cumsum(x::AbstractVector) = cumsum(x, dims=1)
@@ -177,10 +171,7 @@ to control the precision of the output (e.g. to avoid overflow).
177171
178172
# Examples
179173
```jldoctest
180-
julia> a = [1 2 3; 4 5 6]
181-
2×3 Matrix{Int64}:
182-
1 2 3
183-
4 5 6
174+
julia> a = Int8[1 2 3; 4 5 6];
184175
185176
julia> cumprod(a, dims=1)
186177
2×3 Matrix{Int64}:
@@ -200,9 +191,7 @@ end
200191
"""
201192
cumprod(itr)
202193
203-
Cumulative product of an iterator. See also
204-
[`cumprod!`](@ref) to use a preallocated output array, both for performance and
205-
to control the precision of the output (e.g. to avoid overflow).
194+
Cumulative product of an iterator.
206195
207196
See also [`cumprod!`](@ref), [`accumulate`](@ref), [`cumsum`](@ref).
208197
@@ -217,20 +206,16 @@ julia> cumprod(fill(1//2, 3))
217206
1//4
218207
1//8
219208
220-
julia> cumprod([fill(1//3, 2, 2) for i in 1:3])
221-
3-element Vector{Matrix{Rational{Int64}}}:
222-
[1//3 1//3; 1//3 1//3]
223-
[2//9 2//9; 2//9 2//9]
224-
[4//27 4//27; 4//27 4//27]
209+
julia> cumprod((1, 2, 1, 3, 1))
210+
(1, 2, 2, 6, 6)
225211
226-
julia> cumprod((1, 2, 1))
227-
(1, 2, 2)
228-
229-
julia> cumprod(x^2 for x in 1:3)
230-
3-element Vector{Int64}:
231-
1
232-
4
233-
36
212+
julia> cumprod("julia")
213+
5-element Vector{String}:
214+
"j"
215+
"ju"
216+
"jul"
217+
"juli"
218+
"julia"
234219
```
235220
"""
236221
cumprod(x::AbstractVector) = cumprod(x, dims=1)
@@ -243,8 +228,11 @@ cumprod(itr) = accumulate(mul_prod, itr)
243228
Cumulative operation `op` along the dimension `dims` of `A` (providing `dims` is optional
244229
for vectors). An initial value `init` may optionally be provided by a keyword argument. See
245230
also [`accumulate!`](@ref) to use a preallocated output array, both for performance and
246-
to control the precision of the output (e.g. to avoid overflow). For common operations
247-
there are specialized variants of `accumulate`, see: [`cumsum`](@ref), [`cumprod`](@ref)
231+
to control the precision of the output (e.g. to avoid overflow).
232+
233+
For common operations there are specialized variants of `accumulate`,
234+
see [`cumsum`](@ref), [`cumprod`](@ref). For a lazy version, see
235+
[`Iterators.accumulate`](@ref).
248236
249237
!!! compat "Julia 1.5"
250238
`accumulate` on a non-array iterator requires at least Julia 1.5.
@@ -257,35 +245,28 @@ julia> accumulate(+, [1,2,3])
257245
3
258246
6
259247
260-
julia> accumulate(*, [1,2,3])
261-
3-element Vector{Int64}:
262-
1
263-
2
264-
6
248+
julia> accumulate(min, (1, -2, 3, -4, 5), init=0)
249+
(0, -2, -2, -4, -4)
265250
266-
julia> accumulate(+, [1,2,3]; init=100)
267-
3-element Vector{Int64}:
268-
101
269-
103
270-
106
251+
julia> accumulate(/, (2, 4, Inf), init=100)
252+
(50.0, 12.5, 0.0)
271253
272-
julia> accumulate(min, [1,2,-1]; init=0)
273-
3-element Vector{Int64}:
274-
0
275-
0
276-
-1
277-
278-
julia> accumulate(+, fill(1, 3, 3), dims=1)
279-
3×3 Matrix{Int64}:
280-
1 1 1
281-
2 2 2
282-
3 3 3
283-
284-
julia> accumulate(+, fill(1, 3, 3), dims=2)
285-
3×3 Matrix{Int64}:
286-
1 2 3
287-
1 2 3
288-
1 2 3
254+
julia> accumulate(=>, i^2 for i in 1:3)
255+
3-element Vector{Any}:
256+
1
257+
1 => 4
258+
(1 => 4) => 9
259+
260+
julia> accumulate(+, fill(1, 3, 4))
261+
3×4 Matrix{Int64}:
262+
1 4 7 10
263+
2 5 8 11
264+
3 6 9 12
265+
266+
julia> accumulate(+, fill(1, 2, 5), dims=2, init=100.0)
267+
2×5 Matrix{Float64}:
268+
101.0 102.0 103.0 104.0 105.0
269+
101.0 102.0 103.0 104.0 105.0
289270
```
290271
"""
291272
function accumulate(op, A; dims::Union{Nothing,Integer}=nothing, kw...)
@@ -318,41 +299,39 @@ end
318299
319300
Cumulative operation `op` on `A` along the dimension `dims`, storing the result in `B`.
320301
Providing `dims` is optional for vectors. If the keyword argument `init` is given, its
321-
value is used to instantiate the accumulation. See also [`accumulate`](@ref).
302+
value is used to instantiate the accumulation.
303+
304+
See also [`accumulate`](@ref), [`cumsum!`](@ref), [`cumprod!`](@ref).
322305
323306
# Examples
324307
```jldoctest
325308
julia> x = [1, 0, 2, 0, 3];
326309
327-
julia> y = [0, 0, 0, 0, 0];
310+
julia> y = rand(5);
328311
329312
julia> accumulate!(+, y, x);
330313
331314
julia> y
332-
5-element Vector{Int64}:
333-
1
334-
1
335-
3
336-
3
337-
6
315+
5-element Vector{Float64}:
316+
1.0
317+
1.0
318+
3.0
319+
3.0
320+
6.0
338321
339-
julia> A = [1 2; 3 4];
322+
julia> A = [1 2 3; 4 5 6];
340323
341-
julia> B = [0 0; 0 0];
324+
julia> B = similar(A);
342325
343-
julia> accumulate!(-, B, A, dims=1);
344-
345-
julia> B
346-
2×2 Matrix{Int64}:
347-
1 2
348-
-2 -2
349-
350-
julia> accumulate!(-, B, A, dims=2);
326+
julia> accumulate!(-, B, A, dims=1)
327+
2×3 Matrix{Int64}:
328+
1 2 3
329+
-3 -3 -3
351330
352-
julia> B
353-
2 Matrix{Int64}:
354-
1 -1
355-
3 -1
331+
julia> accumulate!(*, B, A, dims=2, init=10)
332+
3 Matrix{Int64}:
333+
10 20 60
334+
40 200 1200
356335
```
357336
"""
358337
function accumulate!(op, B, A; dims::Union{Integer, Nothing} = nothing, kw...)

base/array.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2070,7 +2070,7 @@ findfirst(p::Union{Fix2{typeof(isequal),Int},Fix2{typeof(==),Int}}, r::OneTo{Int
20702070
1 <= p.x <= r.stop ? p.x : nothing
20712071

20722072
findfirst(p::Union{Fix2{typeof(isequal),T},Fix2{typeof(==),T}}, r::AbstractUnitRange) where {T<:Integer} =
2073-
first(r) <= p.x <= last(r) ? 1+Int(p.x - first(r)) : nothing
2073+
first(r) <= p.x <= last(r) ? firstindex(r) + Int(p.x - first(r)) : nothing
20742074

20752075
function findfirst(p::Union{Fix2{typeof(isequal),T},Fix2{typeof(==),T}}, r::StepRange{T,S}) where {T,S}
20762076
isempty(r) && return nothing

0 commit comments

Comments
 (0)