scipy.sparse
Date: May 26, 2023
Contributors: CJ, Julien, Isaac, Dan, Ross, Stéfan, Levi, Sebastian
I've locked edit access for now. If you have changes or suggestions, let me know. CJ Carey
scipy.sparse
provides a widely-used set of types for working with sparse data, which mimic the numpy.matrix
API. As the community continues to move away from matrix semantics, we want to provide a sparse array-like API that follows modern conventions.
This involves a lot of work, including some necessary churn for end-users, but it also provides a unique opportunity to re-evaluate many design choices that have accumulated over the last 20+ years of SciPy development.
isinstance
checking.
isinstance(..., sparray)
now selects only sparse arraysisinstance(..., spmatrix)
now selects only sparse matrices_spbase
) underpins all sparse container types.isspmatrix
and isspmatrix_<fmt>
helper functions to better reflect their name (see gh-18528).
isspmatrix*
now only return True
for sparse matrices, not sparse arrays.issparse
is the recommended function to check for either array or matrix sparse containers.isspmatrix
and the associated isspmatrix_<fmt>
functions was replaced with issparse
and isinstance
checks, as appropriate.sparray
interface, leaving spmatrix
untouched for backward compatibility:
asfptype
, getrow
, getcol
, getnnz
, getformat
..H
and .A
attributes in sparse array classes.sparray
doesn't downcast index arrays from 64-bit to 32-bit.scipy.sparse
namespace. For example, scipy.sparse.diags_array()
will act like scipy.sparse.diags()
but return a sparse array instead of a sparse matrix.scipy.sparse.array
namespace. This would complicate the process of incrementally updating dependent library code, as upgrades would need to be performed in an all-or-nothing fashion.array=None
keyword argument to each existing creation function. This would make it hard to change other arguments and clean up the API going forward.isshape
and check_shape
to optionally handle non-2d shapes.coo_array
support (see gh-18530).__array_ufunc__
and other __array_*__
protocols for sparse arrays
coo_array
to support n-dimensional shapes.dps_array
in 2d gh-18514 and then 1d.scipy.sparse.eye
+ friends.eye
, random
, and others.spdiags
, rand
and identity
.isspmatrix_<fmt>
functions now that the class hierarchy for sparray
and spmatrix
has been adjusted. To check for a particular format, users can write x.format == 'coo'
.or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing