Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit71fef4b

Browse files
committed
Check eigenvalues' real part using NumPy
Faster than converting to a pure Python list.
1 parent9a33509 commit71fef4b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

‎control/modelsimp.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def modred(sys, ELIM, method='matchdc'):
149149

150150

151151
#Check system is stable
152-
ifany(e.real>=0.0foreinnp.linalg.eigvals(sys.A)):
152+
ifnp.any(np.linalg.eigvals(sys.A).real>=0.0):
153153
raiseValueError("Oops, the system is unstable!")
154154

155155
ELIM=np.sort(ELIM)
@@ -251,7 +251,7 @@ def balred(sys, orders, method='truncate'):
251251
dico='C'
252252

253253
#Check system is stable
254-
ifany(e.real>=0.0foreinnp.linalg.eigvals(sys.A)):
254+
ifnp.any(np.linalg.eigvals(sys.A).real>=0.0):
255255
raiseValueError("Oops, the system is unstable!")
256256

257257
ifmethod=='matchdc':

‎control/statefbk.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ def gram(sys,type):
355355

356356
#TODO: Check system is stable, perhaps a utility in ctrlutil.py
357357
# or a method of the StateSpace class?
358-
ifany(e.real>=0.0foreinnp.linalg.eigvals(sys.A)):
358+
ifnp.any(np.linalg.eigvals(sys.A).real>=0.0):
359359
raiseValueError("Oops, the system is unstable!")
360360

361361
iftype=='c':

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp