Skip to content

Commit 01070c8

Browse files
committed
Speedup VariableOrdering.append from O(N^2) to O(N)
1 parent e075691 commit 01070c8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

theseus/optimizer/variable_ordering.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def __iter__(self):
3636
return iter(self._var_order)
3737

3838
def append(self, var: Variable):
39-
if var in self._var_order:
39+
if var.name in self._var_name_to_index:
4040
raise ValueError(
4141
f"Variable {var.name} has already been added to the order."
4242
)

0 commit comments

Comments
 (0)