I reduced the problem to a difference of results with eigsh when
working in shift-invert mode and when not. Notice that the following
works with sigma=None but not with sigma=0. , thus seems to me that we
should fall back to non invert-mode for singular matrices (see
asociated pull request).

```
In [8]: M = sparse.csr_matrix([[1, 1, 1], [1, 1, 1], [1, 1, 1.]])

In [9]: linalg.eigsh(M, 1)
Out[9]:
(array([ 3.]),
 array([[-0.57735027],
       [-0.57735027],
       [-0.57735027]]))

In [10]: linalg.eigsh(M, 1, sigma=0.)
---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/home/fabian/dev/sandbox/<ipython-input-10-f646f5be93ec> in <module>()
----> 1 linalg.eigsh(M, 1, sigma=0.)

/home/fabian/envs/p26/lib/python2.6/site-packages/scipy/sparse/linalg/eigen/arpack/arpack.pyc
in eigsh(A, k, M, sigma, which, v0, ncv, maxiter, tol,
return_eigenvectors, Minv, OPinv, mode)
   1484             if OPinv is None:
   1485                 Minv_matvec = get_OPinv_matvec(A, M, sigma,
-> 1486                                                symmetric=True, tol=tol)
   1487             else:
   1488                 OPinv = _aslinearoperator_with_dtype(OPinv)

/home/fabian/envs/p26/lib/python2.6/site-packages/scipy/sparse/linalg/eigen/arpack/arpack.pyc
in get_OPinv_matvec(A, M, sigma, symmetric, tol)
   1004 def get_OPinv_matvec(A, M, sigma, symmetric=False, tol=0):
   1005     if sigma == 0:
-> 1006         return get_inv_matvec(A, symmetric=symmetric, tol=tol)
   1007
   1008     if M is None:

/home/fabian/envs/p26/lib/python2.6/site-packages/scipy/sparse/linalg/eigen/arpack/arpack.pyc
in get_inv_matvec(M, symmetric, tol)
    997         if isspmatrix_csr(M) and symmetric:
    998             M = M.T
--> 999         return SpLuInv(M).matvec
   1000     else:
   1001         return IterInv(M, tol=tol).matvec

/home/fabian/envs/p26/lib/python2.6/site-packages/scipy/sparse/linalg/eigen/arpack/arpack.pyc
in __init__(self, M)
    890     """
    891     def __init__(self, M):
--> 892         self.M_lu = splu(M)
    893         LinearOperator.__init__(self, M.shape, self._matvec,
dtype=M.dtype)
    894         self.isreal = not np.issubdtype(self.dtype, np.complexfloating)

/home/fabian/envs/p26/lib/python2.6/site-packages/scipy/sparse/linalg/dsolve/linsolve.pyc
in splu(A, permc_spec, diag_pivot_thresh, drop_tol, relax, panel_size,
options)
    171         _options.update(options)
    172     return _superlu.gstrf(N, A.nnz, A.data, A.indices, A.indptr,
--> 173                           ilu=False, options=_options)
    174
    175 def spilu(A, drop_tol=None, fill_factor=None, drop_rule=None,
permc_spec=None,

RuntimeError: Factor is exactly singular

In [11]:
```

------------------------------------------------------------------------------
Cloud Services Checklist: Pricing and Packaging Optimization
This white paper is intended to serve as a reference, checklist and point of 
discussion for anyone considering optimizing the pricing and packaging model 
of a cloud services business. Read Now!
http://www.accelacomm.com/jaw/sfnl/114/51491232/
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to