Skip to content

tol parameter wrong for isolve routines (Trac #939) #1466

@scipy-gitbot

Description

@scipy-gitbot

Original ticket http://projects.scipy.org/scipy/ticket/939 on 2009-05-03 by @pv, assigned to @wnbell.

The tol parameter in the scipy.sparse.linalg.isolve.* routines is documented wrong. The documentation says:

    tol : float
        Relative tolerance to achieve before terminating.

However, the algorithms terminate as if tol was absolute tolerance (in addition to being relative tolerance; STOPTEST2 anyway treats tol as relative tolerance only):

>>> import scipy.sparse.linalg as la
>>> import numpy as np
>>> A = np.array([[1,0],[0,-1]])
>>> A = np.array([[1,0],[0,-1.]])
>>> b = np.array([1,-1]) * 1e-9
>>> la.gmres(A, b, tol=1e-8)
(array([ 0.,  0.]), 0)
>>> la.gmres(A, b, tol=1e-12)
(array([  1.00000000e-09,   1.00000000e-09]), 0)
>>> la.bicgstab(A, b, tol=1e-8)
(array([ 0.,  0.]), 0)
>>> la.bicgstab(A, b, tol=1e-12)
(array([ NaN,  NaN]), 1)

Is this the intended behaviour? Should the documentation or the code be fixed?

Some changes to behavior were apparently made in 9a40153, possibly erroneously.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions