[SciPy-user] Trouble with linsolve

Nils Wagner nwagner at iam.uni-stuttgart.de
Tue Nov 28 09:42:33 CST 2006


Nils Wagner wrote:
> Hi all,
>
> I would like to solve
>
> K_dyn x = f,
>
> where K_dyn is a sparse matrix.  UMFPACK is not installed and I am using
> the latest svn version.
>
>   
>>>> K_dyn
>>>>         
> <71987x71987 sparse matrix of type '<type 'numpy.float64'>'
>         with 3083884 stored elements (space for 3083884)
>         in Compressed Sparse Column format>
>   
>>>> f
>>>>         
> <71987x1 sparse matrix of type '<type 'numpy.float64'>'
>         with 52 stored elements (space for 52)
>         in Compressed Sparse Column format>
>   
>>>> x = spsolve(K_dyn, f)
>>>>         
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File
> "/usr/local/lib64/python2.4/site-packages/scipy/linsolve/linsolve.py",
> line 75, in spsolve
>     b = asarray(b, dtype=data.dtype)
>   File "/usr/local/lib64/python2.4/site-packages/numpy/core/numeric.py",
> line 132, in asarray
>     return array(a, dtype, copy=False, order=order)
> ValueError: setting an array element with a sequence.
>
> Is this a bug ?
>
> Nils
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>   

With UMFPACK V4.4 I get

    x = spsolve(K_dyn, f)
  File "/usr/lib64/python2.4/site-packages/scipy/linsolve/linsolve.py",
line 65, in spsolve
    return umf.linsolve( umfpack.UMFPACK_A, mat, b, autoTranspose = True )
  File
"/usr/lib64/python2.4/site-packages/scipy/linsolve/umfpack/umfpack.py",
line 566, in linsolve
    sol = self.solve( sys, mtx, rhs, autoTranspose )
  File
"/usr/lib64/python2.4/site-packages/scipy/linsolve/umfpack/umfpack.py",
line 508, in solve
    self._numeric, self.control, self.info )
  File
"/usr/lib64/python2.4/site-packages/scipy/linsolve/umfpack/_umfpack.py",
line 214, in umfpack_di_solve
    return __umfpack.umfpack_di_solve(*args)
TypeError: not an array

>>> K_dyn
<71987x71987 sparse matrix of type '<type 'numpy.float64'>'
        with 3083884 stored elements (space for 3083884)
        in Compressed Sparse Column format>
>>> f
<71987x1 sparse matrix of type '<type 'numpy.float64'>'
        with 52 stored elements (space for 52)
        in Compressed Sparse Column format>
>>> shape(f)
(71987, 1)
>>> shape(K_dyn)
(71987, 71987)
>>> type(f)
<class 'scipy.sparse.sparse.csc_matrix'>
>>> type(K_dyn)
<class 'scipy.sparse.sparse.csc_matrix'>

Any pointer would be appreciated.

Nils

Numpy version 1.0.1.dev3462
Scipy version 0.5.2.dev2334
amd_info:
    libraries = ['amd']
    library_dirs = ['/usr/local/src/UMFPACKv4.4/AMD/Lib']
    define_macros = [('SCIPY_AMD_H', None)]
    swig_opts = ['-I/usr/local/src/UMFPACKv4.4/AMD/Include']
    include_dirs = ['/usr/local/src/UMFPACKv4.4/AMD/Include']

umfpack_info:
    libraries = ['umfpack', 'amd']
    library_dirs = ['/usr/local/src/UMFPACKv4.4/UMFPACK/Lib',
'/usr/local/src/UMFPACKv4.4/AMD/Lib']
    define_macros = [('SCIPY_UMFPACK_H', None), ('SCIPY_AMD_H', None)]
    swig_opts = ['-I/usr/local/src/UMFPACKv4.4/UMFPACK/Include',
'-I/usr/local/src/UMFPACKv4.4/AMD/Include']
    include_dirs = ['/usr/local/src/UMFPACKv4.4/UMFPACK/Include',
'/usr/local/src/UMFPACKv4.4/AMD/Include']



More information about the SciPy-user mailing list