Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F91378161
sparse_matrix.i
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Nov 10, 12:43
Size
995 B
Mime Type
text/x-python
Expires
Tue, Nov 12, 12:43 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
22211699
Attached To
rAKA akantu
sparse_matrix.i
View Options
%include "sparse_matrix.hh"
%include "sparse_matrix_aij.hh"
%pythoncode %{
import scipy.sparse
import numpy as _np
class AkantuSparseMatrix (scipy.sparse.coo_matrix) :
def __init__(self,aka_sparse):
self.aka_sparse = aka_sparse
matrix_type = self.aka_sparse.getMatrixType()
sz = self.aka_sparse.size()
row = self.aka_sparse.getIRN()[:,0] -1
col = self.aka_sparse.getJCN()[:,0] -1
data = self.aka_sparse.getA()[:,0]
row = row.copy()
col = col.copy()
data = data.copy()
if matrix_type == _symmetric:
non_diags = (row != col)
row_sup = col[non_diags]
col_sup = row[non_diags]
data_sup = data[non_diags]
col = _np.concatenate((col,col_sup))
row = _np.concatenate((row,row_sup))
data = _np.concatenate((data,data_sup))
scipy.sparse.coo_matrix.__init__(self,(data, (row,col)),shape=(sz,sz))
%}
Event Timeline
Log In to Comment