Skip to content

Commit 119ad47

Browse files
author
Benjamin Greiner
committed
check for int first
1 parent fcbde26 commit 119ad47

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

control/mateqn.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
Author: Bjorn Olofsson
4242
"""
4343

44-
from numpy import shape, size, asarray, copy, zeros, eye, dot, finfo
44+
from numpy import shape, size, asarray, copy, zeros, eye, dot, \
45+
finfo, inexact, atleast_2d
4546
from scipy.linalg import eigvals, solve_discrete_are, solve
4647
from .exception import ControlSlycot, ControlArgument
4748
from .statesp import _ssmatrix
@@ -963,5 +964,9 @@ def dare_old(A, B, Q, R, S=None, E=None, stabilizing=True):
963964

964965

965966
def _is_symmetric(M):
966-
eps = finfo(M.dtype).eps
967-
return ((M - M.T) < eps).all()
967+
M = atleast_2d(M)
968+
if isinstance(M[0, 0], inexact):
969+
eps = finfo(M.dtype).eps
970+
return ((M - M.T) < eps).all()
971+
else:
972+
return (M == M.T).all()

0 commit comments

Comments
 (0)