Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 4966213e authored by hhakim's avatar hhakim
Browse files

Fix pyfaust pyx ctor by converting the scipy BSR matrix blocks organized in a...

Fix pyfaust pyx ctor by converting the scipy BSR matrix blocks organized in a row-major order contrary to FAµST BSR blocks organized in a column-major order.
parent 1dd6fae3
Branches
Tags
No related merge requests found
...@@ -54,7 +54,13 @@ cdef class FaustCoreGen@TYPE_NAME@@PROC@: ...@@ -54,7 +54,13 @@ cdef class FaustCoreGen@TYPE_NAME@@PROC@:
nbcol, optimizedCopy) nbcol, optimizedCopy)
elif(isinstance(factor, sparse.bsr_matrix)): elif(isinstance(factor, sparse.bsr_matrix)):
bnnz = int(factor.nnz/factor.blocksize[0]/factor.blocksize[1]) bnnz = int(factor.nnz/factor.blocksize[0]/factor.blocksize[1])
data1d = factor.data.reshape(bnnz*factor.blocksize[0]*factor.blocksize[1]).astype(type2dtype('@TYPE@'), 'F') # reshape data with block transposition (because scipy is
# in row-major order and FAµST col-major order)
_data = np.empty((bnnz, factor.blocksize[0],
factor.blocksize[1]))
for i in range(bnnz):
_data[i] = factor.data[i].T
data1d = _data.reshape(bnnz*factor.blocksize[0]*factor.blocksize[1]).astype(type2dtype('@TYPE@'))#, 'F')
indices=factor.indices.astype(np.int32, 'F') indices=factor.indices.astype(np.int32, 'F')
indptr=factor.indptr.astype(np.int32, 'F') indptr=factor.indptr.astype(np.int32, 'F')
self.@CORE_OBJ@.push_back(&data1d[0], &indptr[0], self.@CORE_OBJ@.push_back(&data1d[0], &indptr[0],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment