I am new to Python, and I try to convert code from MATLAB to Python (numpy) .
I have the following code in MATLAB that create sparse matrix:
obj{i,j} = sparse(IR,IV,ones(length(val),1),length(ids{i}),length(vid{j}));
IR & IV are vectors.
What is the efficient way to implement that function in Python (numpy) ?
Thanks,
MAK
csr_matrix((np.ones(len(u)), (u, v)), shape=(N, N)). (I call this thecoostyle inpu. The number of () is important.coo,csrandcsctake this style;bsrdoes not.