Skip to content

Commit 37b5d4d

Browse files
committed
Add space after commas
1 parent 220ace3 commit 37b5d4d

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

control/modelsimp.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -377,14 +377,14 @@ def minimal_realization(sys, tol=None, verbose=True):
377377
def _block_hankel(Y, m, n):
378378
"""Create a block Hankel matrix from impulse response."""
379379
q, p, _ = Y.shape
380-
YY = Y.transpose(0,2,1) # transpose for reshape
380+
YY = Y.transpose(0, 2, 1) # transpose for reshape
381381

382-
H = np.zeros((q*m,p*n))
382+
H = np.zeros((q*m, p*n))
383383

384384
for r in range(m):
385385
# shift and add row to Hankel matrix
386-
new_row = YY[:,r:r+n,:]
387-
H[q*r:q*(r+1),:] = new_row.reshape((q,p*n))
386+
new_row = YY[:, r:r+n, :]
387+
H[q*r:q*(r+1), :] = new_row.reshape((q, p*n))
388388

389389
return H
390390

@@ -480,22 +480,22 @@ def eigensys_realization(arg, r, m=None, n=None, dt=True, transpose=False):
480480
if (l-1) < m+n:
481481
raise ValueError("not enough data for requested number of parameters")
482482

483-
H = _block_hankel(YY[:,:,1:], m, n+1) # Hankel matrix (q*m, p*(n+1))
484-
Hf = H[:,:-p] # first p*n columns of H
485-
Hl = H[:,p:] # last p*n columns of H
483+
H = _block_hankel(YY[:, :, 1:], m, n+1) # Hankel matrix (q*m, p*(n+1))
484+
Hf = H[:, :-p] # first p*n columns of H
485+
Hl = H[:, p:] # last p*n columns of H
486486

487487
U,S,Vh = np.linalg.svd(Hf, True)
488-
Ur =U[:,0:r]
489-
Vhr =Vh[0:r,:]
488+
Ur =U[:, 0:r]
489+
Vhr =Vh[0:r, :]
490490

491491
# balanced realizations
492492
Sigma_inv = np.diag(1./np.sqrt(S[0:r]))
493493
Ar = Sigma_inv @ Ur.T @ Hl @ Vhr.T @ Sigma_inv
494-
Br = Sigma_inv @ Ur.T @ Hf[:,0:p]*dt # dt scaling for unit-area impulse
495-
Cr = Hf[0:q,:] @ Vhr.T @ Sigma_inv
496-
Dr = YY[:,:,0]
494+
Br = Sigma_inv @ Ur.T @ Hf[:, 0:p]*dt # dt scaling for unit-area impulse
495+
Cr = Hf[0:q, :] @ Vhr.T @ Sigma_inv
496+
Dr = YY[:, :, 0]
497497

498-
return StateSpace(Ar,Br,Cr,Dr,dt), S
498+
return StateSpace(Ar, Br, Cr, Dr, dt), S
499499

500500

501501
def markov(*args, m=None, transpose=False, dt=None, truncate=False):

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy