Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Allow static gain StateSpace objects to be straightforwardly created. #107
Conversation
…ects. Allows StateSpace([],[],[],D), which failed previously. Static gains have sizes enforced as follows: A 0-by-0, B 0-by-ninputs, C noutputs-by-0. Tests added for instantiation, and sum, product, feedback, and appending, of 1x1, 2x3, and 3x2 static gains StateSpace objects.
On Python 2.7, the special case "all states useless" in _remove_useless_states resulted in A=[[0]] (and similarly for B and C). The special case is no longer needed, since empty A, B, C matrices can be handled. numpy.delete does the right thing w.r.t. matrix sizes (e.g., deleting all columns of a nxm matrix gives an nx0 matrix). Added test for this.
| raise ValueError("D must have the same column size as B.") | ||
| if self.outputs != D.shape[0]: | ||
| raise ValueError("D must have the same row size as C.") | ||
| raise ValueError("A and C C must have the same number of columns.") |
mp4096
Aug 12, 2016
Contributor
I think it's one C too many here. 😸
I think it's one C too many here.
|
D'oh! Thanks, will fix. |
|
I like this syntax for creating static gain objects. This PR looks good to me. |
|
One case not covered by this PR is the "empty" system, Wanting 0-input, 0-output systems may seem like fussiness, but it turns out to be necessary (or useful, at least), in a prototype of [1] http://octave.sourceforge.net/control/function/augw.html |
Conflicts: control/tests/statesp_test.py
|
Pull request #110 subsumes this one. |
Lets the (fairly?) obvious StateSpace([],[],[],D) work. One could previously create these by, e.g., converting a static gain TransferFunction to a StateSpace object.
In this case A will be 0-by-0, B 0-by-inputs, and C outputs-by-0. My intuition is that this is a generally correct approach (consider the simplification of _remove_useless_states, for example), but it may require some thought during review.