Skip to content
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

implement sizeof for SubArray #25258

Merged
merged 1 commit into from
Dec 26, 2017
Merged

implement sizeof for SubArray #25258

merged 1 commit into from
Dec 26, 2017

Conversation

JeffBezanson
Copy link
Member

This surprised me. Is there any reason not to have this method?
Found while working on #25241.

@JeffBezanson JeffBezanson added the arrays [a, r, r, a, y, s] label Dec 23, 2017
@andreasnoack
Copy link
Member

I guess there has generally been some abstraction confusion about when something is an outer structure or the actual thing. E.g. when discussing copy for sparse arrays. When discussing copy, you mentioned that these kinds of arrays shouldn't be considered an outer structure (which is the interpretation I also prefer) and it seems to be the same question now for sizeof. Hence, we should probably also have sizeof(A::SparseMatricCSC) = sizeof(A.colptr) + sizeof(A.rowval) + sizeof(A.nzval). In any case, it would be great with a short discussion of this in the manual to use as reference for future discussions.

@JeffBezanson
Copy link
Member Author

One thing we can add to the doc string is that if something can be written out with write, then sizeof should give the number of bytes that would be written. Under that idea, SubArray definitely qualifies but SparseMatrixCSC could still go either way.

@JeffBezanson JeffBezanson merged commit 5f59ef5 into master Dec 26, 2017
@JeffBezanson JeffBezanson deleted the jb/sizeofview branch December 26, 2017 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s]
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants