8000 Rollaxis always return view by charris · Pull Request #5464 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

Rollaxis always return view #5464

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

Merged
merged 3 commits into from
Jan 19, 2015

Conversation

charris
Copy link
Member
@charris charris commented Jan 19, 2015

Rollaxiis did not returned a view unless the axis order was unchanged, in which case it returned the input array. This PR makes it always return a view and adds tests, of which there were none before.

@charris
Copy link
Member Author
charris commented Jan 19, 2015

See also #5260.

@jnothman
Copy link
Member

I assume you'll fix up swapaxes too?

@charris
Copy link
Member Author
charris commented Jan 19, 2015

Thinking about it :)

def test_results(self):
a = arange(1*2*3*4).reshape(1, 2, 3, 4)
aind = np.indices(a.shape)
for (i, j) in self.tgtshape.keys():
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Iteration over a dictionary is over the keys by default, no need for the .keys() here.

Previous to this commit, rollaxis returned a view unless the order of
the axis was unchanged, in which case the input array was returned.
There were no tests previous to this.
@charris charris force-pushed the rollaxis-always-return-view branch from a315925 to cf41fce Compare January 19, 2015 16:16
@charris
Copy link
Member Author
charris commented Jan 19, 2015

@jaimefrio Fixed, thanks for the review.

jaimefrio added a commit that referenced this pull request Jan 19, 2015
@jaimefrio jaimefrio merged commit 4ed1587 into numpy:master Jan 19, 2015
@jaimefrio
Copy link
Member

Merged, thanks!

@charris charris deleted the rollaxis-always-return-view branch January 19, 2015 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0