[SciPy-User] sparse matrix construction question

Eric Carlson ecarlson@eng.ua....
Sat Apr 14 07:52:25 CDT 2012


perfect - thanks for the assist

On 4/13/2012 3:16 PM, Christopher Mutel wrote:
> One easy way is to construct a new CSR matrix, extending on the numpy
> arrays "data", "indptr", and "indices" from the original matrix.
> Because the I can never quite figure out the CSR format, I usually
> convert to a COO matrix, where it is easy to extend the "data", "row",
> and "col" numpy arrays. This can be slower, but is definitely much
> faster than the LIL matrix conversion.
>
> See e.g. http://stackoverflow.com/questions/6844998/is-there-an-efficient-way-of-concatenating-scipy-sparse-matrices
>
> -Chris
>
> On Fri, Apr 13, 2012 at 9:47 PM, Eric Carlson<ecarlson@eng.ua.edu>  wrote:
>> Hello,
>> I have a million row sparse matrix that can be created almost
>> instantaneously using spdiags and csr format. I need to add one column
>> and one row, and insert some nonzeros at various (symmetric) locations
>> in the row and columns. I can easily accomplish this using lil format,
>> but this increases the construction to around 20 seconds from about .05
>> seconds.
>>
>> I can probably work something out in fortran + f2py pretty easily, but ...
>>
>> Any python sparse matrix wizards out there with some tips?
>>
>> Cheers,
>> Eric Carlson
>>
>> _______________________________________________
>> SciPy-User mailing list
>> SciPy-User@scipy.org
>> http://mail.scipy.org/mailman/listinfo/scipy-user




More information about the SciPy-User mailing list