Skip to content

Bugfix in matrix multiplication in output computation in iosys.LinearIOSystem#375

Merged
repagh merged 1 commit intopython-control:masterfrom
francescoseccamonte:master
Mar 2, 2020
Merged

Bugfix in matrix multiplication in output computation in iosys.LinearIOSystem#375
repagh merged 1 commit intopython-control:masterfrom
francescoseccamonte:master

Conversation

@francescoseccamonte
Copy link
Copy Markdown
Contributor

Hi,
I believe the _out method in iosys.LinearIOSystem does not perform the matrix multiplication correctly when not using the numpy matrix class, since it uses * instead of dot().
The following snippet reproduces the incorrect behavior:

import numpy as np
import control as ct
if __name__ == '__main__':	
	ct.use_numpy_matrix(flag=False);
	A = np.array([[0.5, 0.7], [0, -0.8]]);
	B = np.array([[0], [1]]);
	C = np.array([[1, 0]]);
	D = np.array([[0]]);
	iosys = ct.iosys.LinearIOSystem(ct.StateSpace(A, B, C, D));
	x0 = np.array([1.1,-0.9]);
	u0 = np.array([0.5]);
	ct.iosys.linearize(iosys, x0, u0);

The change implemented is consistent with what performed by the _rhs method a few lines above, and works with both matrix and ndarray.

Thanks
Francesco

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+2.4%) to 84.599% when pulling a995655 on francescoseccamonte:master into 66bee9d on python-control:master.

1 similar comment
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage increased (+2.4%) to 84.599% when pulling a995655 on francescoseccamonte:master into 66bee9d on python-control:master.

@repagh repagh merged commit dab8ff6 into python-control:master Mar 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants