I think that sqrtm would often be the more reasonable advise. My guess is that the Cholesky factor is very often used like a matrix square root.
2014-04-08 18:22 GMT+02:00 Stefan Karpinski <ste...@karpinski.org>: > Is it possible to default to unpivoted and if that fails detect that a > pivoted Cholesky might have worked and include a recommendation to try the > pivoted version in the error message? > > > On Tue, Apr 8, 2014 at 10:58 AM, Andreas Noack Jensen < > andreasnoackjen...@gmail.com> wrote: > >> It would be helpful if the LAPACK codes were written out in the Julia >> exception, but it is not most exciting thing to write. The un-pivoted >> Cholesky factor is not triangular, so I think returning that would also >> cause some confusion. >> >> >> 2014-04-08 16:50 GMT+02:00 Iain Dunning <iaindunn...@gmail.com>: >> >> Jiahao: interesting link! Do you think we should put the meaning of that >>> error code somewhere? Maybe best would be as the actual message of the >>> PosDefException. >>> Andreas: if we un-pivot the result then the user would be unaware, >>> correct? I feel like chol() is the "casual" way of doing it and should make >>> a best effort to work, whereas cholfact is the more poweruser version. >>> David: I was indeed playing around with max-cut, check out >>> https://github.com/JuliaOpt/JuMP.jl/blob/sdp/examples/maxcut_sdp.jl >>> >>> Cheers, >>> Iain >>> >>> >>> On Tuesday, April 8, 2014 5:58:36 AM UTC-4, David de Laat wrote: >>>> >>>> You can also use a hack to make the matrix positive definite: >>>> mineig = minimum(eigvals(M)) >>>> M -= mineig * eye(M) >>>> >>>> (And in case you're working on max-cut you can also use >>>> M = (M - mineig * eye(M)) / (1-mineig) >>>> so that the linear constraints in the semidefinite program are still >>>> satisfied by the new matrix M.) >>>> >>>> Best, >>>> David >>>> >>> >> >> >> -- >> Med venlig hilsen >> >> Andreas Noack Jensen >> > > -- Med venlig hilsen Andreas Noack Jensen