コード例 #1
0
ファイル: lsqr.py プロジェクト: dromanov/pykrylov
    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
コード例 #2
0
ファイル: lsmr.py プロジェクト: soply/pykrylov
    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
コード例 #3
0
ファイル: symmlq.py プロジェクト: PythonOptimizers/pykrylov
    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 = []
コード例 #4
0
ファイル: lsmr.py プロジェクト: hunse/pykrylov
    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
コード例 #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
コード例 #6
0
ファイル: lsmr.py プロジェクト: modeha/pykrylov
    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
コード例 #7
0
ファイル: symmlq.py プロジェクト: wyllmein2000/pykrylov
    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 = []
コード例 #8
0
ファイル: minres.py プロジェクト: PythonOptimizers/pykrylov
    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()
コード例 #9
0
ファイル: cg.py プロジェクト: dromanov/pykrylov
    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
コード例 #10
0
ファイル: cg.py プロジェクト: wyllmein2000/pykrylov
    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
コード例 #11
0
ファイル: craigmr.py プロジェクト: akkineniramesh/pykrylov
    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()
コード例 #12
0
ファイル: craigmr.py プロジェクト: wyllmein2000/pykrylov
    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()
コード例 #13
0
ファイル: tfqmr.py プロジェクト: wyllmein2000/pykrylov
    def __init__(self, op, **kwargs):
        KrylovMethod.__init__(self, op, **kwargs)

        self.name = 'Transpose-Free Quasi-Minimum Residual'
        self.acronym = 'TFQMR'
        self.prefix = self.acronym + ': '
コード例 #14
0
ファイル: bicgstab.py プロジェクト: dromanov/pykrylov
    def __init__(self, matvec, **kwargs):
        KrylovMethod.__init__(self, matvec, **kwargs)

        self.name = 'Bi-Conjugate Gradient Stabilized'
        self.acronym = 'Bi-CGSTAB'
        self.prefix = self.acronym + ': '
コード例 #15
0
ファイル: tfqmr.py プロジェクト: PythonOptimizers/pykrylov
    def __init__(self, op, **kwargs):
        KrylovMethod.__init__(self, op, **kwargs)

        self.name = 'Transpose-Free Quasi-Minimum Residual'
        self.acronym = 'TFQMR'
        self.prefix = self.acronym + ': '
コード例 #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 + ': '
コード例 #17
0
ファイル: cgs.py プロジェクト: dromanov/pykrylov
    def __init__(self, matvec, **kwargs):
        KrylovMethod.__init__(self, matvec, **kwargs)

        self.name = 'Conjugate Gradient Squared'
        self.acronym = 'CGS'
        self.prefix = self.acronym + ': '
コード例 #18
0
    def __init__(self, op, **kwargs):
        KrylovMethod.__init__(self, op, **kwargs)

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