Skip to content

Commit

Permalink
Bug fix: Fix Koopman.predict for 1D inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
briandesilva committed Dec 26, 2020
1 parent a01f763 commit 91add66
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pykoopman/koopman.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def simulate(self, x0, u=None, n_steps=1):
y = empty((n_steps, self.n_input_features_), dtype=self.koopman_matrix.dtype)
if u is None:
y[0] = self.predict(x0)
elif u is not None:
else:
y[0] = self.predict(x0, u[0])

if isinstance(self.observables, TimeDelay):
Expand All @@ -207,10 +207,12 @@ def simulate(self, x0, u=None, n_steps=1):
else:
if u is None:
for k in range(n_steps - 1):
y[k + 1] = self.predict(y[k])
y[k + 1] = self.predict(y[k].reshape(1, -1))
else:
for k in range(n_steps - 1):
y[k + 1] = self.predict(y[k], u[k + 1])
y[k + 1] = self.predict(
y[k].reshape(1, -1), u[k + 1].reshape(1, -1)
)

return y

Expand Down

0 comments on commit 91add66

Please # to comment.