MAINT: sparse: eye() instead of identity() #363

wants to merge 3 commits into


None yet

2 participants

pv commented Nov 23, 2012

sparse.identity() and sparse.eye() are almost the same thing. Confusingly, you cannot call eye() with a single parameter to get a square matrix.

This PR makes eye() accept a single parameter, and implements identity() via it. Also, makes it return dia_matrix by default (

I'm not 100% sure about the deprecation. I suppose identity() is used by absolutely everyone --- if this causes warnings to pop up, it'll be a nuisance.

jakevdp commented Nov 23, 2012

Looks good. I am -1 on deprecation warnings for identity. With the slightly incompatible behavior of eye in the most recent released version, this could lead to surprise issues for those writing packages compatible with multiple scipy versions. The identity function is a light enough alias that we should keep it around, at least for another couple release cycles.

pv commented Nov 24, 2012

Merged without deprecation.

@pv pv closed this Nov 24, 2012
@pv pv added a commit that referenced this pull request Nov 24, 2012
@pv pv ENH: io: support mmapping in (pull request gh-363, Trac #…

Thanks to bemasc for the patch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment