From ea1e3f8e42e5b9f18f7ec9c0c0e2cf0aabeb14a1 Mon Sep 17 00:00:00 2001 From: Bruno Ploumhans <13494793+Technici4n@users.noreply.github.com> Date: Sat, 25 Oct 2025 11:25:25 +0200 Subject: [PATCH 1/3] Fix forgotten conj(alpha) in her2k documentation (#1480) --- src/blas.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/blas.jl b/src/blas.jl index 71e28e01..642a5f75 100644 --- a/src/blas.jl +++ b/src/blas.jl @@ -2102,7 +2102,7 @@ end her2k!(uplo, trans, alpha, A, B, beta, C) Rank-2k update of the Hermitian matrix `C` as -`alpha*A*B' + alpha*B*A' + beta*C` or `alpha*A'*B + alpha*B'*A + beta*C` +`alpha*A*B' + alpha'*B*A' + beta*C` or `alpha*A'*B + alpha'*B'*A + beta*C` according to [`trans`](@ref stdlib-blas-trans). The scalar `beta` has to be real. Only the [`uplo`](@ref stdlib-blas-uplo) triangle of `C` is used. Return `C`. """ @@ -2111,8 +2111,8 @@ function her2k! end """ her2k(uplo, trans, alpha, A, B) -Return the [`uplo`](@ref stdlib-blas-uplo) triangle of `alpha*A*B' + alpha*B*A'` -or `alpha*A'*B + alpha*B'*A`, according to [`trans`](@ref stdlib-blas-trans). +Return the [`uplo`](@ref stdlib-blas-uplo) triangle of `alpha*A*B' + alpha'*B*A'` +or `alpha*A'*B + alpha'*B'*A`, according to [`trans`](@ref stdlib-blas-trans). """ her2k(uplo, trans, alpha, A, B) From 81523314979fbb5155989f16cf65e915192be5d7 Mon Sep 17 00:00:00 2001 From: Daniel Karrasch Date: Wed, 26 Nov 2025 14:58:03 +0100 Subject: [PATCH 2/3] Fix 3-arg `dot` for empty arrays (#1485) --- src/bidiag.jl | 2 +- src/generic.jl | 2 ++ src/hessenberg.jl | 2 +- src/symmetric.jl | 1 + src/triangular.jl | 8 ++++---- src/tridiag.jl | 4 ++-- test/generic.jl | 4 ++++ 7 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/bidiag.jl b/src/bidiag.jl index 88b5a763..fe20ab42 100644 --- a/src/bidiag.jl +++ b/src/bidiag.jl @@ -1292,7 +1292,7 @@ function dot(x::AbstractVector, B::Bidiagonal, y::AbstractVector) nx, ny = length(x), length(y) (nx == size(B, 1) == ny) || throw(DimensionMismatch()) if nx ≤ 1 - nx == 0 && return dot(zero(eltype(x)), zero(eltype(B)), zero(eltype(y))) + nx == 0 && return zero(dot(zero(eltype(x)), zero(eltype(B)), zero(eltype(y)))) return dot(x[1], B.dv[1], y[1]) end ev, dv = B.ev, B.dv diff --git a/src/generic.jl b/src/generic.jl index e030f22e..bce84a8c 100644 --- a/src/generic.jl +++ b/src/generic.jl @@ -1034,6 +1034,8 @@ dot(x, A, y) = dot(x, A*y) # generic fallback for cases that are not covered by function dot(x::AbstractVector, A::AbstractMatrix, y::AbstractVector) (axes(x)..., axes(y)...) == axes(A) || throw(DimensionMismatch()) + # outermost zero call to avoid spurious sign ambiguity (like 0.0 - 0.0im) + any(isempty, (x, y)) && return zero(dot(zero(eltype(x)), zero(eltype(A)), zero(eltype(y)))) T = typeof(dot(first(x), first(A), first(y))) s = zero(T) i₁ = first(eachindex(x)) diff --git a/src/hessenberg.jl b/src/hessenberg.jl index 36450160..9c5e2e40 100644 --- a/src/hessenberg.jl +++ b/src/hessenberg.jl @@ -404,7 +404,7 @@ function dot(x::AbstractVector, H::UpperHessenberg, y::AbstractVector) m = size(H, 1) (length(x) == m == length(y)) || throw(DimensionMismatch()) if iszero(m) - return dot(zero(eltype(x)), zero(eltype(H)), zero(eltype(y))) + return zero(dot(zero(eltype(x)), zero(eltype(H)), zero(eltype(y)))) end x₁ = x[1] r = dot(x₁, H[1,1], y[1]) diff --git a/src/symmetric.jl b/src/symmetric.jl index 50f34022..90d93a08 100644 --- a/src/symmetric.jl +++ b/src/symmetric.jl @@ -774,6 +774,7 @@ function dot(x::AbstractVector, A::HermOrSym, y::AbstractVector) require_one_based_indexing(x, y) n = length(x) (n == length(y) == size(A, 1)) || throw(DimensionMismatch()) + iszero(n) && return zero(dot(zero(eltype(x)), zero(eltype(A)), zero(eltype(y)))) data = A.data s = dot(first(x), first(A), first(y)) r = zero(s+s) diff --git a/src/triangular.jl b/src/triangular.jl index d82ddd87..75c721bc 100644 --- a/src/triangular.jl +++ b/src/triangular.jl @@ -893,7 +893,7 @@ function dot(x::AbstractVector, A::UpperTriangular, y::AbstractVector) m = size(A, 1) (length(x) == m == length(y)) || throw(DimensionMismatch()) if iszero(m) - return dot(zero(eltype(x)), zero(eltype(A)), zero(eltype(y))) + return zero(dot(zero(eltype(x)), zero(eltype(A)), zero(eltype(y)))) end x₁ = x[1] r = dot(x₁, A[1,1], y[1]) @@ -914,7 +914,7 @@ function dot(x::AbstractVector, A::UnitUpperTriangular, y::AbstractVector) m = size(A, 1) (length(x) == m == length(y)) || throw(DimensionMismatch()) if iszero(m) - return dot(zero(eltype(x)), zero(eltype(A)), zero(eltype(y))) + return zero(dot(zero(eltype(x)), zero(eltype(A)), zero(eltype(y)))) end x₁ = first(x) r = dot(x₁, y[1]) @@ -936,7 +936,7 @@ function dot(x::AbstractVector, A::LowerTriangular, y::AbstractVector) m = size(A, 1) (length(x) == m == length(y)) || throw(DimensionMismatch()) if iszero(m) - return dot(zero(eltype(x)), zero(eltype(A)), zero(eltype(y))) + return zero(dot(zero(eltype(x)), zero(eltype(A)), zero(eltype(y)))) end r = zero(typeof(dot(first(x), first(A), first(y)))) @inbounds for j in axes(A, 2) @@ -956,7 +956,7 @@ function dot(x::AbstractVector, A::UnitLowerTriangular, y::AbstractVector) m = size(A, 1) (length(x) == m == length(y)) || throw(DimensionMismatch()) if iszero(m) - return dot(zero(eltype(x)), zero(eltype(A)), zero(eltype(y))) + return zero(dot(zero(eltype(x)), zero(eltype(A)), zero(eltype(y)))) end r = zero(typeof(dot(first(x), first(y)))) @inbounds for j in axes(A, 2) diff --git a/src/tridiag.jl b/src/tridiag.jl index a0e3d821..2357ecc1 100644 --- a/src/tridiag.jl +++ b/src/tridiag.jl @@ -253,7 +253,7 @@ function dot(x::AbstractVector, S::SymTridiagonal, y::AbstractVector) nx, ny = length(x), length(y) (nx == size(S, 1) == ny) || throw(DimensionMismatch("dot")) if nx ≤ 1 - nx == 0 && return dot(zero(eltype(x)), zero(eltype(S)), zero(eltype(y))) + nx == 0 && return zero(dot(zero(eltype(x)), zero(eltype(S)), zero(eltype(y)))) return dot(x[1], S.dv[1], y[1]) end dv, ev = S.dv, S.ev @@ -1022,7 +1022,7 @@ function dot(x::AbstractVector, A::Tridiagonal, y::AbstractVector) nx, ny = length(x), length(y) (nx == size(A, 1) == ny) || throw(DimensionMismatch()) if nx ≤ 1 - nx == 0 && return dot(zero(eltype(x)), zero(eltype(A)), zero(eltype(y))) + nx == 0 && return zero(dot(zero(eltype(x)), zero(eltype(A)), zero(eltype(y)))) return dot(x[1], A.d[1], y[1]) end @inbounds begin diff --git a/test/generic.jl b/test/generic.jl index a56c1006..d2bf2ffb 100644 --- a/test/generic.jl +++ b/test/generic.jl @@ -784,6 +784,10 @@ end @test dot(x, B', y) ≈ dot(B*x, y) elty <: Real && @test dot(x, transpose(B), y) ≈ dot(x, transpose(B)*y) end + for (m, n) in ((0, 0), (1, 0), (0, 1)) + v = zeros(ComplexF64, m); a = zeros(ComplexF64, m, n); w = zeros(Float64, n) + @test dot(v, a, w) === zero(ComplexF64) + end end @testset "condskeel #34512" begin From 99da7a53c40c3597de600f7113b8a2148d47a146 Mon Sep 17 00:00:00 2001 From: Lorenzo Bertini <106469113+bertini97@users.noreply.github.com> Date: Wed, 26 Nov 2025 23:25:25 +0100 Subject: [PATCH 3/3] Fixed typo in matmul.jl (#1492) Sorry to open this for just one letter, but I have to look at it a lot. Cheers. --- src/matmul.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/matmul.jl b/src/matmul.jl index d618bcfe..a08edfb1 100644 --- a/src/matmul.jl +++ b/src/matmul.jl @@ -465,7 +465,7 @@ end throw(DimensionMismatch( LazyString( "incompatible destination size: ", - lazy"the destination $strC of $size_or_len_str_C $C_size_len is incomatible with the product of a $strA of size $sizeA and a $strB of $size_or_len_str_B $B_size_len. ", + lazy"the destination $strC of $size_or_len_str_C $C_size_len is incompatible with the product of a $strA of size $sizeA and a $strB of $size_or_len_str_B $B_size_len. ", lazy"The destination must be of $size_or_len_str_dest $destsize." ) )