Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 6 additions & 3 deletions src/kron.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,18 @@ function kron(A :: AbstractLinearOperator, B :: AbstractLinearOperator)
p, q = size(B)
T = promote_type(eltype(A), eltype(B))
function prod(x)
X = reshape(convert(Vector{T}, x), q, n)
S = promote_type(T, eltype(x))
X = reshape(convert(Vector{S}, x), q, n)
return Matrix(B * X * transpose(A))[:]
end
function tprod(x)
X = reshape(convert(Vector{T}, x), p, m)
S = promote_type(T, eltype(x))
X = reshape(convert(Vector{S}, x), p, m)
return Matrix(transpose(B) * X * A)[:]
end
function ctprod(x)
X = reshape(convert(Vector{T}, x), p, m)
S = promote_type(T, eltype(x))
X = reshape(convert(Vector{S}, x), p, m)
return Matrix(B' * X * conj(A))[:]
end
symm = issymmetric(A) && issymmetric(B)
Expand Down
9 changes: 9 additions & 0 deletions test/test_kron.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,15 @@ function test_kron()
end
end
end

@testset ExtendedTestSet "issue110" begin
A = rand(2, 2)
op = LinearOperator(A)
K = kron(A, op)
x = rand(Complex{Float64}, 4)
y = K * x
@test eltype(y) == Complex{Float64}
end
end

test_kron()