For matrices A, B, and C, and some integer i, is there an easy way to make view whose result is
vec([A[:,i];B[:,i];C[:,i]])
without creating any temporaries? My current try is:
A = rand(4,4); B = rand(4,4); C = rand(4,4)
[@view(A[:,1]);@view(B[:,1]);@view(C[:,1])]
that obviously creates the vector at the end instead of a view to the four columns stacked as a vector.
It looks like you're looking for a lazy version of cat. Here's one implementation:
lazy cat http://www.mrwallpaper.com/wallpapers/Lazy-Cat.jpg
But in all seriousness, consider the (still experimental) solution ahwillia has here: CatViews.jl. In your situation, CatView(@view(A[:,1]), @view(B[:,1]), @view(C[:,1])) would work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With