A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/scipy/scipy/issues/3343 below:

document and test handling of explicit zeros · Issue #3343 · scipy/scipy · GitHub

Some sparse matrix formats store explicit zero-valued elements (see e.g.

explicit zero values are included in this number

,

* explicit zeros are treated as nonzero.

,

* Explicit zeros in A are carried over to B.

).

I know that in some applications of sparse matrices in which implicit zeros have different semantics (e.g. unknown value), explicit zeros are exploited, such as for data imputation.

It seems explicit zeros are maintained in matrix conversion to CSR, CSC, BSR, COO and DOK, but not to LIL.

To my knowledge the properties of the sparse matrix implementations with respect to explicit zeros are undocumented and untested. I presume they should be.

For an example of inconsistency:

>>> A = sp.coo_matrix([[0]])
>>> A.nnz
0
>>> B = A.tocsr()
>>> B[0, 0] = 0
>>> B.nnz
1
>>> B = A.todok()
>>> B[0, 0] = 0
>>> B.nnz
0
>>> B = A.tolil()
>>> B[0, 0] = 0
>>> B.nnz
0

What is correct behaviour?


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4