Skip to content

Fix explanation of LIst of List sparse matrix #17027

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

stefanv
Copy link
Member

@stefanv stefanv commented Sep 15, 2022

Thanks to CJ Carey for catching the mistake.

Sparse was introduced to SciPy in this commit:

scipy/scipy-svn@b3827de

A later update included a list of formats:

scipy/scipy-svn@39730dc

In both these patches the phrase "linked list matrix" is used, but I believe erroneously. The LIst of List format uses the following representation:

In [1]: import scipy.sparse

In [2]: X = scipy.sparse.lil_matrix([[0,0,0,0],[0,1,0,0],[0,0,
   ...: 0,0]])

In [3]: X.data
Out[3]: array([list([]), list([1]), list([])], dtype=object)

The intent is to have direct access to any row. This can be achieved with a list of lists, but not with a linked list representation.

Thanks to CJ Carey for catching the mistake.

Sparse was introduced to SciPy in this commit:

scipy/scipy-svn@b3827de

A later update included a list of formats:

scipy/scipy-svn@39730dc

In both these patches the phrase "linked list matrix" is used, but I
believe erroneously. The LIst of List format uses the following representation:

```
In [1]: import scipy.sparse

In [2]: X = scipy.sparse.lil_matrix([[0,0,0,0],[0,1,0,0],[0,0,
   ...: 0,0]])

In [3]: X.data
Out[3]: array([list([]), list([1]), list([])], dtype=object)
```

The intent is to have direct access to any row. This can be achieved with a list of lists, but not with a linked list representation.
@perimosocordiae perimosocordiae merged commit a9ee25e into scipy:main Sep 16, 2022
@perimosocordiae
Copy link
Member

Thanks! Merged.

@WarrenWeckesser WarrenWeckesser added scipy.sparse Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org labels Sep 16, 2022
@WarrenWeckesser WarrenWeckesser added this to the 1.10.0 milestone Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Documentation Issues related to the SciPy documentation. Also check https://github.com/scipy/scipy.org scipy.sparse
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants