Eg:
julia> a = ones(10);
julia> sizeof(a)
80
julia> sizeof(a')
8
julia> a = ones(ComplexF64, 10);
julia> sizeof(a')
8
I’m not sure how to interpret the results for the adjoint? Similar issues arise for OffsetArray
s and other wrappers. It appears that SubArray
s have the method defined:
julia> a = ones(10);
julia> sizeof(@view a[:])
80
Is this a case of missing methods for other wrappers?
Hunh, here I was actually surprised at the SubArray
result! We don’t really have the surrounding architecture to meaningfully use sizeof
’s results, and it probably doesn’t mean what you’re actually trying to understand. I’d guess you actually want something more akin to Base.summarysize
instead.
You’re right, though, we should probably implement sizeof
for those wrappers to just defer to their wrapped array (or just generally do better here). Thanks for bringing this up! See: #36714 and #36715.
1 Like