Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Lyapunov / Sylvester solver #5814

Closed
dlfivefifty opened this issue Feb 14, 2014 · 28 comments
Closed

Add Lyapunov / Sylvester solver #5814

dlfivefifty opened this issue Feb 14, 2014 · 28 comments
Labels
help wanted Indicates that a maintainer wants help on an issue or pull request linear algebra Linear algebra
Milestone

Comments

@dlfivefifty
Copy link
Contributor

There is no Lyapunov / Sylvester solver built-in to Julia, for solving

AXB + CXD = F

This could be fixed by wrapping the LAPack xTRSYL routine.

@lindahua
Copy link
Contributor

+1

@stevengj
Copy link
Member

Seems worthwhile and low-cost. What would the interface look like?

@jiahao
Copy link
Member

jiahao commented Feb 14, 2014

I'm in favor of just putting in the LAPACK wrapper for now and deferring a higher-level interface to a symbolic rewrite rule in the same vein as #4950. Or we could just do the simple thing and define a new solvesylvester function.

@dlfivefifty
Copy link
Contributor Author

You could call the function lyap to match matlab

Sent from my iPad

On 15 Feb 2014, at 3:47 am, Jiahao Chen [email protected] wrote:

I'm in favor of just putting in the LAPACK wrapper for now and deferring a higher-level interface to a symbolic rewrite rule in the same vein as #4950. Or we could just do the simple thing and define a new solvesylvester function.


Reply to this email directly or view it on GitHub.

@lsorber
Copy link

lsorber commented Feb 15, 2014

@dlfivefifty lyap also solves Sylvester equations. Imho, maybe lyap tries to do too much and its functionality should be split into smaller pieces in Julia.

@atisharma
Copy link

Would a wrapper to SLICOT be a suitable response?

@mschauer
Copy link
Contributor

As I understood, SLICOT is not really free, http://slicot.org/obtaining-slicot

@atisharma
Copy link

SLICOT 4.5 is GPL v3.0. SLICOT 5.0 does indeed look non-free from their website. But strangely it is available in the Debian main repo, and Debian are pretty strict about licencing.

Writing good Lyapunov / Riccati solvers is not that easy and if the SLICOT licence is acceptable it would be preferable to a reimplementation. Perhaps using SLICOT 4.5?

https://github.com/jcrist/Slicot.jl is attempting to create a Julia SLICOT wrapper.

@mschauer
Copy link
Contributor

Ah, tricky. Could be that they had 5.0 for a limited time on the website under GPL and then removed the link, so that version 5.0 would be free as well, http://www.dynare.org/pipermail/dev/2011-July/001230.html .

@johnmyleswhite
Copy link
Member

I think we'd generally try to avoid pulling something GPL3 into Base. Seems better suited for a package.

@dlfivefifty
Copy link
Contributor Author

I've implemented my own lyap in Julia for the time being. If anyone is interested you can find it as part of ApproxFun:

https://github.com/dlfivefifty/ApproxFun/blob/master/src/PDE/lyap.jl

@mschauer
Copy link
Contributor

@dlfivefifty Cool, thank you for implementing it. I would like to use your implementation for the time. Could you put your lyap.jl public domain or under a licence?

@dlfivefifty
Copy link
Contributor Author

As far as I'm concerned it's public domain, but if you require an official license I'm happy to give it to you

Sent from my iPhone

On Jun 26, 2014, at 10:54 PM, "M. Schauer" [email protected] wrote:

@dlfivefifty Cool, than you for implementing it. I would like to use your implementation for the time. Could you put your lyap.jl public domain or under a licence?


Reply to this email directly or view it on GitHub.

@mschauer
Copy link
Contributor

Ok, cool. I also have a look at the xTRSYL

@ViralBShah ViralBShah added this to the 0.4 milestone Jun 26, 2014
@mschauer
Copy link
Contributor

I gave it a try, if somebody familiar with Julia-LAPACK interaction could have a look, that would be nice, https://gist.github.com/mschauer/e967a2f1e7dc745c23e7 including naive implementation for comparison.
With some guidance I can make a pull request, or somebody else takes over.

@ViralBShah
Copy link
Member

You should definitely make a PR, add tests and docs.

@dlfivefifty
Copy link
Contributor Author

Looking forward to changing my code to use this!  I didn’t see a wrapper for solving

    AXB^t + CXD^t = F

Is a routine for solving this generalized Sylvester equation included in LAPack? Is it easy to access via your code?

Cheers,

Sheehan

On 27 Jun 2014, at 8:03 pm, M. Schauer [email protected] wrote:

I gave it a try, if somebody familiar with Julia-LAPACK interaction could have a look, that would be nice, https://gist.github.com/mschauer/e967a2f1e7dc745c23e7 including naive implementation for comparison.
With some guidance I can make a pull request, or somebody else takes over.


Reply to this email directly or view it on GitHub.

@mschauer
Copy link
Contributor

I think there is only Generalized coupled Sylvester in LAPACK, but one can add a wrapper for that as well

DTGSYL solves the generalized Sylvester equation
              A * R - L * B = scale * C                 
              D * R - L * E = scale * F
  where R and L are unknown m-by-n matrices

@dlfivefifty
Copy link
Contributor Author

Interesting, Mathematica has a LyapunovSolve that does AXB+CXD=F. I'd be surprised if Wolfram bothered to implement it themselves, so I wonder what they use

Sent from my iPad

On 28 Jun 2014, at 10:59 pm, "M. Schauer" [email protected] wrote:

I think there is only Generalized coupled Sylvester in LAPACK, but one can add a wrapper for that as well

DTGSYL solves the generalized Sylvester equation
A * R - L * B = scale * C
D * R - L * E = scale * F
where R and L are unknown m-by-n matrices

Reply to this email directly or view it on GitHub.

@andreasnoack
Copy link
Member

MATLAB uses SLICOT but we cannot do that because of the license.

@tkelman
Copy link
Contributor

tkelman commented Jun 28, 2014

There is a slicot wrapper under-development at https://github.com/jcrist/slicot.jl, it may not have all of the functions exposed yet though.

@JeffBezanson
Copy link
Sponsor Member

implemented by #7435

@atisharma
Copy link

It seems the SLICOT library is dual licence. It will be forked if the licence of future versions is closed. The current version is in the Debian repo, and it seems that there is a commitment to maintain the fork. So perhaps it would be possible to implement as a package?
See https://lists.debian.org/debian-science/2012/06/msg00154.html for the copyright status of the library, and https://lists.debian.org/debian-science/2012/06/msg00154.html for the debian mailing list thread.

@mschauer
Copy link
Contributor

mschauer commented May 7, 2015

Should we reopen? We also still need the discrete time Lyapunov equation

A X A' - X + Q = 0 

@tkelman
Copy link
Contributor

tkelman commented May 7, 2015

@mschauer I could absolutely use that (also algebraic Riccati if someone wants to be awesome), but if the functionality isn't easily doable via lapack wrappers that would already be in openblas then probably best as a package.

@mschauer
Copy link
Contributor

mschauer commented May 7, 2015

I fear you are right. Maybe we can ping each other if something starts moving.

@mschauer
Copy link
Contributor

Perhaps not the canonical way, but https://github.com/mschauer/IDRsSolver.jl solves Stein/discrete Lyapunov equation and other linear equations.

@zouhairm
Copy link

+1 for discrete time Lyapunov equation and algebraic Riccati...
FWIW, the QuantEcon package https://github.com/QuantEcon/QuantEcon.jl implements solve_discrete_lyapunov.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Indicates that a maintainer wants help on an issue or pull request linear algebra Linear algebra
Projects
None yet
Development

No branches or pull requests