Skip to content

Commit 80bfcf8

Browse files
Merge pull request #772 from dschult/scipy-1.14
Fix repr changes in sparse for Scipy 1.14
2 parents 6305f40 + 609f3cf commit 80bfcf8

File tree

8 files changed

+43
-34
lines changed

8 files changed

+43
-34
lines changed

advanced/scipy_sparse/bsr_array.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ Examples
3535

3636
>>> mtx = sp.sparse.bsr_array((3, 4), dtype=np.int8)
3737
>>> mtx
38-
<3x4 sparse array of type '<... 'numpy.int8'>'
39-
with 0 stored elements (blocksize = 1x1) in Block Sparse Row format>
38+
<Block Sparse Row sparse array of dtype 'int8'
39+
with 0 stored elements (blocksize=1x1) and shape (3, 4)>
4040
>>> mtx.toarray()
4141
array([[0, 0, 0, 0],
4242
[0, 0, 0, 0],
@@ -46,8 +46,8 @@ Examples
4646

4747
>>> mtx = sp.sparse.bsr_array((3, 4), blocksize=(3, 2), dtype=np.int8)
4848
>>> mtx
49-
<3x4 sparse array of type '<... 'numpy.int8'>'
50-
with 0 stored elements (blocksize = 3x2) in Block Sparse Row format>
49+
<Block Sparse Row sparse array of dtype 'int8'
50+
with 0 stored elements (blocksize=3x2) and shape (3, 4)>
5151
>>> mtx.toarray()
5252
array([[0, 0, 0, 0],
5353
[0, 0, 0, 0],
@@ -62,8 +62,8 @@ Examples
6262
>>> data = np.array([1, 2, 3, 4, 5, 6])
6363
>>> mtx = sp.sparse.bsr_array((data, (row, col)), shape=(3, 3))
6464
>>> mtx
65-
<3x3 sparse array of type '<... 'numpy.int64'>'
66-
with 6 stored elements (blocksize = 1x1) in Block Sparse Row format>
65+
<Block Sparse Row sparse array of dtype 'int64'
66+
with 6 stored elements (blocksize=1x1) and shape (3, 3)>
6767
>>> mtx.toarray()
6868
array([[1, 0, 2],
6969
[0, 0, 3],

advanced/scipy_sparse/coo_array.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ Examples
4949
>>> data = np.array([4, 5, 7, 9])
5050
>>> mtx = sp.sparse.coo_array((data, (row, col)), shape=(4, 4))
5151
>>> mtx
52-
<4x4 sparse array of type '<... 'numpy.int64'>'
53-
with 4 stored elements in COOrdinate format>
52+
<COOrdinate sparse array of dtype 'int64'
53+
with 4 stored elements and shape (4, 4)>
5454
>>> mtx.toarray()
5555
array([[4, 0, 9, 0],
5656
[0, 7, 0, 0],

advanced/scipy_sparse/csc_array.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ Examples
5050
>>> data = np.array([1, 2, 3, 4, 5, 6])
5151
>>> mtx = sp.sparse.csc_array((data, (row, col)), shape=(3, 3))
5252
>>> mtx
53-
<3x3 sparse array of type '<... 'numpy.int64'>'
54-
with 6 stored elements in Compressed Sparse Column format>
53+
<Compressed Sparse Column sparse array of dtype 'int64'
54+
with 6 stored elements and shape (3, 3)>
5555
>>> mtx.toarray()
5656
array([[1, 0, 2],
5757
[0, 0, 3],

advanced/scipy_sparse/csr_array.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ Examples
4949
>>> data = np.array([1, 2, 3, 4, 5, 6])
5050
>>> mtx = sp.sparse.csr_array((data, (row, col)), shape=(3, 3))
5151
>>> mtx
52-
<3x3 sparse array of type '<... 'numpy.int64'>'
53-
with 6 stored elements in Compressed Sparse Row format>
52+
<Compressed Sparse Row sparse array of dtype 'int64'
53+
with 6 stored elements and shape (3, 3)>
5454
>>> mtx.toarray()
5555
array([[1, 0, 2],
5656
[0, 0, 3],

advanced/scipy_sparse/dia_array.rst

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ Examples
4242
>>> offsets = np.array([0, -1, 2])
4343
>>> mtx = sp.sparse.dia_array((data, offsets), shape=(4, 4))
4444
>>> mtx
45-
<4x4 sparse array of type '<... 'numpy.int64'>'
46-
with 9 stored elements (3 diagonals) in DIAgonal format>
45+
<DIAgonal sparse array of dtype 'int64'
46+
with 9 stored elements (3 diagonals) and shape (4, 4)>
4747
>>> mtx.toarray()
4848
array([[1, 0, 3, 0],
4949
[1, 2, 0, 4],
@@ -63,15 +63,18 @@ Examples
6363
>>> mtx.offsets
6464
array([ 0, -1, 2], dtype=int32)
6565
>>> print(mtx)
66-
(np.int32(0), np.int32(0)) 1
67-
(np.int32(1), np.int32(1)) 2
68-
(np.int32(2), np.int32(2)) 3
69-
(np.int32(3), np.int32(3)) 4
70-
(np.int32(1), np.int32(0)) 5
71-
(np.int32(2), np.int32(1)) 6
72-
(np.int32(3), np.int32(2)) 7
73-
(np.int32(0), np.int32(2)) 11
74-
(np.int32(1), np.int32(3)) 12
66+
<DIAgonal sparse array of dtype 'int64'
67+
with 9 stored elements (3 diagonals) and shape (4, 4)>
68+
Coords Values
69+
(0, 0) 1
70+
(1, 1) 2
71+
(2, 2) 3
72+
(3, 3) 4
73+
(1, 0) 5
74+
(2, 1) 6
75+
(3, 2) 7
76+
(0, 2) 11
77+
(1, 3) 12
7578
>>> mtx.toarray()
7679
array([[ 1, 0, 11, 0],
7780
[ 5, 2, 0, 12],

advanced/scipy_sparse/dok_array.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ Examples
2828

2929
>>> mtx = sp.sparse.dok_array((5, 5), dtype=np.float64)
3030
>>> mtx
31-
<5x5 sparse array of type '<... 'numpy.float64'>'
32-
with 0 stored elements in Dictionary Of Keys format>
31+
<Dictionary Of Keys sparse array of dtype 'float64'
32+
with 0 stored elements and shape (5, 5)>
3333
>>> for ir in range(5):
3434
... for ic in range(5):
3535
... mtx[ir, ic] = 1.0 * (ir != ic)
3636
>>> mtx
37-
<5x5 sparse array of type '<... 'numpy.float64'>'
38-
with 20 stored elements in Dictionary Of Keys format>
37+
<Dictionary Of Keys sparse array of dtype 'float64'
38+
with 20 stored elements and shape (5, 5)>
3939
>>> mtx.toarray()
4040
array([[0., 1., 1., 1., 1.],
4141
[1., 0., 1., 1., 1.],
@@ -48,8 +48,8 @@ Examples
4848
>>> mtx[1, 1]
4949
np.float64(0.0)
5050
>>> mtx[[1], 1:3]
51-
<1x2 sparse array of type '<... 'numpy.float64'>'
52-
with 1 stored elements in Dictionary Of Keys format>
51+
<Dictionary Of Keys sparse array of dtype 'float64'
52+
with 1 stored elements and shape (1, 2)>
5353
>>> mtx[[1], 1:3].toarray()
5454
array([[0., 1.]])
5555
>>> mtx[[2, 1], 1:3].toarray()

advanced/scipy_sparse/lil_array.rst

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ Examples
3939

4040
>>> mtx[:2, [1, 2, 3]] = data
4141
>>> mtx
42-
<4x5 sparse array of type '<... 'numpy.float64'>'
43-
with 3 stored elements in List of Lists format>
42+
<List of Lists sparse array of dtype 'float64'
43+
with 3 stored elements and shape (4, 5)>
4444
>>> print(mtx)
45+
<List of Lists sparse array of dtype 'float64'
46+
with 3 stored elements and shape (4, 5)>
47+
Coords Values
4548
(0, 1) 1.0
4649
(0, 3) 1.0
4750
(1, 3) 1.0
@@ -64,15 +67,18 @@ Examples
6467
[3, 0, 1, 0],
6568
[1, 0, 0, 1]]...)
6669
>>> print(mtx)
70+
<List of Lists sparse array of dtype 'int64'
71+
with 6 stored elements and shape (3, 4)>
72+
Coords Values
6773
(0, 1) 1
6874
(0, 2) 2
6975
(1, 0) 3
7076
(1, 2) 1
7177
(2, 0) 1
7278
(2, 3) 1
7379
>>> mtx[:2, :]
74-
<2x4 sparse array of type '<... 'numpy.int64'>'
75-
with 4 stored elements in List of Lists format>
80+
<List of Lists sparse array of dtype 'int64'
81+
with 4 stored elements and shape (2, 4)>
7682
>>> mtx[:2, :].toarray()
7783
array([[0, 1, 2, 0],
7884
[3, 0, 1, 0]]...)

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
numpy==2.0.0
2-
scipy==1.13.1
2+
scipy==1.14.0
33
matplotlib==3.9.0
44
pandas==2.2.2
55
patsy==0.5.6

0 commit comments

Comments
 (0)