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

Trying to fix segmentation fault

parent 7eb04c88
No related branches found
No related tags found
No related merge requests found
...@@ -34,9 +34,9 @@ def extractSubset(matrix, usedIndices): ...@@ -34,9 +34,9 @@ def extractSubset(matrix, usedIndices):
if sparse.issparse(matrix): if sparse.issparse(matrix):
newIndptr = np.zeros(len(usedIndices)+1, dtype=np.int16) newIndptr = np.zeros(len(usedIndices)+1, dtype=np.int16)
oldindptr = matrix.indptr oldindptr = matrix.indptr
print oldindptr
for exampleIndexIndex, exampleIndex in enumerate(usedIndices): for exampleIndexIndex, exampleIndex in enumerate(usedIndices):
if exampleIndexIndex>0: newIndptr[exampleIndexIndex+1] = newIndptr[exampleIndexIndex]+(oldindptr[exampleIndex+1]-oldindptr[exampleIndex])
newIndptr[exampleIndexIndex] = newIndptr[exampleIndexIndex-1]+(oldindptr[exampleIndex]-oldindptr[exampleIndex-1])
newData = np.ones(newIndptr[-1], dtype=bool) newData = np.ones(newIndptr[-1], dtype=bool)
newIndices = np.zeros(newIndptr[-1], dtype=np.int32) newIndices = np.zeros(newIndptr[-1], dtype=np.int32)
oldIndices = matrix.indices oldIndices = matrix.indices
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment