Skip to content

Commit e99019f

Browse files
committed
Call indices to normalize Linds, Rinds inputs
1 parent a42ace5 commit e99019f

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/lib/ITensorsExtensions/src/itensor.jl

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ using ITensors:
77
dag,
88
dir,
99
hasqns,
10+
indices,
1011
inds,
1112
isdiag,
1213
itensor,
@@ -69,6 +70,8 @@ function make_bosonic(A::ITensor, Linds, Rinds)
6970
# ordering with Out indices coming before In indices
7071
# Resulting tensor acts like a normal matrix (no extra signs
7172
# when taking powers A^n)
73+
Linds = indices(Linds)
74+
Rinds = indices(Rinds)
7275
if all(j->dir(j)==ITensors.Out, Linds) && all(j->dir(j)==ITensors.In, Rinds)
7376
ordered_inds = [Linds..., reverse(Rinds)...]
7477
elseif all(j->dir(j)==ITensors.Out, Rinds) && all(j->dir(j)==ITensors.In, Linds)
@@ -86,8 +89,6 @@ function make_bosonic(A::ITensor, Linds, Rinds)
8689
end
8790

8891
function map_eigvals(f::Function, A::ITensor, Linds, Rinds; kws...)
89-
check_input(map_eigvals, f, A, Linds, Rinds)
90-
9192
# <fermions>
9293
fermionic_itensor =
9394
ITensors.using_auto_fermion() && ITensors.has_fermionic_subspaces(inds(A))
@@ -114,11 +115,6 @@ function map_eigvals(f::Function, A::ITensor, Linds, Rinds; kws...)
114115
return mapped_A
115116
end
116117

117-
function check_input(::typeof(map_eigvals), f, A, Linds, Rinds)
118-
all(x -> x isa Index, Linds) || error("Left indices must be a collection of Index")
119-
all(x -> x isa Index, Rinds) || error("Right indices must be a collection of Index")
120-
end
121-
122118
# Analagous to `denseblocks`.
123119
# Extract the diagonal entries into a diagonal tensor.
124120
function diagblocks(D::Tensor)

0 commit comments

Comments
 (0)