# [SciPy-Dev] Strange results by eigs

Nils Wagner nwagner@iam.uni-stuttgart...
Fri Oct 21 09:15:57 CDT 2011

```On Thu, 20 Oct 2011 16:39:28 -0400
josef.pktd@gmail.com wrote:
> On Thu, Oct 20, 2011 at 4:16 PM, Pauli Virtanen
><pav@iki.fi> wrote:
>> (20.10.2011 19:57), Nils Wagner wrote:
>> [clip]
>>> It means that there is no check for B inside eigs.
>>> IMHO, a warning should be raised if B is not hermitian
>>> positive (semi-)definite.
>>
>> That could be useful.
>>
>> Checking PD is may be more expensive since it requires
>>trying to do a
>> Cholesky decomposition. Would need some benchmarks to
>>check whether it
>> matters.
>>
>> It's also possible to do the check only for dense
>>matrices. Scipy
>> doesn't have a sparse Cholesky at the moment, and
>>moreover, the linear
>> operator can be an arbitrary function with no way to
>>obtain the transpose.
>
> none of the scipy numpy eigh functions do a check.
>
> Since I use them mostly for gram, covariance matrices,
> know it's symmetric, I wouldn't like any expensive
>checks, in linalg,
> I don't use sparse so far.
>
> user responsibility to check the doc string ?
>
> Josef
>
>>

from scipy.sparse.linalg import eigs
help (eigs)
>>> scipy.__version__
'0.10.0b2'

The docstring of eigs is misleading in that context.

M must represent a real symmetric matrix.  For
best results, M should
be of the same type as A.  Additionally:
* If sigma==None, M is positive definite
* If sigma is specified, M is positive
semi-definite
If sigma==None, eigs requires an operator to
compute the solution
of the linear equation `M * x = b`. This is done
internally via a
(sparse) LU decomposition for an explicit matrix
M, or via an
iterative solver for a general linear operator.
Alternatively,
the user can supply the matrix or operator Minv,
which gives
x = Minv * b = M^-1 * b

Nils
```