[SciPy-user] Construct sparse matrix from sparse blocks
Fri Feb 8 15:42:13 CST 2008
On Fri, 08 Feb 2008 15:08:30 -0600, Nathan Bell wrote:
> Regarding names, we already have spkron ~= kron and spdiags ~= diag. I
> think we'll have to abandon this approach for the proposed functions
> since spbmat, sphstack, spvstack are terrible :)
> Which is better,
> I prefer the XXX_sparse format since it aids tab completion.
All else being equal I prefer verbose and tab-completable, although it
can get a bit much. I'm actually in favour of Anne's suggestion of using
namespaces, though I'd put them in the sparse, rather than splinalg
namespaces. I envision working like this:
import scipy.sparse as sp
import numpy as N
# sparse stuff
A = sp.hstack(....)
B = sp.bmat(....)
# dense (like me) stuff
D = N.hstack(.....)
from scipy.sparse import hstack as sphstack
if that's your bag....
While the original numpy names are a bit concise, I think consistency
goes along way. This let's us use namespaces to combine brevity with
explicitness. In the immortal words of import this:
Explicit is better than implicit.
Namespaces are one honking great idea -- let's do more of those!
More information about the SciPy-user