# [SciPy-Dev] Sylvester equation solver for complex matrices

Warren Weckesser warren.weckesser@enthought....
Wed Feb 15 16:15:46 CST 2012

```On Wed, Feb 15, 2012 at 3:44 PM, Nils Wagner
<nwagner@iam.uni-stuttgart.de>wrote:

> On Wed, 15 Feb 2012 12:42:04 -0600
>   Warren Weckesser <warren.weckesser@enthought.com> wrote:
> > On Sat, Feb 11, 2012 at 11:24 AM, Warren Weckesser <
> > warren.weckesser@enthought.com> wrote:
> >
> >>
> >>
> >> On Sat, Feb 11, 2012 at 4:45 AM, Nils Wagner
> >><nwagner@iam.uni-stuttgart.de
> >> > wrote:
> >>
> >>> Hi all,
> >>>
> >>> I run a short test on the recent solver for Sylvester
> >>> equations.
> >>> In case of complex input matrices the method returns
> >>>  ** On entry to ZTRSYL parameter number  2 had an
> >>>illegal
> >>> value
> >>>
> >>> Nils
> >>>
> >>>
> >>
> >> Thanks, Nils.  The new solve_sylvester function didn't
> >>handle complex
> >> matrices correctly. I have submitted a pull request (
> >> https://github.com/scipy/scipy/pull/155) that should fix
> >>this.
> >>
> >> Warren
> >>
> >>
> >
> > Nils, the fix has been committed to the master branch.
> >  Let us know if you
> > find any other problems.
> >
> > Warren
> >
> >
> >
> >>
> >>> import numpy as np
> >>> from scipy import linalg as la
> >>> np.random.seed(10)
> >>> a = np.random.rand(20,20)+1j*np.random.rand(20,20)
> >>> b = np.random.rand(20,20)+1j*np.random.rand(20,20)
> >>> q = np.random.rand(20,20)+1j*np.random.rand(20,20)
> >>>
> >>> x = la.solve_sylvester(a,b,q)
> >>> res = la.norm(np.dot(a,x)+np.dot(x,b)-q)
> >>> _______________________________________________
> >>> SciPy-Dev mailing list
> >>> SciPy-Dev@scipy.org
> >>> http://mail.scipy.org/mailman/listinfo/scipy-dev
> >>>
> >>
> >>
> Hi Warren,
>
>
> Great. It works fine for me.
> BTW, is the Sylvester equation solver part of the next
> scipy release ?
>

Yes, it will be in the next release.

> How about Lyapunov and Riccati equation solvers ?
>

Jeff Armstrong, who wrote solve_sylvester(), is also the author of pydare (
http://code.google.com/p/pydare/).   My understanding is that he has
reimplemented much of this so that it does not rely on GPL code (there was
a thread about it last year, involving Jeff, Ralf, Josef and maybe some
others), so he probably has more tools that could end up in scipy.

Jeff, what's the status of that work?  Are you planning on more
contributions?  I think it would be great to have the Lyapunov and Riccati
solvers in scipy.

Warren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20120215/821b9f50/attachment.html
```