-
Notifications
You must be signed in to change notification settings - Fork 87
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
HermitianPositiveSemidefiniteConeTriangle with convenient indexing #2597
Comments
I don't really think we need yet-another-cone. I understand that the indexing is a pain, but it's a couple of lines of code in a couple of places. To me, that doesn't justify adding another cone. @blegat needs to decide this though.
I don't understand this part. |
I contributed a complex PSD cone to the solver SCS. I'm also going to make it accessible through MOI, by adding the appropriate bridge to the SCS.jl. Clear now? |
Are you talking about this? cvxgrp/scs#301 Since that PR is not merged yet, you could always choose to use MOI's vectorization 😄 At minimum, we should hold off on any decision here until there SCS PR is actually merged and a new version is tagged... |
Yes, that's the PR. There's no way I'm going to use the MOI vectorization in SCS. Not only it's a pain in the ass to program, it's also rather inefficient due to keeping the real and imaginary parts far apart. LAPACK requires a complex matrix with the real and imaginary parts interleaved, so the vectorization needs to match. And the efficiency does matter, as the vectorization needs to be done hundreds, if not thousands of times. So no, nothing depends on the PR being merged. Also, I have time to program now that I'm on vacations, after I get back to work it will be harder. |
My smile was slightly sarcastic 😄 The underlying point is that the user's input format does not need to match the solver's internal computation format. It's just a convention with a re-order. |
I know that. Note that SCS does not use Hypatia's format, because it is written in C, and thus uses a vectorization that's more appropriate for a row-major language, whereas Hypatia's is more appropriate for a col-major language. I'm proposing here to use Hypatia's format in MOI. What I'm talking about is how convenient it is to write the bridge. I think it's worth rewriting the cone in order to spare myself the pain of writing yet another bridge with the MOI vectorization. It's also a gift for the future programmers. |
But if we add a cone that uses Hypatia's format, how does that help SCS? |
If I understand correctly, you would like the chain of bridges:
Why is row-major more appropriate in C ? You have an option to choose between row-major and col-major in lapack if I'm not mistaken. Julia and SCS just use different options. Note that col-major indexing is much easier as the mapping from |
If I have to write the bridge from
Because C is row-major. I don't know about this LAPACK option, and it doesn't sound like a good idea anyway, as LAPACK is written in FORTRAN, which is col-major, and telling it to work in row-major format would be rather inefficient.
You can also have this nice property with a row-major ordering by taking the rows of the lower diagonal, instead of the upper one. It's not what SCS does it, though, and I can't fix that without breaking backwards compatibility. So I kept taking the rows of the upper diagonal. |
I don't understand, you want the ComplexPSDCone to be col-major so it will be different to SCS so you'll still need to write a bridge anyway. Your suggestion is precisely to add that ComplexPSD cone to MOI and a bridge from the Hermitian one. I'm just suggesting to do exactly what you suggested but first in a SCS PR
I'm just saying in general that you can always define your cone and bridge outside of MOI and then do a PR to MOI once we see that several solvers would benefit from it. Here it seems to be the case for Hypatia and SCS so I don't have any objection but it's still easier to start in an SCS PR.
I don't understand. MOI is both col-major upper-triangular and row-major lower- triangular. There two are the same by symmetry of the matrix and these are the ones with that property that the index mapping does not depend on the dimension. SCS is the other one so it does not have that property.
What does that mean ? C has no concept of matrix. |
Yes, but the bridge I want to write is
The underlying matrix is not necessarily Hermitian (and in fact never is when working with LAPACK), so col-major upper-triangular and row-major lower-triangular are not the same thing.
If you declare |
At the MOI level, we only store the triangle part for the
JuMP still creates But you can indeed start with the bridge from |
Well, yes, except for complex conjugation. Btw @chriscoey why are you taking the complex conjugate of the upper triangular in Hypatia?
Fair enough, had forgotten about JuMP; I'll write the chain of bridges then. |
As we've discussed before, I find the indexing of
HermitianPositiveSemidefiniteConeTriangle
rather inconvenient. I'm about to write the JuMP interface for the complex PSD cone of SCS, and I'd rather not use it again (as I already did for SeDuMi and COSMO). Changing the existing set would break backward compatibility, though, so I suggest adding a new set, sayComplexPositiveSemidefiniteConeTriangle
, and deprecatingHermitianPositiveSemidefiniteConeTriangle
. What do you think? I can do it myself if you're interested, I just don't want to waste my time writing a PR that won't be welcomed.The text was updated successfully, but these errors were encountered: