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

Some indices generalizations for linalg/generic #18032

Merged
merged 1 commit into from
Aug 16, 2016
Merged

Conversation

timholy
Copy link
Sponsor Member

@timholy timholy commented Aug 15, 2016

This was also the occasion for #18031, but this version just keeps compatibility with what we currently have.

@andreasnoack
Copy link
Member

Can you explain this a little more? Is length(AbstractArray) deprecated in favor _length(AbstractArray)? Should length and/or _length not be used with AbstractArrays anymore?

@timholy
Copy link
Sponsor Member Author

timholy commented Aug 15, 2016

@andreasnoack
Copy link
Member

I see. In the documentation, your suggestion is to use length(linearindices(A)) instead of length(A) so would it make sense to use it here? Is the idea that in the future, when the code base has had some time to adjust to the new AbtractArray interface, length can again be used for extracting the number of elements in an array? If you stay with the _length, I think it makes sense to explain it in a comment.

@timholy
Copy link
Sponsor Member Author

timholy commented Aug 15, 2016

It's equivalent, see how linearindices and _length are implemented. I guess the thing I like about _length is that it's search-and-replaceable and even @deprecateable (in case packages start calling it directly, though I'd strongly prefer if they just internally defined _length(a) = length(linearindices(a)).

I can add a comment if you like. Perhaps at the using Base: _length statement?

@tkelman
Copy link
Contributor

tkelman commented Aug 16, 2016

@nanosoldier runbenchmarks(ALL, vs=":master")

@nanosoldier
Copy link
Collaborator

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @jrevels

@andreasnoack
Copy link
Member

I know but I think it would be useful with a comment such that, in the future, we'll know why we are using a non-exported and non-documented function to compute the number of elements in an array.

@timholy
Copy link
Sponsor Member Author

timholy commented Aug 16, 2016

It's already there now, do you like it? Or should I move it somewhere else?

@andreasnoack
Copy link
Member

I see. Thanks. I looked in the wrong file. It was something like that I had in mind.

@timholy
Copy link
Sponsor Member Author

timholy commented Aug 16, 2016

Feel free to suggest further changes, or if none perhaps we can merge.

@andreasnoack andreasnoack merged commit f14c2ca into master Aug 16, 2016
@tkelman tkelman deleted the teh/inds_linalg branch August 16, 2016 19:53
tkelman pushed a commit that referenced this pull request Aug 20, 2016
mfasi pushed a commit to mfasi/julia that referenced this pull request Sep 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants