python - 安装 slycot 后 Control.tf2ss() 出现故障
问题描述
control.tf2ss() 模块在 SISO 系统上完美运行,但是一旦我安装了 slycot(这是 MIMO 系统所必需的),该函数就会返回错误(对于 SISO 和 MIMO 系统)。
一旦安装了 slycot 模块,下面的代码
A = numpy.array([[1., -2], [3, -4]])
B = numpy.array([[5.], [7]])
C = numpy.array([[6., 8]])
D = numpy.array([[9.]])
sys1 = control.ss(A, B, C, D)
control.ss2tf(sys1)
返回
ValueError Traceback (most recent call last)
<ipython-input-20-5160baa6cd95> in <module>
4 D = numpy.array([[9.]])
5 sys1 = control.ss(A, B, C, D)
----> 6 control.ss2tf(sys1)
C:\ProgramData\Anaconda3\lib\site-packages\control\xferfcn.py in ss2tf(*args)
1315 sys = args[0]
1316 if isinstance(sys, StateSpace):
-> 1317 return _convertToTransferFunction(sys)
1318 else:
1319 raise TypeError("ss2tf(sys): sys must be a StateSpace object. It \
C:\ProgramData\Anaconda3\lib\site-packages\control\xferfcn.py in _convertToTransferFunction(sys, **kw)
1097 # Make sure to convert system matrices to numpy arrays
1098 tfout = tb04ad(sys.states, sys.inputs, sys.outputs, array(sys.A),
-> 1099 array(sys.B), array(sys.C), array(sys.D), tol1=0.0)
1100
1101 # Preallocate outputs.
C:\ProgramData\Anaconda3\lib\site-packages\slycot\transform.py in tb04ad(n, m, p, A, B, C, D, tol1, tol2, ldwork)
328 e = ValueError(error_text)
329 e.info = out[-1]
--> 330 raise e
331
332 A,B,C,Nr,index,dcoeff,ucoeff = out[:-1]
ValueError: The following argument had an illegal value: A
我在 slycot 模块上运行诊断并获得以下结果
>>> import slycot
>>> slycot.test("full")
Running unit tests for slycot
NumPy version 1.15.4
NumPy relaxed strides checking option: True
NumPy is installed in C:\ProgramData\Anaconda3\lib\site-packages\numpy
Python version 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)]
nose version 1.3.7
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_dsytrs
Wrong parameter 1 in LAPACKE_cheevx_work
Wrong parameter 1 in LAPACKE_checon
Wrong parameter 1 in LAPACKE_cheevx_work
Wrong parameter 1 in LAPACKE_cggesx_work
Wrong parameter 1 in LAPACKE_checon
.C:\ProgramData\Anaconda3\lib\site-packages\slycot\tests\test.py:16: PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.
a = matrix("-2 0.5;-1.6 -5")
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_chetrs_rook
Wrong parameter 1 in LAPACKE_dgeesx
Wrong parameter 1 in LAPACKE_dgeesx
Wrong parameter 1 in LAPACKE_dgeesx
Wrong parameter 1 in LAPACKE_dgeesx
Wrong parameter 1 in LAPACKE_dsytrs
Wrong parameter 1 in LAPACKE_dsytrs
Wrong parameter 1 in LAPACKE_dpoequ
我显然对 LAPACKE 有问题,但我似乎找不到。
预先感谢您的帮助!
解决方案
推荐阅读
- android - 错误:启用视图绑定android时,包android.view不存在
- c# - 多个随机输入数之间的减法
- python - 在 scipy 中从 solve_ivp 捕获 UserWarnings(求解 ODE)
- c# - 出现“无法隐式转换类型”错误但无法弄清楚原因
- jasper-reports - 带有其他子报表的子报表总是更改页面而不是使用剩余空间
- c# - Microsoft.EntityFrameworkCore.Diagnostics.RelationalStrings.get_InvalidMaxBatchSize()
- verilog - 例如 uut/A1/,正式端口 S 的宽度 1 不等于实际信号 in1 的宽度 4
- python - 为什么我的 python 代码出现值错误
- machine-learning - 如何在 CatBoostRegressor 中传递分类特征?
- java - 如何将一串http请求参数转换为列表