Skip to content

Commit e91c1c4

Browse files
committed
fix non-real α
1 parent 9ec3005 commit e91c1c4

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/matmul.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ Base.@constprop :aggressive function generic_matmatmul_wrapper!(C::StridedMatrix
585585
blasfn = _valtypeparam(val)
586586
if blasfn == BlasFlag.SYRK && T <: Union{Real,Complex} && (iszero(β) || issymmetric(C))
587587
return copytri!(generic_syrk!(C, A, false, aat, α, β), 'U')
588-
elseif blasfn == BlasFlag.HERK && (iszero(β) || ishermitian(C))
588+
elseif blasfn == BlasFlag.HERK && isreal(α) && isreal(β) && (iszero(β) || ishermitian(C))
589589
return copytri!(generic_syrk!(C, A, true, aat, α, β), 'U', true)
590590
end
591591
end

test/generic.jl

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,17 @@ end
145145
mul!(cbig, transpose(a), a, α, false)
146146
LinearAlgebra._generic_matmatmul!(cbig_fallback, transpose(a), a, α, false)
147147
@test cbig cbig_fallback
148+
if T <: Union{Real, Complex}
149+
@test issymmetric(csmall)
150+
@test issymmetric(cbig)
151+
end
152+
#make sure generic herk is not called for non-real α
153+
mul!(csmall, a, a', α, false)
154+
LinearAlgebra._generic_matmatmul!(csmall_fallback, a, a', α, false)
155+
@test csmall csmall_fallback
156+
mul!(cbig, a', a, α, false)
157+
LinearAlgebra._generic_matmatmul!(cbig_fallback, a', a, α, false)
158+
@test cbig cbig_fallback
148159
end
149160
end
150161

0 commit comments

Comments
 (0)