You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
isequal_blocksizes(A, B) ||throw(DimensionMismatch("A and B have different block sizes"))
isequal_blocksizes(C, A) ||throw(DimensionMismatch("C has incompatible block sizes"))
is much too strict. See for example this code:
using LinearAlgebra, BlockDiagonals
A =rand(3, 2)
B =rand(2, 1)
C =rand(3, 1)
mul!(C, A, B) # works
A =BlockDiagonal([A, A])
B =BlockDiagonal([B, B])
C =BlockDiagonal([C, C])
mul!(C, A, B) # errors# what it should be:for i ineachindex(C.blocks)
mul!(C.blocks[i], A.blocks[i], B.blocks[i])
end
C == A*B
To fix this, we should change the isequal_blocksizes check with an actual proper check that the sizes work together.
Alternatively a more lazy version would just check that length(C.blocks) == length(A.blocks) == length(B.blocks), and then just call mul! which performs a size check anyways.
The text was updated successfully, but these errors were encountered:
The
isequal_blocksizes
check hereBlockDiagonals.jl/src/linalg.jl
Lines 141 to 142 in 9b07a07
is much too strict. See for example this code:
To fix this, we should change the
isequal_blocksizes
check with an actual proper check that the sizes work together.Alternatively a more lazy version would just check that
length(C.blocks) == length(A.blocks) == length(B.blocks)
, and then just callmul!
which performs a size check anyways.The text was updated successfully, but these errors were encountered: