Esempio n. 1
0
    def __init__(self, A, **kwargs):

        # Initialize.
        KrylovMethod.__init__(self, A, **kwargs)
        self.name = 'Least-Squares QR'
        self.acronym = 'LSQR'
        self.prefix = self.acronym + ': '

        self.msg=['The exact solution is  x = 0                              ',
                  'Ax - b is small enough, given atol, btol                  ',
                  'The least-squares solution is good enough, given atol     ',
                  'The estimate of cond(Abar) has exceeded conlim            ',
                  'Ax - b is small enough for this machine                   ',
                  'The least-squares solution is good enough for this machine',
                  'Cond(Abar) seems to be too large for this machine         ',
                  'The iteration limit has been reached                      ',
                  'The trust-region boundary has been hit                    ']

        self.A = A
        self.x = None ; self.var = None

        self.itn = 0; self.istop = 0
        self.Anorm = 0.; self.Acond = 0. ; self.Arnorm = 0.
        self.xnorm = 0.;
        self.r1norm = 0.; self.r2norm = 0.
        self.optimal = False
        self.resids = []             # Least-squares objective function values.
        self.normal_eqns_resids = [] # Residuals of normal equations.
        return
Esempio n. 2
0
    def __init__(self, A, **kwargs):

        # Initialize.
        KrylovMethod.__init__(self, A, **kwargs)
        self.name = 'Least-Squares Minimum Residual'
        self.acronym = 'LSMR'
        self.prefix = self.acronym + ': '

        self.msg=('The exact solution is  x = 0                              ',
                  'Ax - b is small enough, given atol, btol                  ',
                  'The least-squares solution is good enough, given atol     ',
                  'The estimate of cond(Abar) has exceeded conlim            ',
                  'Ax - b is small enough for this machine                   ',
                  'The least-squares solution is good enough for this machine',
                  'Cond(Abar) seems to be too large for this machine         ',
                  'The iteration limit has been reached                      ',
                  'The truncated direct error is small enough, given etol    ')

        self.A = A
        self.x = None ; self.var = None

        self.itn = 0; self.istop = 0
        self.Anorm = 0.; self.Acond = 0. ; self.Arnorm = 0.
        self.xnorm = 0.;
        self.r1norm = 0.; self.r2norm = 0.
        self.optimal = False
        self.resids = []             # Least-squares objective function values.
        self.normal_eqns_resids = [] # Residuals of normal equations.
        self.norms = []              # Squared energy norm of iterates.
        self.dir_errors_window = []  # Direct error estimates.
        self.iterates = []
        return
Esempio n. 3
0
    def __init__(self, op, **kwargs):
        KrylovMethod.__init__(self, op, **kwargs)

        self.name = 'Symmetric Indefinite Lanczos with Orthogonal Factorization'
        self.acronym = 'SYMMLQ'
        self.prefix = self.acronym + ': '
        self.iterates = []
Esempio n. 4
0
    def __init__(self, A, **kwargs):

        # Initialize.
        KrylovMethod.__init__(self, A, **kwargs)
        self.name = "Least-Squares Minimum Residual"
        self.acronym = "LSMR"
        self.prefix = self.acronym + ": "

        self.msg = (
            "The exact solution is  x = 0                              ",
            "Ax - b is small enough, given atol, btol                  ",
            "The least-squares solution is good enough, given atol     ",
            "The estimate of cond(Abar) has exceeded conlim            ",
            "Ax - b is small enough for this machine                   ",
            "The least-squares solution is good enough for this machine",
            "Cond(Abar) seems to be too large for this machine         ",
            "The iteration limit has been reached                      ",
        )

        self.A = A
        self.x = None
        self.var = None

        self.itn = 0
        self.istop = 0
        self.Anorm = 0.0
        self.Acond = 0.0
        self.Arnorm = 0.0
        self.xnorm = 0.0
        self.r1norm = 0.0
        self.r2norm = 0.0
        self.optimal = False
        self.resids = []  # Least-squares objective function values.
        self.normal_eqns_resids = []  # Residuals of normal equations.
        return
Esempio n. 5
0
    def __init__(self, op, **kwargs):

        #  Initialize
        self.acronym = 'MINRES'
        self.first = 'Enter minres.   '
        self.last = 'Exit  minres.   '
        self.msg = [
            ' beta2 = 0.  If M = I, b and x are eigenvectors    ',  # -1
            ' beta1 = 0.  The exact solution is  x = 0          ',  #  0
            ' A solution to Ax = b was found, given rtol        ',  #  1
            ' A least-squares solution was found, given rtol    ',  #  2
            ' Reasonable accuracy achieved, given eps           ',  #  3
            ' x has converged to an eigenvector                 ',  #  4
            ' acond has exceeded 0.1/eps                        ',  #  5
            ' The iteration limit was reached                   ',  #  6
            ' Aname  does not define a symmetric matrix         ',  #  7
            ' Mname  does not define a symmetric matrix         ',  #  8
            ' Mname  does not define a pos-def preconditioner   ',  #  9
            'The truncated direct error is small enough, given etol'
        ]  # 10

        KrylovMethod.__init__(self, op, **kwargs)

        self.name = 'Minimum Residual'
        self.acronym = 'MINRES'
        self.prefix = self.acronym + ': '
        self.residHistory = []  # Residual norms.
        self.resids = []  # Residual vectors.
        self.dir_errors_window = []  # Direct error estimates.
        self.iterates = []

        self.eps = np.finfo(np.double).eps
Esempio n. 6
0
    def __init__(self, A, **kwargs):

        # Initialize.
        KrylovMethod.__init__(self, A, **kwargs)
        self.name = 'Least-Squares Minimum Residual'
        self.acronym = 'LSMR'
        self.prefix = self.acronym + ': '

        self.msg=('The exact solution is  x = 0                              ',
                  'Ax - b is small enough, given atol, btol                  ',
                  'The least-squares solution is good enough, given atol     ',
                  'The estimate of cond(Abar) has exceeded conlim            ',
                  'Ax - b is small enough for this machine                   ',
                  'The least-squares solution is good enough for this machine',
                  'Cond(Abar) seems to be too large for this machine         ',
                  'The iteration limit has been reached                      ',
                  'The truncated direct error is small enough, given etol    ')

        self.A = A
        self.x = None ; self.var = None

        self.itn = 0; self.istop = 0
        self.Anorm = 0.; self.Acond = 0. ; self.Arnorm = 0.
        self.xnorm = 0.;
        self.r1norm = 0.; self.r2norm = 0.
        self.optimal = False
        self.resids = []             # Least-squares objective function values.
        self.normal_eqns_resids = [] # Residuals of normal equations.
        self.norms = []              # Squared energy norm of iterates.
        self.dir_errors_window = []  # Direct error estimates.
        self.iterates = []
        return
Esempio n. 7
0
    def __init__(self, op, **kwargs):
        KrylovMethod.__init__(self, op, **kwargs)

        self.name = 'Symmetric Indefinite Lanczos with Orthogonal Factorization'
        self.acronym = 'SYMMLQ'
        self.prefix = self.acronym + ': '
        self.iterates = []
Esempio n. 8
0
    def __init__(self, op, **kwargs):

        #  Initialize
        self.acronym = 'MINRES'
        self.first = 'Enter minres.   '
        self.last  = 'Exit  minres.   '
        self.msg = [' beta2 = 0.  If M = I, b and x are eigenvectors    ',     # -1
                    ' beta1 = 0.  The exact solution is  x = 0          ',     #  0
                    ' A solution to Ax = b was found, given rtol        ',     #  1
                    ' A least-squares solution was found, given rtol    ',     #  2
                    ' Reasonable accuracy achieved, given eps           ',     #  3
                    ' x has converged to an eigenvector                 ',     #  4
                    ' acond has exceeded 0.1/eps                        ',     #  5
                    ' The iteration limit was reached                   ',     #  6
                    ' Aname  does not define a symmetric matrix         ',     #  7
                    ' Mname  does not define a symmetric matrix         ',     #  8
                    ' Mname  does not define a pos-def preconditioner   ',     #  9
                    'The truncated direct error is small enough, given etol']  # 10

        KrylovMethod.__init__(self, op, **kwargs)

        self.name = 'Minimum Residual'
        self.acronym = 'MINRES'
        self.prefix = self.acronym + ': '
        self.residHistory = []     # Residual norms.
        self.resids = []           # Residual vectors.
        self.dir_errors_window = []  # Direct error estimates.
        self.iterates = []

        self.eps = machine_epsilon()
Esempio n. 9
0
    def __init__(self, matvec, **kwargs):
        KrylovMethod.__init__(self, matvec, **kwargs)

        self.name = 'Conjugate Gradient'
        self.acronym = 'CG'
        self.prefix = self.acronym + ': '
        self.resids = []

        # Direction of nonconvexity if A is not positive definite
        self.infiniteDescent = None
Esempio n. 10
0
    def __init__(self, op, **kwargs):
        KrylovMethod.__init__(self, op, **kwargs)

        self.name = 'Conjugate Gradient'
        self.acronym = 'CG'
        self.prefix = self.acronym + ': '
        self.resids = []
        self.iterates = []

        # Direction of nonconvexity if A is not positive definite
        self.infiniteDescent = None
Esempio n. 11
0
    def __init__(self, A, **kwargs):

        # Initialize.
        KrylovMethod.__init__(self, A, **kwargs)
        self.name = 'Least-Norm Minimum Residual'
        self.acronym = 'CRAIG-MR'
        self.prefix = self.acronym + ': '

        self.msg=('The exact solution is  x = 0                              ',
                  'Ax - b is small enough, given atol, btol                  ',
                  'The least-squares solution is good enough, given atol     ',
                  'The estimate of cond(Abar) has exceeded conlim            ',
                  'Ax - b is small enough for this machine                   ',
                  'The least-squares solution is good enough for this machine',
                  'Cond(Abar) seems to be too large for this machine         ',
                  'The iteration limit has been reached                      ',
                  'The truncated direct error is small enough, given etol    ')

        self.A = A
        self.init_data()
Esempio n. 12
0
    def __init__(self, A, **kwargs):

        # Initialize.
        KrylovMethod.__init__(self, A, **kwargs)
        self.name = 'Least-Norm Minimum Residual'
        self.acronym = 'CRAIG-MR'
        self.prefix = self.acronym + ': '

        self.msg = (
            'The exact solution is  x = 0                              ',
            'Ax - b is small enough, given atol, btol                  ',
            'The least-squares solution is good enough, given atol     ',
            'The estimate of cond(Abar) has exceeded conlim            ',
            'Ax - b is small enough for this machine                   ',
            'The least-squares solution is good enough for this machine',
            'Cond(Abar) seems to be too large for this machine         ',
            'The iteration limit has been reached                      ',
            'The truncated direct error is small enough, given etol    ')

        self.A = A
        self.init_data()
Esempio n. 13
0
    def __init__(self, op, **kwargs):
        KrylovMethod.__init__(self, op, **kwargs)

        self.name = 'Transpose-Free Quasi-Minimum Residual'
        self.acronym = 'TFQMR'
        self.prefix = self.acronym + ': '
Esempio n. 14
0
    def __init__(self, matvec, **kwargs):
        KrylovMethod.__init__(self, matvec, **kwargs)

        self.name = 'Bi-Conjugate Gradient Stabilized'
        self.acronym = 'Bi-CGSTAB'
        self.prefix = self.acronym + ': '
Esempio n. 15
0
    def __init__(self, op, **kwargs):
        KrylovMethod.__init__(self, op, **kwargs)

        self.name = 'Transpose-Free Quasi-Minimum Residual'
        self.acronym = 'TFQMR'
        self.prefix = self.acronym + ': '
Esempio n. 16
0
    def __init__(self, op, **kwargs):
        KrylovMethod.__init__(self, op, **kwargs)

        self.name = 'Bi-Conjugate Gradient Stabilized'
        self.acronym = 'Bi-CGSTAB'
        self.prefix = self.acronym + ': '
Esempio n. 17
0
    def __init__(self, matvec, **kwargs):
        KrylovMethod.__init__(self, matvec, **kwargs)

        self.name = 'Conjugate Gradient Squared'
        self.acronym = 'CGS'
        self.prefix = self.acronym + ': '
Esempio n. 18
0
    def __init__(self, op, **kwargs):
        KrylovMethod.__init__(self, op, **kwargs)

        self.name = 'Conjugate Gradient Squared'
        self.acronym = 'CGS'
        self.prefix = self.acronym + ': '