I think this commit broke LinearOperators here. Essentially, making [A B; C]
calls something different on 0.7, and doesn’t work with the default hcat
and vcat
.
A workaround would be to define hvcat
for LinearOperators
, but I’m wondering if this problem may affect other people, and if there is a better workaround.
MWE:
mutable struct DummyMatrix
rows :: Int
cols :: Int
end
import Base.size
function size(A :: DummyMatrix)
return (A.rows, A.cols)
end
import Base.hcat
function hcat(As :: DummyMatrix...)
A = As[1]
for i = 2:length(As)
A = hcat(A, As[i])
end
return A
end
function hcat(A :: DummyMatrix, B :: DummyMatrix)
@assert A.rows == B.rows
DummyMatrix(A.rows, A.cols + B.cols)
end
import Base.vcat
function vcat(As :: DummyMatrix...)
A = As[1]
for i = 2:length(As)
A = vcat(A, As[i])
end
return A
end
function vcat(A :: DummyMatrix, B :: DummyMatrix)
@assert A.cols == B.cols
DummyMatrix(A.rows + B.rows, A.cols)
end
function foo()
A = DummyMatrix(2,2)
B = DummyMatrix(2,2)
C = DummyMatrix(2,4)
println([A B; C])
end
foo()