1

The control.tf2ss() module works perfectly on SISO systems, but once I install slycot (which is necessary for MIMO systems) the function returns an error (for SISO and MIMO systems).

Once the slycot module is installed the following code

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)

returns

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

I ran diagnostics on the slycot module and obtained the following results

>>> 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

I clearly have a problem with LAPACKE, but I cannot seem to find it.

Thank you in advance for your help!

Wian
  • 21
  • 1
  • 4
  • 1
    The slycot binary you are using was compiled against an older version of the blas library. Reinstall from https://www.lfd.uci.edu/~gohlke/pythonlibs/#slycot. Also better don't mix wheels and conda packages. – cgohlke Feb 13 '19 at 15:25
  • 1
    Thank you @cgohlke! I followed the above advise, but to no avail. In the end I hopped over to Debian, and installed openblas followed by the control and slycot packages from conda-forge. Now all is functioning correctly. – Wian Feb 22 '19 at 10:00

0 Answers0