Fix: a and c matrices must have at least one column in td04ad_r#5
Conversation
This allows conversion of static gain (i.e., constant) transfer functions. SLICOT and Fortran can possibly handle the 0 case, but f2py seems to not like dimensions of length 0. td04ad_c needs a similar fix, but I couldn't get it to work; I suspect this is due to a bug in SLICOT.
|
I confirmed that your proposed change provides for the correct output. Before merging, I want to understand where the wrapper generated by |
|
FWIW, this PROGRAM EMPTY
REAL X(0)
END doesn't compile on my system (Ubuntu 14.04, compiler "fort77 Version 1.15" (from gcc)); error Further, this fairly authentic looking Fortran 77 Standard says so it could just be invalid to have an empty array in Fortran 77. |
|
The error that is addressed by this PR is thrown from the function is from line 684 in numpy/f2py/src/fortranobject.c. The conditional block is entered because |
|
Regarding the case of no inputs ( /* Processing variable d */
d_Dims[0]=max(1,p),d_Dims[1]=m;
capi_d_intent |= F2PY_INTENT_HIDE|F2PY_INTENT_OUT;
capi_d_tmp = array_from_pyobj(NPY_DOUBLE,d_Dims,d_Rank,capi_d_intent,Py_None);Regarding the case of no outputs ( |
Related to python-control/python-control#129 (comment)
Previously the a and c matrices submitted to SLICOT's
TD04ADvia Slycot'std04ad_rcould have zero columns if the submitted transfer functions were constant. This is reasonable, but f2py (or possibly other numpy component) objected. The fix is to ensure a minimum of 1 column; this doesn't affect the result, sinceTD04ADreturns the number of required states, and only the required parts of the a, b, and c matrices are returned.Unfortunately a similar fix does not work for
td04ad_c; I believe this is due to a bug in SLICOT. I'll file a separate issue for that.This does not address the case when there are either no inputs (
m=0) or outputs (p=0); I suspect a similar failure would occur in that case.