S
Size: a a a
S
S
import scipy.sparse
row = np.array([0,0,1,2,2,2])
col = np.array([0,2,2,0,1,2])
data = np.array([1,2,3,4,5,6])
matrix = scipy.sparse.csr_matrix((data,(row,col)), shape=(5,3) )
print(matrix.todense())
print('=' * 20)
n_rows = matrix.shape[0]
step = 3
for start_row, fin_row in zip(range(0, n_rows - step, step), range(step, n_rows + step, step)):
matrix_slice = matrix[start_row: fin_row]
print(matrix_slice.todense())
matrix_slice = matrix[fin_row:]
print(matrix_slice.todense())
S
S
import scipy.sparse
row = np.array([0,0,1,2,2,2])
col = np.array([0,2,2,0,1,2])
data = np.array([1,2,3,4,5,6])
matrix = scipy.sparse.csr_matrix((data,(row,col)), shape=(5,3) )
print(matrix.todense())
print('=' * 20)
n_rows = matrix.shape[0]
step = 3
for start_row, fin_row in zip(range(0, n_rows - step, step), range(step, n_rows + step, step)):
matrix_slice = matrix[start_row: fin_row]
print(matrix_slice.todense())
matrix_slice = matrix[fin_row:]
print(matrix_slice.todense())
D
S
S
S
D
S
D
S
p
RA
p
МС
RA
RA
ТФ