[SciPy-dev] removing lil_eye() and lil_diags()
Stéfan van der Walt
stefan at sun.ac.za
Wed Jul 23 05:10:01 EDT 2008
2008/7/23 Nathan Bell <wnbell at gmail.com>:
> Although the conversion to LIL from DIA goes DIA->COO->CSR->LIL, the
> overall cost is still comparable. For instance, the cost of A =
> sparse.eye(10000, 10000, format='dia') is 0.130 ms and the breakdown
> of cost for converting A from DIA to LIL is as follows:
> 1.590 ms DIA->COO
> 0.636 ms COO->CSR
> 50.100 ms CSR->LIL
>
> The full process, i.e. eye(10000, 10000, format='lil'), takes about 52 ms.
>
> On the other hand, your version of lil_eye() [1], which exploits
> properties of the LIL format, requires only 32.3 ms.
That's not too bad. The code that was in `lil_diag` can probably be
adapted quite easily to do DIA->LIL directly, if that ever became
necessary.
> Since the DIA->LIL conversion is not significantly slower, I would
> prefer that we rely on format conversion here. The additional time
> spent making special-purpose implementations for LIL and DOK is
> probably better spent improving the conversions between sparse
> formats. Then, if the implementation of the LIL format changes, there
> will only be a few places (e.g. csr_matrix.tolil() ) that require
> modification.
Agreed; that's a significant advantage.
Regards
Stéfan
More information about the SciPy-Dev
mailing list