@@ -193,7 +193,7 @@ class DMDc(DMDBase):
193193 :type svd_rank_omega: int or float
194194 """
195195
196- def __init__ (self , svd_rank = 0 , tlsq_rank = 0 , opt = False , svd_rank_omega = - 1 ):
196+ def __init__ (self , svd_rank = 0 , tlsq_rank = 0 , opt = False , svd_rank_omega = - 1 , lag = 1 ):
197197 # we're going to initialize Atilde when we know if B is known
198198 self ._Atilde = None
199199 # remember the arguments for when we'll need them
@@ -203,6 +203,7 @@ def __init__(self, svd_rank=0, tlsq_rank=0, opt=False, svd_rank_omega=-1):
203203 "tlsq_rank" : tlsq_rank ,
204204 }
205205
206+ self ._lag = lag
206207 self ._opt = opt
207208 self ._exact = False
208209
@@ -302,9 +303,9 @@ def fit(self, X, I, B=None):
302303 self ._snapshots_holder = Snapshots (X )
303304 self ._controlin = np .atleast_2d (np .asarray (I ))
304305
305- n_samples = self .snapshots . shape [ 1 ]
306- X = self .snapshots [:, : - 1 ]
307- Y = self . snapshots [:, 1 :]
306+ X = self .snapshots [:, : - self . _lag ]
307+ Y = self .snapshots [:, self . _lag : ]
308+ n_samples = X . shape [ 1 ] + 1
308309
309310 self ._set_initial_time_dictionary (
310311 {"t0" : 0 , "tend" : n_samples - 1 , "dt" : 1 }
0 commit comments