ilayn / harold

An open-source systems and controls toolbox for Python3
MIT License
173 stars 19 forks source link

SISO Behavior when multiplied with a matrix #7

Closed ilayn closed 7 years ago

ilayn commented 9 years ago

When a SISO Transfer() or State() multiplied with a p x m matrix, should it reject due to size mismatch or elementwise multiply with each element of the matrix P as if an overloaded Kronecker Product kron(P,G) ?

ilayn commented 8 years ago

Currently rejected if systems are multiplied from the right. But for the left multiplication numpy tries element by element method and each entry of an array is allowed for SISO systems. The result becomes a numpy array with object dtype. Currently I don't know how to prevent this.

ilayn commented 8 years ago

Since the api for matrix multiplication requires @ or dot(), and star is elementwise mult, right multiplication is also allowed now.

ilayn commented 7 years ago

I've asked about this on SO but so far didn't receive any solution.

ilayn commented 7 years ago

Thanks to the fine people of NumPy mailing list, I'll set __array_ufunc__ attribute on the representation classes to override ndarray.__mul__().

Finally...

ilayn commented 7 years ago

this will require NumPy 1.13+ though I don't expect any objections anyways