Skip to content

Commit d451800

Browse files
araujomsjishnub
andauthored
fix herk with complex α (#1297)
Fixes a bug that I introduced in #1249. Sorry about that. --------- Co-authored-by: Jishnu Bhattacharya <jishnub.github@gmail.com>
1 parent 27de9e9 commit d451800

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/matmul.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -820,7 +820,7 @@ Base.@constprop :aggressive function herk_wrapper!(C::StridedMatrix{TC}, tA::Abs
820820
end
821821

822822
# BLAS.herk! only updates hermitian C, alpha and beta need to be real
823-
if iszero(β) || ishermitian(C)
823+
if isreal(α) && isreal(β) && (iszero(β) || ishermitian(C))
824824
alpha, beta = promote(α, β, zero(T))
825825
if (alpha isa T && beta isa T &&
826826
stride(A, 1) == stride(C, 1) == 1 &&

test/matmul.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -549,6 +549,10 @@ end
549549
@test mul!(copy(C), A', A, true, 2) 3C
550550
D = Matrix(Hermitian(A * A'))
551551
@test mul!(copy(D), A, A', true, 3) 4D
552+
if T <: Complex
553+
@test mul!(2C, A', A, im, 2) (4 + im) * C
554+
@test mul!(2D, A, A', im, 3) (6 + im) * D
555+
end
552556
end
553557
end
554558

0 commit comments

Comments
 (0)