@@ -74,9 +74,9 @@ def test_construction(
74
74
# only occurs if we mess up the test params
75
75
pytest .skip (reason = "NNZ is too large for index type." )
76
76
77
- indptr = np .empty ((sp .shape [0 ] + 1 ), dtype = csr_major_index_dtype )
78
- indices = np .empty ((sp .nnz ,), dtype = csr_minor_index_dtype )
79
- data = np .empty ((sp .nnz ,), dtype = sp .dtype )
77
+ indptr = np .zeros ((sp .shape [0 ] + 1 ), dtype = csr_major_index_dtype )
78
+ indices = np .zeros ((sp .nnz ,), dtype = csr_minor_index_dtype )
79
+ data = np .zeros ((sp .nnz ,), dtype = sp .dtype )
80
80
81
81
fastercsx .compress_coo (
82
82
context ,
@@ -133,9 +133,9 @@ def test_partitioning(
133
133
random_state = rng ,
134
134
)
135
135
136
- indptr = np .empty ((sp .shape [0 ] + 1 ), dtype = np .int32 )
137
- indices = np .empty ((sp .nnz ,), dtype = np .int32 )
138
- data = np .empty ((sp .nnz ,), dtype = sp .dtype )
136
+ indptr = np .zeros ((sp .shape [0 ] + 1 ), dtype = np .int32 )
137
+ indices = np .zeros ((sp .nnz ,), dtype = np .int32 )
138
+ data = np .zeros ((sp .nnz ,), dtype = sp .dtype )
139
139
140
140
fastercsx .compress_coo (
141
141
context ,
@@ -183,9 +183,9 @@ def test_multichunk(
183
183
col_chunks = tuple (np .array_split (sp .col , nchunks ))
184
184
data_chunks = tuple (np .array_split (sp .data , nchunks ))
185
185
186
- indptr = np .empty ((sp .shape [0 ] + 1 ), dtype = np .int32 )
187
- indices = np .empty ((sp .nnz ,), dtype = np .int32 )
188
- data = np .empty ((sp .nnz ,), dtype = sp .dtype )
186
+ indptr = np .zeros ((sp .shape [0 ] + 1 ), dtype = np .int32 )
187
+ indices = np .zeros ((sp .nnz ,), dtype = np .int32 )
188
+ data = np .zeros ((sp .nnz ,), dtype = sp .dtype )
189
189
190
190
fastercsx .compress_coo (
191
191
context ,
@@ -262,9 +262,9 @@ def test_compress_coo_bad_args(
262
262
sp = sparse .random (2830 , 212 , density = 0.1 , dtype = np .int8 , random_state = rng )
263
263
i , j , d = sp .row , sp .col , sp .data
264
264
265
- indptr = np .empty ((sp .shape [0 ] + 1 ), dtype = np .int32 )
266
- indices = np .empty ((sp .nnz ,), dtype = np .int32 )
267
- data = np .empty ((sp .nnz ,), dtype = sp .dtype )
265
+ indptr = np .zeros ((sp .shape [0 ] + 1 ), dtype = np .int32 )
266
+ indices = np .zeros ((sp .nnz ,), dtype = np .int32 )
267
+ data = np .zeros ((sp .nnz ,), dtype = sp .dtype )
268
268
269
269
with pytest .raises (TypeError ):
270
270
fastercsx .compress_coo (None , sp .shape , (i ,), (j ,), (d ,), indptr , indices , data )
@@ -399,9 +399,9 @@ def test_ragged_chunk_error(
399
399
# is enforced.
400
400
nnz = 3
401
401
shape = (100 , 20 )
402
- indptr = np .empty (shape [0 ] + 1 , dtype = np .int32 )
403
- indices = np .empty (nnz , dtype = np .int32 )
404
- data = np .empty (nnz , dtype = np .int8 )
402
+ indptr = np .zeros (shape [0 ] + 1 , dtype = np .int32 )
403
+ indices = np .zeros (nnz , dtype = np .int32 )
404
+ data = np .zeros (nnz , dtype = np .int8 )
405
405
with pytest .raises (ValueError ):
406
406
fastercsx .compress_coo (
407
407
context ,
@@ -432,8 +432,8 @@ def test_empty_first_frag(rng: np.random.Generator, context: clib.SOMAContext) -
432
432
d := np .array ([85 , 63 , 51 , 26 , 30 , 4 , 7 , 1 , 17 , 81 ], dtype = np .int8 ),
433
433
),
434
434
indptr := np .zeros (57 , dtype = np .int32 ),
435
- indices := np .empty ((10 ,), dtype = np .int32 ),
436
- data := np .empty ((10 ,), dtype = np .int8 ),
435
+ indices := np .zeros ((10 ,), dtype = np .int32 ),
436
+ data := np .zeros ((10 ,), dtype = np .int8 ),
437
437
)
438
438
439
439
csr = sparse .csr_matrix ((d , (i , j )), shape = shape )
0 commit comments