Alright, may all the trickery rest until that day. One thing I need to do however is patch a column of "ones" onto a sparse matrix of format n * d with n >> d. I tried "concatenate" and it didn't work so I did like this:
def spInsCol(X): "insert doc string" n, d = shape(X) X = X.tocsc() newX = sparse.lil_matrix((d + 1,n)) newX[0,:] = ones(n) for i in range(1, d + 1): newX[i,:] = X[:,i - 1].toarray().flatten() return newX.transpose() It basically, blows each column in the old matrix to dense format and assigns it to a row in a new matrix which already contains an extra row of ones. In the end I transpose. Is there a simpler and more efficient solution? Thank you, David
_______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion