-
Notifications
You must be signed in to change notification settings - Fork 42
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
Unifying and generalizing hcat, vcat, hvcat, blockdiag etc. #64
Comments
This is a great idea! I think the summation loop won't be a problem. A mild challenge is multiply-and-add, because we will rely on I may give it a try when I'm done with the current PRs. |
I've got it 90% done. Famous saying about the last 10%... Will send something soon. |
🤣 just like me: I also keep telling I won't have time, and then I'm too curious wether it works and start working on it immediately. |
Exactly. |
This is a rough idea that I want to sketch out now, even though I don't have time to work on it.
Suppose
A
is aMxN
linear operator and we think of it being embedded with zeros around it to make a bigger linear operatorB = [0 0 0; 0 A 0; 0 0 0]
where the zeros around it are matrices some of which might be of size0x0
. All one needs to specifyB
is the size of the upper left 0 and the lower right 0. Call this aOffsetMap
or such, where the operationy = B * x
is simplyWe cache the ranges at construction time, very much in the spirit of how
hvcat
is done.All of the
hcat
andvcat
andhvcat
objects, I meanBlockMap
objects, are simply sums of theseOffsetBlock
objects with appropriate offsets for each block.A
BlockDiagonalMap
is also just a sum of suchOffsetMap
objects.One could imagine other block sparse matrices made by summing several such objects.
Instead of having to define separate types for each pattern, all of these are just sums (
LinearCombinationMap
) ofOffsetMap
objects.Wish I had thought of this earlier. The only question I have is whether the summation in a
LinearCombinationMap
will be as fast as the loops for aBlockMap
. Or am I overlooking any other drawback?The text was updated successfully, but these errors were encountered: