Skip to content

Commit 19dc9bd

Browse files
committed
Expand checklattice functionality
1 parent 0fefe8b commit 19dc9bd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/operators/localoperator.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ while the second version throws an error if the lattices do not match.
7474
function checklattice(args...)
7575
return checklattice(Bool, args...) || throw(ArgumentError("Lattice mismatch."))
7676
end
77+
checklattice(::Type{Bool}, arg) = true
78+
function checklattice(::Type{Bool}, arg1, arg2, args...)
79+
return checklattice(Bool, arg1, arg2) && checklattice(Bool, arg2, args...)
80+
end
7781
function checklattice(::Type{Bool}, H1::LocalOperator, H2::LocalOperator)
7882
return H1.lattice == H2.lattice
7983
end
@@ -83,6 +87,12 @@ end
8387
function checklattice(::Type{Bool}, H::LocalOperator, peps::InfinitePEPS)
8488
return checklattice(Bool, peps, H)
8589
end
90+
function checklattice(::Type{Bool}, pepo::InfinitePEPO, O::LocalOperator)
91+
return size(pepo, 3) == 1 && reshape(physicalspace(pepo), size(pepo, 1), size(pepo, 2)) == physicalspace(O)
92+
end
93+
function checklattice(::Type{Bool}, O::LocalOperator, pepo::InfinitePEPO)
94+
return checklattice(Bool, pepo, O)
95+
end
8696
@non_differentiable checklattice(args...)
8797

8898
function Base.repeat(O::LocalOperator, m::Int, n::Int)

0 commit comments

Comments
 (0)