Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 VcatAtom #607
Add VcatAtom #607
Changes from 2 commits
7c4be44
307a1c7
ac8e936
159b1be
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is not nice, but I don't know an alternative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One option is to manually build the operator we want to do:
Convex.jl/src/reformulations/partialtranspose.jl
Line 44 in 0bd470b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, I think that
permutedims_matrix
function already does what we need:Here I'm using the fact that
permutedims_matrix
is actually the matrix implementation ofX -> vec(permutedims(reshape(X, dims), p))
where heredims = (size(x, 1),size(x,2),size(y,1)
which corresponds to concatenatingx
andy
in a new 3rd dimension, then(1,3,2)
does the transposing business to swap the last 2 dimensions. We end up with a vector of course, but I reshape it to the intended output dimensions to show we got it right.To actually operate on the vectorized level in Convex IIIC we'd need to do something like
z = operate(vcat, x, y)
, then generateM
and apply it on the vectorized level withoperate(*, M, z)
, I think. We don't need to bother with the final reshaping since the dimensions are stored on the AbstractExpr level not the vectorized level.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've kept as-is for now. It wasn't obvious how to generalize this to the n-ary case, and what we currently have works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can try this refactoring in a separate PR
Check warning on line 58 in src/atoms/affine/VcatAtom.jl
Codecov / codecov/patch
src/atoms/affine/VcatAtom.jl#L58