Skip to content

Commit 6cf9129

Browse files
authored
Merge pull request PyDMD#540 from Bucanero06/master
Edit bopdmd.py's _initialize_alpha method for better memory by removing full matrix construction
2 parents 09e8134 + 8adb998 commit 6cf9129

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

pydmd/bopdmd.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1365,15 +1365,11 @@ def _initialize_alpha(self):
13651365
ux1 = ux[:, :-1]
13661366
ux2 = ux[:, 1:]
13671367

1368-
# Define the diagonal matrix T as the following.
1369-
t1 = self._time[:-1]
1370-
t2 = self._time[1:]
1371-
T = np.diag(t2 - t1)
1372-
13731368
# Define the matrices Y and Z as the following and compute the
13741369
# rank-truncated SVD of Y.
13751370
Y = (ux1 + ux2) / 2
1376-
Z = (ux2 - ux1).dot(np.linalg.inv(T))
1371+
# Element-wise division by time differences. w/o large T
1372+
Z = (ux2 - ux1) / (self._time[1:] - self._time[:-1])
13771373
U, s, V = compute_svd(Y, self._svd_rank)
13781374
S = np.diag(s)
13791375

0 commit comments

Comments
 (0)