Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Complete size checks in BLAS.[sy/he]mm! #45605

Merged
merged 3 commits into from
Jul 7, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions stdlib/LinearAlgebra/src/blas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1545,6 +1545,9 @@ for (mfname, elty) in ((:dsymm_,:Float64),
if size(B,2) != n
throw(DimensionMismatch(lazy"B has second dimension $(size(B,2)) but needs to match second dimension of C, $n"))
end
if j != size(B,1)
dkarrasch marked this conversation as resolved.
Show resolved Hide resolved
throw(DimensionMismatch(lazy"A has second dimension $j but needs to match first dimension of B, $(size(B,1))"))
end
chkstride1(A)
chkstride1(B)
chkstride1(C)
Expand Down Expand Up @@ -1619,6 +1622,9 @@ for (mfname, elty) in ((:zhemm_,:ComplexF64),
if size(B,2) != n
throw(DimensionMismatch(lazy"B has second dimension $(size(B,2)) but needs to match second dimension of C, $n"))
end
if j != size(B,1)
throw(DimensionMismatch(lazy"A has second dimension $j but needs to match first dimension of B, $(size(B,1))"))
end
chkstride1(A)
chkstride1(B)
chkstride1(C)
Expand Down
2 changes: 2 additions & 0 deletions stdlib/LinearAlgebra/test/blas.jl
Original file line number Diff line number Diff line change
Expand Up @@ -222,11 +222,13 @@ Random.seed!(100)
@test_throws DimensionMismatch BLAS.symm('R','U',Cmn,Cnn)
@test_throws DimensionMismatch BLAS.symm!('L','U',one(elty),Asymm,Cnn,one(elty),Cmn)
@test_throws DimensionMismatch BLAS.symm!('L','U',one(elty),Asymm,Cnn,one(elty),Cnm)
@test_throws DimensionMismatch BLAS.symm!('L','U',one(elty),Asymm,Cmn,one(elty),Cnn)
if elty <: BlasComplex
@test_throws DimensionMismatch BLAS.hemm('L','U',Cnm,Cnn)
@test_throws DimensionMismatch BLAS.hemm('R','U',Cmn,Cnn)
@test_throws DimensionMismatch BLAS.hemm!('L','U',one(elty),Aherm,Cnn,one(elty),Cmn)
@test_throws DimensionMismatch BLAS.hemm!('L','U',one(elty),Aherm,Cnn,one(elty),Cnm)
@test_throws DimensionMismatch BLAS.hemm!('L','U',one(elty),Aherm,Cmn,one(elty),Cnn)
end
end
end
Expand Down