Skip to content

Commit f086099

Browse files
auscompgeekLucienMorey
authored andcommitted
Use in-place array subtraction
1 parent 7d5813e commit f086099

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

components/intake.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,11 @@ def correct_and_predict(self) -> None:
175175

176176
self.loop.predict(0.020)
177177

178-
self.innovation = corrected - predicted
178+
# Use in-place subtraction to avoid creating a new array.
179+
# `corrected` is no longer used after this point.
180+
innovation = corrected
181+
innovation -= predicted
182+
self.innovation = innovation
179183

180184
# constrain ourselves if we are going to do damage
181185
if (

0 commit comments

Comments
 (0)