Hi again, I want to select/access several columns from a sparse csc_matrix. The only way I could think of is the following enormously inefficient algorithm which basically initalizes a new lil_matrix (for assigments) and loops over all the specified columns and does sparse -> dense -> sparse. All this, to overcome the inability of using "multi-column" slices in csc_matrices.
def spSelCol(X, A): "insert doc string" n = size(X,0) d = size(A) X = X.tocsc() newX = sparse.lil_matrix((d,n)) for i in range(0, d): # sparse -> dense -> sparse: not good! newX[i,:] = X[:,A[i]].toarray().flatten() return newX.transpose() Is there any way the operation can be made more efficient or should I look elsewhere (CVXOPT Python toolbox ...) Thanks, /David
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion