Skip to content
Snippets Groups Projects
Commit 3c2511a1 authored by bbauvin's avatar bbauvin
Browse files

Trying to fix segmentation fault

parent ff23a21c
No related branches found
No related tags found
No related merge requests found
......@@ -41,7 +41,7 @@ def extractSubset(matrix, usedIndices):
newIndices = np.zeros(newIndptr[-1], dtype=np.int32)
oldIndices = matrix.indices
for exampleIndexIndex, exampleIndex in enumerate(usedIndices):
newIndices[newIndptr[exampleIndexIndex]:newIndptr[exampleIndexIndex]] = oldIndices[oldindptr[exampleIndex], oldindptr[exampleIndex+1]]
newIndices[newIndptr[exampleIndexIndex]:newIndptr[exampleIndexIndex+1]] = oldIndices[oldindptr[exampleIndex]: oldindptr[exampleIndex+1]]
return sparse.csr_matrix((newData, newIndices, newIndptr), shape=(len(usedIndices), matrix.shape))
else:
return matrix[usedIndices]
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment