# [SciPy-user] Obtaining factors of sparse matrices

josef.pktd@gmai... josef.pktd@gmai...
Thu Apr 2 23:24:45 CDT 2009

```On Fri, Apr 3, 2009 at 12:15 AM,  <josef.pktd@gmail.com> wrote:
> On Thu, Apr 2, 2009 at 11:02 PM, Bill Cochran <wkcochran@gmail.com> wrote:
>> I am new to scipy.  I would like to compare fill-in between a standard GEPP and
>> one that I have developed to schedule pivoting in parallel codes.  My matrices
>> are large and sparse.  In MATLAB code, I need this:
>>
>> [L,U] = lu ( A )
>> nnz(U)
>>
>> I have looked at the scipy documentation and I believe the function I am looking
>> for is sparse.linalg.splu (...).  I do not know what permc_spec means.  Neither
>> I nor Google know what a "factored_lu" object is.  And I don't understand the
>> instruction:  "See scipy.sparse.linalg.dsolve._superlu.dgstrf for more info."
>> Neither does Google.
>
> I'm just looking up the source, I don't know this part of scipy:
>
> the above means that the only documentation of the details is in the c source
>
> e.g.
> http://projects.scipy.org/scipy/browser/trunk/scipy/sparse/linalg/dsolve/_dsuperlumodule.c#L124
> 144     permc_spec          specifies the matrix ordering used for the
> factorization\n\
> 145                         0: natural ordering\n\
> 146                         1: MMD applied to the structure of A^T * A\n\
> 147                         2: MMD applied to the structure of A^T + A\n\
> 148                         3: COLAMD, approximate minimum degree column ordering\n\
> 149                         (default: 2)\n\
>
> and
> http://projects.scipy.org/scipy/browser/trunk/scipy/sparse/linalg/dsolve/SuperLU/SRC/dgstrf.c#L25
>
> splu is just a thin wrapper around dgrstrf (for double), see
> http://projects.scipy.org/scipy/browser/trunk/scipy/sparse/linalg/dsolve/linsolve.py#L103
>
> if umfpack (scikits) is installed, than LU is calculated using umfpack
>
> That's browsing the source, for more info you need someone who knows
> this part. The return type of functions, I usually just inspect for an
> example dir(result), ...
>
> Josef
>
>>
>> Any help would be appreciated.  I am kind of crunched for time and thought I'd
>> see if scipy lived up to the hype.  Please help scipy live up to the hype.
>>
>> _______________________________________________

just one more reference, I think this part of sparse linalg came from pysparse:

http://pysparse.sourceforge.net/fact.html#module-pysparseSuperLU

Josef
```

More information about the SciPy-user mailing list