I'm reading a paper but their code is in python so I decided to convert it to Matlab code to adapt with my work. However, there is this little block of code that I don't understand.
S = scipy.sparse.csr_matrix((D, (R, C)), shape=(r, old_dim))
MSt = scipy.sparse.csr_matrix.dot(M, S.T)
Could anyone please explain what they are trying to do here? what does the above line mean? NB: the variables D, R and C are arrays/matrices derived from
C = np.arange(old_dim)
R = np.random.random_integers(r, size=old_dim) - 1
D = np.random.randint(2, size=old_dim) * 2 - 1
% also r and old_dim are dimension sizes e.g 5 or 10
I understand this part. I just dont know what sparse.csr_matrix(D,(R,C) means and how what could e it's Matlab equivalent.
Aucun commentaire:
Enregistrer un commentaire