Skip to content

Commit

Permalink
Add an error message if trying to directsum two tensors with `EmptyNu…
Browse files Browse the repository at this point in the history
…mber`
  • Loading branch information
kmp5VT committed May 15, 2024
1 parent fa43d64 commit d58d354
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/tensor_operations/tensor_algebra.jl
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,12 @@ function directsum_projectors(
return D1, D2
end

function directsum_projectors(::Type{<:EmptyNumber}, ::Type{<:EmptyNumber}, ::Index, ::Index, ::Index)
error("It is not possible to call directsum on two tensors with element type EmptyNumber.
If you are inputting ITensors constructor like ITensor(i, j), try specifying the element type,
e.g. ITensor(Float64, i, j), or filling them with zero value, e.g. ITensor(0.0, i, j).")
end

function check_directsum_inds(A::ITensor, I, B::ITensor, J)
a = uniqueinds(A, I)
b = uniqueinds(B, J)
Expand Down

0 comments on commit d58d354

Please sign in to comment.