If A = [1,2; 3 4]
What is the difference between b = view(A, :, 1)
and b = @view A[:,1]
Is the macro form just shorthand for the other?
Thanks
If A = [1,2; 3 4]
What is the difference between b = view(A, :, 1)
and b = @view A[:,1]
Is the macro form just shorthand for the other?
Thanks
Yes, just for convenience. Also, the macro supports using end
.
(There is also @views
)
The way to check this is to use @macroexpand
, which shows you what the macro expands to:
julia> using MacroTools # makes the output a bit cleaner
julia> @macroexpand( @view A[:, 1] )
:(true && (view)(A, :, 1))