[SciPy-Dev] sparse.block_diag improvement

Severin Holzer-Graf sholzergr at gmail.com
Mon Apr 7 05:43:38 EDT 2014


2014-04-07 10:28 GMT+02:00 Pauli Virtanen <pav at iki.fi>:
> Severin Holzer-Graf <sholzergr <at> gmail.com> writes:
> [clip]
>> My question is, is there interest in integrating this in Scipy, and if
>> yes, how can this be done best?
>> I tried extending the current block_diag in a fork, but the indexing
>> trick only works for equally sized matrices. So either add a check in
>> the beginning of the existing block_diag and than executing the fast
>> way, or writing another function, especially for equally sized
>> matrices.
>
> The best way to do it is probably to write the "fast path"
> as a separate function with a name starting with "_", and
> add an if statement to block_diag calling that in cases
> where it's possible to do it in a better way.

Will do so and come back to you then.

There's also a case that happend to me quite often.
If i want to convert a dense matrix row's to a sparse block_diag
matrix. Then the data concatenation can be skipped and replaced by a
simple ".ravel()".
Should we add a optional parameter to block_diag or rather to this
automatically, if the supplied list consists only of one matrix?

-- 
Severin



More information about the SciPy-Dev mailing list