thouis / numpy-trac-migration

numpy Trac to github issues migration
2 stars 3 forks source link

Add "blkdiag" command from MATLAB (migrated from Trac #943) #2496

Open thouis opened 12 years ago

thouis commented 12 years ago

Original ticket http://projects.scipy.org/numpy/ticket/943 Reported 2008-10-27 by trac user chrismurf, assigned to unknown.

A command similar to MATLAB's "blkdiag" would be handy in Numpy. I'm not sure what the correct component is for this - I can imagine it going in the normal namespace like 'diag', but tagged the numpy.linalg component in case it's deemed unworthy of the normal namespace.

I've attached an example implementation, which almost certainly breaks every Numpy coding convention (but is functional). If there's interest but the code quality is not acceptable, I'm happy to clean it up for inclusion.

thouis commented 12 years ago

Attachment in Trac by trac user chrismurf, 2008-10-27: numpy-blkdiag-impl.py

thouis commented 12 years ago

Comment in Trac by atmention:mwiebe, 2011-03-24

thouis commented 12 years ago

Comment in Trac by atmention:rgommers, 2011-03-30

thouis commented 12 years ago

Comment in Trac by atmention:rgommers, 2011-03-30

In principle I think this could be added to lib/twodim_base.py

The patch needs a docstring and tests though. Plus PEP8 compliance (4 spaces indentation, etc.).

thouis commented 12 years ago

Comment in Trac by atmention:rgommers, 2011-12-06

A sparse version is going into scipy.sparse: https://github.com/scipy/scipy/pull/97

This may belong in scipy.linalg. Either way, still useful.