[SciPy-Dev] Minimal sparse array interface

Evgeni Burovski evgeny.burovskiy at gmail.com
Thu Jun 3 15:34:52 EDT 2021


Hi Stefan,

You're thinking something like a lightweight `csr_array` which is
almost identical to the existing csr_matrix, but has  a np.array-like
multiplication?
I think it'd be a nice thing to have!

Several things to consider upfront:

1. What's the minimal subset of formats? Would CSR be enough, or some
others are needed from the start?
2. Should this live in scipy.sparse or keep it in a separate repo in
the scipy org for a while?
3.What about d != 2 ? E.g., does array[0, :] behave as a 1D numpy
array. What about array[:, :, None]. Does it broadcast? (This can
develop into quite a rabbit hole unless defined very clearly from the
start I suspect.)
4. The interaction with scipy.sparse.linalg.

Cheers,

Evgeni

On Thu, Jun 3, 2021 at 8:54 PM Stefan van der Walt <stefanv at berkeley.edu> wrote:
>
> Hi everyone,
>
> Several times now, I've needed exactly what is available in scipy.sparse but with an array interface, instead of a matrix interface.  Having such an interface would also simplify matters for libraries such as NetworkX and scikit-learn.
>
> I am aware of pydata.sparse, but that seems like quite a bit more than is needed here (higher dimensions, optimizations via numba; I'm not clear on the linear algebra status).
>
> Would it make sense to add a minimal interface on top of the SciPy sparse matrices that exposes a NumPy array interface?  Eventually that could become the default (although it probably implies a larger refactor of the underlying classes).
>
> Best regards,
> Stéfan
> _______________________________________________
> SciPy-Dev mailing list
> SciPy-Dev at python.org
> https://mail.python.org/mailman/listinfo/scipy-dev


More information about the SciPy-Dev mailing list