Skip to content

Commit e05561b

Browse files
authored
Merge branch 'master' into vs/1164
2 parents 697ee4f + 55eddfc commit e05561b

18 files changed

+870
-738
lines changed

.ci/Manifest.toml

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ version = "1.11.0"
1919
[[deps.CompilerSupportLibraries_jll]]
2020
deps = ["Artifacts", "Libdl"]
2121
uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae"
22-
version = "1.2.0+0"
22+
version = "1.3.0+1"
2323

2424
[[deps.Dates]]
2525
deps = ["Printf"]
@@ -66,24 +66,24 @@ uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
6666
version = "0.6.4"
6767

6868
[[deps.LibCURL_jll]]
69-
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"]
69+
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "OpenSSL_jll", "Zlib_jll", "nghttp2_jll"]
7070
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
71-
version = "8.6.0+0"
71+
version = "8.11.1+1"
7272

7373
[[deps.LibGit2]]
7474
deps = ["LibGit2_jll", "NetworkOptions", "Printf", "SHA"]
7575
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
7676
version = "1.11.0"
7777

7878
[[deps.LibGit2_jll]]
79-
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll"]
79+
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "OpenSSL_jll"]
8080
uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5"
81-
version = "1.8.0+0"
81+
version = "1.9.0+0"
8282

8383
[[deps.LibSSH2_jll]]
84-
deps = ["Artifacts", "Libdl", "MbedTLS_jll"]
84+
deps = ["Artifacts", "Libdl", "OpenSSL_jll"]
8585
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"
86-
version = "1.11.0+1"
86+
version = "1.11.3+1"
8787

8888
[[deps.Libdl]]
8989
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
@@ -104,31 +104,29 @@ deps = ["Base64", "JuliaSyntaxHighlighting", "StyledStrings"]
104104
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
105105
version = "1.11.0"
106106

107-
[[deps.MbedTLS_jll]]
108-
deps = ["Artifacts", "Libdl"]
109-
uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1"
110-
version = "2.28.6+1"
111-
112107
[[deps.MozillaCACerts_jll]]
113108
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
114-
version = "2024.3.11"
109+
version = "2024.12.31"
115110

116111
[[deps.NetworkOptions]]
117112
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
118-
version = "1.2.0"
113+
version = "1.3.0"
119114

120115
[[deps.OpenBLAS_jll]]
121116
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
122117
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
123-
version = "0.3.28+3"
118+
version = "0.3.29+0"
119+
120+
[[deps.OpenSSL_jll]]
121+
deps = ["Artifacts", "Libdl"]
122+
uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
123+
version = "3.0.15+2"
124124

125125
[[deps.PackageCompiler]]
126126
deps = ["Artifacts", "Glob", "LazyArtifacts", "Libdl", "Pkg", "Printf", "RelocatableFolders", "TOML", "UUIDs", "p7zip_jll"]
127-
git-tree-sha1 = "946623a388d8cb5874a0e2cb062dbbcfbb90cea5"
128-
repo-rev = "kc/artifacts"
129-
repo-url = "https://github.com/JuliaLang/PackageCompiler.jl.git"
127+
git-tree-sha1 = "5d13e5b70011762b74f86fc08385303589f80272"
130128
uuid = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
131-
version = "2.1.24"
129+
version = "2.2.0"
132130

133131
[[deps.Pkg]]
134132
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "Random", "SHA", "TOML", "Tar", "UUIDs", "p7zip_jll"]
@@ -206,19 +204,19 @@ version = "1.11.0"
206204
[[deps.Zlib_jll]]
207205
deps = ["Libdl"]
208206
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
209-
version = "1.3.1+1"
207+
version = "1.3.1+2"
210208

211209
[[deps.libblastrampoline_jll]]
212210
deps = ["Artifacts", "Libdl"]
213211
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
214-
version = "5.11.2+0"
212+
version = "5.12.0+0"
215213

216214
[[deps.nghttp2_jll]]
217215
deps = ["Artifacts", "Libdl"]
218216
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
219-
version = "1.63.0+1"
217+
version = "1.64.0+1"
220218

221219
[[deps.p7zip_jll]]
222220
deps = ["Artifacts", "Libdl"]
223221
uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
224-
version = "17.5.0+1"
222+
version = "17.5.0+2"

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "LinearAlgebra"
22
uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
3-
version = "1.11.0"
3+
version = "1.12.0"
44

55
[deps]
66
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"

src/dense.jl

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,24 +1587,25 @@ factorize(A::Transpose) = transpose(factorize(parent(A)))
15871587
factorize(a::Number) = a # same as how factorize behaves on Diagonal types
15881588

15891589
function getstructure(A::StridedMatrix)
1590+
require_one_based_indexing(A)
15901591
m, n = size(A)
15911592
if m == 1 return A[1] end
15921593
utri = true
15931594
utri1 = true
15941595
herm = true
15951596
sym = true
1596-
for j = 1:n-1, i = j+1:m
1597-
if utri1
1597+
for j = 1:n, i = j:m
1598+
if (j < n) && (i > j) && utri1 # indices are off-diagonal
15981599
if A[i,j] != 0
15991600
utri1 = i == j + 1
16001601
utri = false
16011602
end
16021603
end
16031604
if sym
1604-
sym &= A[i,j] == A[j,i]
1605+
sym &= A[i,j] == transpose(A[j,i])
16051606
end
16061607
if herm
1607-
herm &= A[i,j] == conj(A[j,i])
1608+
herm &= A[i,j] == adjoint(A[j,i])
16081609
end
16091610
if !(utri1|herm|sym) break end
16101611
end
@@ -1617,10 +1618,12 @@ function getstructure(A::StridedMatrix)
16171618
if ltri1
16181619
for i = 1:n-1
16191620
if A[i,i+1] != 0
1620-
ltri &= false
1621+
ltri = false
16211622
break
16221623
end
16231624
end
1625+
else
1626+
ltri = false
16241627
end
16251628
return (utri, utri1, ltri, ltri1, sym, herm)
16261629
end
@@ -1779,6 +1782,10 @@ Condition number of the matrix `M`, computed using the operator `p`-norm. Valid
17791782
"""
17801783
function cond(A::AbstractMatrix, p::Real=2)
17811784
if p == 2
1785+
if isempty(A)
1786+
checksquare(A)
1787+
return zero(real(eigtype(eltype(A))))
1788+
end
17821789
v = svdvals(A)
17831790
maxv = maximum(v)
17841791
return iszero(maxv) ? oftype(real(maxv), Inf) : maxv / minimum(v)

src/lapack.jl

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2975,10 +2975,10 @@ for (orglq, orgqr, orgql, orgrq, ormlq, ormqr, ormql, ormrq, gemqrt, elty) in
29752975
mA = size(A, 1)
29762976
k = length(tau)
29772977
if side == 'L' && m != mA
2978-
throw(DimensionMismatch(lazy"for a left-sided multiplication, the first dimension of C, $m, must equal the second dimension of A, $mA"))
2978+
throw(DimensionMismatch(lazy"for a left-sided multiplication, the first dimension of C, $m, must equal the first dimension of A, $mA"))
29792979
end
29802980
if side == 'R' && n != mA
2981-
throw(DimensionMismatch(lazy"for a right-sided multiplication, the second dimension of C, $m, must equal the second dimension of A, $mA"))
2981+
throw(DimensionMismatch(lazy"for a right-sided multiplication, the second dimension of C, $n, must equal the first dimension of A, $mA"))
29822982
end
29832983
if side == 'L' && k > m
29842984
throw(DimensionMismatch(lazy"invalid number of reflectors: k = $k should be <= m = $m"))
@@ -3025,10 +3025,10 @@ for (orglq, orgqr, orgql, orgrq, ormlq, ormqr, ormql, ormrq, gemqrt, elty) in
30253025
mA = size(A, 1)
30263026
k = length(tau)
30273027
if side == 'L' && m != mA
3028-
throw(DimensionMismatch(lazy"for a left-sided multiplication, the first dimension of C, $m, must equal the second dimension of A, $mA"))
3028+
throw(DimensionMismatch(lazy"for a left-sided multiplication, the first dimension of C, $m, must equal the first dimension of A, $mA"))
30293029
end
30303030
if side == 'R' && n != mA
3031-
throw(DimensionMismatch(lazy"for a right-sided multiplication, the second dimension of C, $m, must equal the second dimension of A, $mA"))
3031+
throw(DimensionMismatch(lazy"for a right-sided multiplication, the second dimension of C, $n, must equal the first dimension of A, $mA"))
30323032
end
30333033
if side == 'L' && k > m
30343034
throw(DimensionMismatch(lazy"invalid number of reflectors: k = $k should be <= m = $m"))
@@ -3078,7 +3078,7 @@ for (orglq, orgqr, orgql, orgrq, ormlq, ormqr, ormql, ormrq, gemqrt, elty) in
30783078
throw(DimensionMismatch(lazy"for a left-sided multiplication, the first dimension of C, $m, must equal the second dimension of A, $nA"))
30793079
end
30803080
if side == 'R' && n != nA
3081-
throw(DimensionMismatch(lazy"for a right-sided multiplication, the second dimension of C, $m, must equal the second dimension of A, $nA"))
3081+
throw(DimensionMismatch(lazy"for a right-sided multiplication, the second dimension of C, $n, must equal the second dimension of A, $nA"))
30823082
end
30833083
if side == 'L' && k > m
30843084
throw(DimensionMismatch(lazy"invalid number of reflectors: k = $k should be <= m = $m"))
@@ -5391,9 +5391,9 @@ for (syev, syevr, syevd, sygvd, elty) in
53915391
W = similar(A, $elty, n)
53925392
ldz = n
53935393
if jobz == 'N'
5394-
Z = similar(A, $elty, ldz, 0)
5394+
Z = similar(A, $elty, 0)
53955395
elseif jobz == 'V'
5396-
Z = similar(A, $elty, ldz, n)
5396+
Z = similar(A, $elty, ldz * n)
53975397
end
53985398
isuppz = similar(A, BlasInt, 2*n)
53995399
work = Vector{$elty}(undef, 1)
@@ -5423,7 +5423,8 @@ for (syev, syevr, syevd, sygvd, elty) in
54235423
resize!(iwork, liwork)
54245424
end
54255425
end
5426-
W[1:m[]], Z[:,1:(jobz == 'V' ? m[] : 0)]
5426+
zm = jobz == 'V' ? m[] : 0
5427+
resize!(W, m[]), reshape(resize!(Z, ldz * zm), ldz, zm)
54275428
end
54285429
syevr!(jobz::AbstractChar, A::AbstractMatrix{$elty}) =
54295430
syevr!(jobz, 'A', 'U', A, 0.0, 0.0, 0, 0, -1.0)
@@ -5593,10 +5594,10 @@ for (syev, syevr, syevd, sygvd, elty, relty) in
55935594
W = similar(A, $relty, n)
55945595
if jobz == 'N'
55955596
ldz = 1
5596-
Z = similar(A, $elty, ldz, 0)
5597+
Z = similar(A, $elty, 0)
55975598
elseif jobz == 'V'
55985599
ldz = n
5599-
Z = similar(A, $elty, ldz, n)
5600+
Z = similar(A, $elty, ldz * n)
56005601
end
56015602
isuppz = similar(A, BlasInt, 2*n)
56025603
work = Vector{$elty}(undef, 1)
@@ -5632,7 +5633,8 @@ for (syev, syevr, syevd, sygvd, elty, relty) in
56325633
resize!(iwork, liwork)
56335634
end
56345635
end
5635-
W[1:m[]], Z[:,1:(jobz == 'V' ? m[] : 0)]
5636+
zm = jobz == 'V' ? m[] : 0
5637+
resize!(W, m[]), reshape(resize!(Z, ldz * zm), ldz, zm)
56365638
end
56375639
syevr!(jobz::AbstractChar, A::AbstractMatrix{$elty}) =
56385640
syevr!(jobz, 'A', 'U', A, 0.0, 0.0, 0, 0, -1.0)

test/bidiag.jl

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ using LinearAlgebra: BlasReal, BlasFloat
77

88
const BASE_TEST_PATH = joinpath(Sys.BINDIR, "..", "share", "julia", "test")
99

10-
isdefined(Main, :Furlongs) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "Furlongs.jl"))
11-
using .Main.Furlongs
12-
1310
isdefined(Main, :Quaternions) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "Quaternions.jl"))
1411
using .Main.Quaternions
1512

@@ -354,36 +351,33 @@ Random.seed!(1)
354351
@test norm(x-tx,Inf) <= 4*condT*max(eps()*norm(tx,Inf), eps(promty)*norm(x,Inf))
355352
end
356353
@testset "Specialized multiplication/division" begin
357-
getval(x) = x
358-
getval(x::Furlong) = x.val
359354
function _bidiagdivmultest(T,
360355
x,
361356
typemul=T.uplo == 'U' ? UpperTriangular : Matrix,
362357
typediv=T.uplo == 'U' ? UpperTriangular : Matrix,
363358
typediv2=T.uplo == 'U' ? UpperTriangular : Matrix)
364359
TM = Matrix(T)
365-
@test map(getval, (T*x)::typemul) map(getval, TM*x)
366-
@test map(getval, (x*T)::typemul) map(getval, x*TM)
367-
@test map(getval, (x\T)::typediv) map(getval, x\TM)
368-
@test map(getval, (T/x)::typediv) map(getval, TM/x)
360+
@test (T*x)::typemul TM*x
361+
@test (x*T)::typemul x*TM
362+
@test (x\T)::typediv x\TM
363+
@test (T/x)::typediv TM/x
369364
if !isa(x, Number)
370-
@test map(getval, Array((T\x)::typediv2)) map(getval, Array(TM\x))
371-
@test map(getval, Array((x/T)::typediv2)) map(getval, Array(x/TM))
365+
@test Array((T\x)::typediv2) Array(TM\x)
366+
@test Array((x/T)::typediv2) Array(x/TM)
372367
end
373368
return nothing
374369
end
375370
A = Matrix(T)
376-
for t in (T, Furlong.(T)), (A, dv, ev) in ((A, dv, ev), (Furlong.(A), Furlong.(dv), Furlong.(ev)))
377-
_bidiagdivmultest(t, 5, Bidiagonal, Bidiagonal)
378-
_bidiagdivmultest(t, 5I, Bidiagonal, Bidiagonal, t.uplo == 'U' ? UpperTriangular : LowerTriangular)
379-
_bidiagdivmultest(t, Diagonal(dv), Bidiagonal, Bidiagonal, t.uplo == 'U' ? UpperTriangular : LowerTriangular)
380-
_bidiagdivmultest(t, UpperTriangular(A))
381-
_bidiagdivmultest(t, UnitUpperTriangular(A))
382-
_bidiagdivmultest(t, LowerTriangular(A), t.uplo == 'L' ? LowerTriangular : Matrix, t.uplo == 'L' ? LowerTriangular : Matrix, t.uplo == 'L' ? LowerTriangular : Matrix)
383-
_bidiagdivmultest(t, UnitLowerTriangular(A), t.uplo == 'L' ? LowerTriangular : Matrix, t.uplo == 'L' ? LowerTriangular : Matrix, t.uplo == 'L' ? LowerTriangular : Matrix)
384-
_bidiagdivmultest(t, Bidiagonal(dv, ev, :U), Matrix, Matrix, Matrix)
385-
_bidiagdivmultest(t, Bidiagonal(dv, ev, :L), Matrix, Matrix, Matrix)
386-
end
371+
t = T
372+
_bidiagdivmultest(t, 5, Bidiagonal, Bidiagonal)
373+
_bidiagdivmultest(t, 5I, Bidiagonal, Bidiagonal, t.uplo == 'U' ? UpperTriangular : LowerTriangular)
374+
_bidiagdivmultest(t, Diagonal(dv), Bidiagonal, Bidiagonal, t.uplo == 'U' ? UpperTriangular : LowerTriangular)
375+
_bidiagdivmultest(t, UpperTriangular(A))
376+
_bidiagdivmultest(t, UnitUpperTriangular(A))
377+
_bidiagdivmultest(t, LowerTriangular(A), t.uplo == 'L' ? LowerTriangular : Matrix, t.uplo == 'L' ? LowerTriangular : Matrix, t.uplo == 'L' ? LowerTriangular : Matrix)
378+
_bidiagdivmultest(t, UnitLowerTriangular(A), t.uplo == 'L' ? LowerTriangular : Matrix, t.uplo == 'L' ? LowerTriangular : Matrix, t.uplo == 'L' ? LowerTriangular : Matrix)
379+
_bidiagdivmultest(t, Bidiagonal(dv, ev, :U), Matrix, Matrix, Matrix)
380+
_bidiagdivmultest(t, Bidiagonal(dv, ev, :L), Matrix, Matrix, Matrix)
387381
end
388382
end
389383

test/blas.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ end
776776
# Make sure we can use `Base.libblas_name`. Avoid causing
777777
# https://github.com/JuliaLang/julia/issues/48427 again.
778778
@testset "libblas_name" begin
779-
dot_sym = dlsym(dlopen(Base.libblas_name), "cblas_ddot" * (Sys.WORD_SIZE == 64 ? "64_" : ""))
779+
dot_sym = dlsym(dlopen(BLAS.libblastrampoline), "cblas_ddot" * (Sys.WORD_SIZE == 64 ? "64_" : ""))
780780
@test 23.0 === @ccall $(dot_sym)(2::Int, [2.0, 3.0]::Ref{Cdouble}, 1::Int, [4.0, 5.0]::Ref{Cdouble}, 1::Int)::Cdouble
781781
end
782782

test/dense.jl

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,18 @@ Random.seed!(1234323)
5656
@test cond(Mars, 2) 6.181867355918493
5757
@test cond(Mars, Inf) 7.1
5858
end
59+
@testset "Empty matrices" begin
60+
for p in (1,2,Inf)
61+
# zero for square (i.e. 0×0) matrices
62+
@test cond(zeros(Int, 0, 0), p) === 0.0
63+
@test cond(zeros(0, 0), p) === 0.0
64+
@test cond(zeros(ComplexF64, 0, 0), p) === 0.0
65+
# error for non-square matrices
66+
for size in ((10,0), (0,10))
67+
@test_throws DimensionMismatch cond(zeros(size...), p)
68+
end
69+
end
70+
end
5971
end
6072

6173
areal = randn(n,n)/2
@@ -1347,4 +1359,11 @@ end
13471359
end
13481360
end
13491361

1362+
@testset "structure of dense matrices" begin
1363+
# A is neither triangular nor symmetric/Hermitian
1364+
A = [1 im 2; -im 0 3; 2 3 im]
1365+
@test factorize(A) isa LU{ComplexF64, Matrix{ComplexF64}, Vector{Int}}
1366+
@test !any(LinearAlgebra.getstructure(A))
1367+
end
1368+
13501369
end # module TestDense

test/diagonal.jl

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ using Test, LinearAlgebra, Random
66
using LinearAlgebra: BlasFloat, BlasComplex
77

88
const BASE_TEST_PATH = joinpath(Sys.BINDIR, "..", "share", "julia", "test")
9-
isdefined(Main, :Furlongs) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "Furlongs.jl"))
10-
using .Main.Furlongs
119

1210
isdefined(Main, :OffsetArrays) || @eval Main include(joinpath($(BASE_TEST_PATH), "testhelpers", "OffsetArrays.jl"))
1311
using .Main.OffsetArrays
@@ -470,23 +468,6 @@ Random.seed!(1)
470468
@test svdvals(D) == s
471469
@test svd(D).V == V
472470
end
473-
474-
@testset "svd/eigen with Diagonal{Furlong}" begin
475-
Du = Furlong.(D)
476-
@test Du isa Diagonal{<:Furlong{1}}
477-
F = svd(Du)
478-
U, s, V = F
479-
@test map(x -> x.val, Matrix(F)) map(x -> x.val, Du)
480-
@test svdvals(Du) == s
481-
@test U isa AbstractMatrix{<:Furlong{0}}
482-
@test V isa AbstractMatrix{<:Furlong{0}}
483-
@test s isa AbstractVector{<:Furlong{1}}
484-
E = eigen(Du)
485-
vals, vecs = E
486-
@test Matrix(E) == Du
487-
@test vals isa AbstractVector{<:Furlong{1}}
488-
@test vecs isa AbstractMatrix{<:Furlong{0}}
489-
end
490471
end
491472

492473
@testset "axes" begin

0 commit comments

Comments
 (0)