Skip to content

Commit 8b96da6

Browse files
committed
Remove extra copying
1 parent 0a1c4a3 commit 8b96da6

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

pyadjoint/adjfloat.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,6 @@ def codegen(self, diff=()):
7575

7676
class AdjFloatExprBlock(Block):
7777
def __init__(self, sp_operator, *args):
78-
if len(set(arg.block_variable for arg in args)) != len(args):
79-
raise ValueError("Duplicate argument")
8078
super().__init__()
8179
self._sp_operator = sp_operator
8280
for arg in args:
@@ -126,11 +124,7 @@ def annotated_operator(*args):
126124
args = list(args)
127125
adjfloat_bv = set()
128126
for i, arg in enumerate(args):
129-
if isinstance(arg, AdjFloat):
130-
if arg.block_variable in adjfloat_bv:
131-
args[i] = +arg # copy
132-
adjfloat_bv.add(arg.block_variable)
133-
elif isinstance(arg, OverloadedType):
127+
if isinstance(arg, OverloadedType):
134128
pass
135129
elif isinstance(arg, numbers.Complex):
136130
args[i] = AdjFloat(arg) # Error here if not real

0 commit comments

Comments
 (0)