Skip to content

Commit

Permalink
Merge branch 'master' into BumpStdlibs/Statistics-d49c2bf-master
Browse files Browse the repository at this point in the history
  • Loading branch information
DilumAluthge authored Dec 16, 2024
2 parents e851a15 + b4c5e58 commit 2cce197
Show file tree
Hide file tree
Showing 23 changed files with 68 additions and 41 deletions.
2 changes: 1 addition & 1 deletion base/docs/basedocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1515,7 +1515,7 @@ kw"new"
"""
where
The `where` keyword creates a type that is an iterated union of other types, over all
The `where` keyword creates a [`UnionAll`](@ref) type, which may be thought of as an iterated union of other types, over all
values of some variable. For example `Vector{T} where T<:Real` includes all [`Vector`](@ref)s
where the element type is some kind of `Real` number.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
d3209f45b8ea01a22ac7e9b265e3b84f
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
314981eee11356f14b6dc9e07389c51432e7862d6c767d87d6679385f5a36faef34902954a5dfa6b37d8f3f25eaa4f23ba9431cc78acd3513377955e7d73f210

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9dbfa6c0a76d20b2ca8de844d08f3af4
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f5d2469419f4a083f84c1f23e6e528f4115804e45bdfdbd897110bb346aaa70afc57c24f9166ae20fb4305c1d40f5a77de4cfed7b69aef93f09d0d4eff183e3d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
e52615827242aae56422a4f73a8c6878
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
7b1df257616aaa9067f822a88dddf52bc10f9f61e3a0728e33e595455bd7167e680c50371c41cb25f8c8a9fb9cf40225847df1523a6c6f3571a471f7163f563c

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
411277f3701cc3e286ec8a84ccdf6f11
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
95a7e92389f6fd02d3bec17ec0201ba41316aa2d7c321b14af88ccce8246fd0000ed2c0cc818f87cb81f7134304233db897f656426a00caac1bc7635056260c2
2 changes: 1 addition & 1 deletion stdlib/ArgTools.version
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARGTOOLS_BRANCH = master
ARGTOOLS_SHA1 = 997089b9cd56404b40ff766759662e16dc1aab4b
ARGTOOLS_SHA1 = 1314758ad02ff5e9e5ca718920c6c633b467a84a
ARGTOOLS_GIT_URL := https://github.com/JuliaIO/ArgTools.jl.git
ARGTOOLS_TAR_URL = https://api.github.com/repos/JuliaIO/ArgTools.jl/tarball/$1
2 changes: 1 addition & 1 deletion stdlib/Downloads.version
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DOWNLOADS_BRANCH = master
DOWNLOADS_SHA1 = 89d3c7dded535a77551e763a437a6d31e4d9bf84
DOWNLOADS_SHA1 = afd04be8aa94204c075c8aec83fca040ebb4ff98
DOWNLOADS_GIT_URL := https://github.com/JuliaLang/Downloads.jl.git
DOWNLOADS_TAR_URL = https://api.github.com/repos/JuliaLang/Downloads.jl/tarball/$1
2 changes: 1 addition & 1 deletion stdlib/SHA.version
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SHA_BRANCH = master
SHA_SHA1 = aaf2df61ff8c3898196587a375d3cf213bd40b41
SHA_SHA1 = 8fa221ddc8f3b418d9929084f1644f4c32c9a27e
SHA_GIT_URL := https://github.com/JuliaCrypto/SHA.jl.git
SHA_TAR_URL = https://api.github.com/repos/JuliaCrypto/SHA.jl/tarball/$1
2 changes: 1 addition & 1 deletion stdlib/StyledStrings.version
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
STYLEDSTRINGS_BRANCH = main
STYLEDSTRINGS_SHA1 = 056e843b2d428bb9735b03af0cff97e738ac7e14
STYLEDSTRINGS_SHA1 = 8985a37ac054c37d084a03ad2837208244824877
STYLEDSTRINGS_GIT_URL := https://github.com/JuliaLang/StyledStrings.jl.git
STYLEDSTRINGS_TAR_URL = https://api.github.com/repos/JuliaLang/StyledStrings.jl/tarball/$1
21 changes: 21 additions & 0 deletions test/abstractarray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2206,3 +2206,24 @@ end
@test b.ref === a.ref
end
end
@testset "AbstractArrayMath" begin
@testset "IsReal" begin
A = [1, 2, 3, 4]
@test isreal(A) == true
B = [1.1, 2.2, 3.3, 4.4]
@test isreal(B) == true
C = [1, 2.2, 3]
@test isreal(C) == true
D = Real[]
@test isreal(D) == true
E = [1 + 1im, 2 - 2im]
@test isreal(E) == false
struct MyReal <: Real
value::Float64
end
F = [MyReal(1.0), MyReal(2.0)]
@test isreal(F) == true
G = ["a", "b", "c"]
@test_throws MethodError isreal(G)
end
end
62 changes: 34 additions & 28 deletions test/arrayops.jl
Original file line number Diff line number Diff line change
Expand Up @@ -307,34 +307,40 @@ end
@test_throws ArgumentError dropdims(a, dims=3)
@test_throws ArgumentError dropdims(a, dims=4)
@test_throws ArgumentError dropdims(a, dims=6)


a = rand(8, 7)
@test @inferred(insertdims(a, dims=1)) == @inferred(insertdims(a, dims=(1,))) == reshape(a, (1, 8, 7))
@test @inferred(insertdims(a, dims=3)) == @inferred(insertdims(a, dims=(3,))) == reshape(a, (8, 7, 1))
@test @inferred(insertdims(a, dims=(1, 3))) == reshape(a, (1, 8, 1, 7))
@test @inferred(insertdims(a, dims=(1, 2, 3))) == reshape(a, (1, 1, 1, 8, 7))
@test @inferred(insertdims(a, dims=(1, 4))) == reshape(a, (1, 8, 7, 1))
@test @inferred(insertdims(a, dims=(1, 3, 5))) == reshape(a, (1, 8, 1, 7, 1))
@test @inferred(insertdims(a, dims=(1, 2, 4, 6))) == reshape(a, (1, 1, 8, 1, 7, 1))
@test @inferred(insertdims(a, dims=(1, 3, 4, 6))) == reshape(a, (1, 8, 1, 1, 7, 1))
@test @inferred(insertdims(a, dims=(1, 4, 6, 3))) == reshape(a, (1, 8, 1, 1, 7, 1))
@test @inferred(insertdims(a, dims=(1, 3, 5, 6))) == reshape(a, (1, 8, 1, 7, 1, 1))

@test_throws ArgumentError insertdims(a, dims=(1, 1, 2, 3))
@test_throws ArgumentError insertdims(a, dims=(1, 2, 2, 3))
@test_throws ArgumentError insertdims(a, dims=(1, 2, 3, 3))
@test_throws UndefKeywordError insertdims(a)
@test_throws ArgumentError insertdims(a, dims=0)
@test_throws ArgumentError insertdims(a, dims=(1, 2, 1))
@test_throws ArgumentError insertdims(a, dims=4)
@test_throws ArgumentError insertdims(a, dims=6)

# insertdims and dropdims are inverses
b = rand(1,1,1,5,1,1,7)
for dims in [1, (1,), 2, (2,), 3, (3,), (1,3), (1,2,3), (1,2), (1,3,5), (1,2,5,6), (1,3,5,6), (1,3,5,6), (1,6,5,3)]
@test dropdims(insertdims(a; dims); dims) == a
@test insertdims(dropdims(b; dims); dims) == b
@testset "insertdims" begin
a = rand(8, 7)
@test @inferred(insertdims(a, dims=1)) == @inferred(insertdims(a, dims=(1,))) == reshape(a, (1, 8, 7))
@test @inferred(insertdims(a, dims=3)) == @inferred(insertdims(a, dims=(3,))) == reshape(a, (8, 7, 1))
@test @inferred(insertdims(a, dims=(1, 3))) == reshape(a, (1, 8, 1, 7))
@test @inferred(insertdims(a, dims=(1, 2, 3))) == reshape(a, (1, 1, 1, 8, 7))
@test @inferred(insertdims(a, dims=(1, 4))) == reshape(a, (1, 8, 7, 1))
@test @inferred(insertdims(a, dims=(1, 3, 5))) == reshape(a, (1, 8, 1, 7, 1))
@test @inferred(insertdims(a, dims=(1, 2, 4, 6))) == reshape(a, (1, 1, 8, 1, 7, 1))
@test @inferred(insertdims(a, dims=(1, 3, 4, 6))) == reshape(a, (1, 8, 1, 1, 7, 1))
@test @inferred(insertdims(a, dims=(1, 4, 6, 3))) == reshape(a, (1, 8, 1, 1, 7, 1))
@test @inferred(insertdims(a, dims=(1, 3, 5, 6))) == reshape(a, (1, 8, 1, 7, 1, 1))
@test_throws ArgumentError insertdims(a, dims=(1, 1, 2, 3))
@test_throws ArgumentError insertdims(a, dims=(1, 2, 2, 3))
@test_throws ArgumentError insertdims(a, dims=(1, 2, 3, 3))
@test_throws UndefKeywordError insertdims(a)
@test_throws ArgumentError insertdims(a, dims=0)
@test_throws ArgumentError insertdims(a, dims=(1, 2, 1))
@test_throws ArgumentError insertdims(a, dims=4)
@test_throws ArgumentError insertdims(a, dims=6)
A = reshape(1:6, 2, 3)
@test_throws ArgumentError insertdims(A, dims=(2, 2))
D = insertdims(A, dims=())
@test size(D) == size(A)
@test D == A
E = ones(2, 3, 4)
F = insertdims(E, dims=(2, 4, 6))
@test size(F) == (2, 1, 3, 1, 4, 1)
# insertdims and dropdims are inverses
b = rand(1,1,1,5,1,1,7)
for dims in [1, (1,), 2, (2,), 3, (3,), (1,3), (1,2,3), (1,2), (1,3,5), (1,2,5,6), (1,3,5,6), (1,3,5,6), (1,6,5,3)]
@test dropdims(insertdims(a; dims); dims) == a
@test insertdims(dropdims(b; dims); dims) == b
end
end

sz = (5,8,7)
Expand Down

0 comments on commit 2cce197

Please sign in to comment.