Skip to content

Commit c811366

Browse files
committed
add check for initial guess of alpha
1 parent 17d806a commit c811366

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pydmd/bopdmd.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1524,8 +1524,17 @@ def fit_econ(self, s, V, t):
15241524
"""
15251525
raise ValueError(msg)
15261526

1527+
# Set/check the initial guess for the continuous-time DMD eigenvalues.
15271528
if self._init_alpha is None:
15281529
self._init_alpha = self._initialize_alpha(s=s, V=V)
1530+
elif (
1531+
not isinstance(self._init_alpha, np.ndarray)
1532+
or self._init_alpha.ndim > 1
1533+
or len(self._init_alpha) != self._svd_rank
1534+
):
1535+
msg = "init_alpha must be a 1D np.ndarray with {} entries."
1536+
raise ValueError(msg.format(self._svd_rank))
1537+
15291538

15301539
def forecast(self, t):
15311540
"""

0 commit comments

Comments
 (0)