Showing 15 of 19 total issues
File newton.py
has 275 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
""" Basic Newton methods using Krylov subspace method. """
import numpy as np
from numpy.linalg import norm
Function hook_step
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def hook_step(A, b, trusted_region, hook_maxiter, hook_tol, nu=0, **opt):
Function tangent_vector
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def tangent_vector(func, x, mu, tangent_dmu=1e-7, dxi=None, **opt):
Function gmres
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def gmres(A, b, x0=None, krylov_tol=default_options["krylov_tol"],
Function gmres_factorize
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def gmres_factorize(A, r, krylov_tol=default_options["krylov_tol"],
Function newton_krylov
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def newton_krylov(func, x0, newton_tol, newton_maxiter, **opt):
Function continuation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def continuation(func, x, mu, delta, **opt):
Function newton_krylov_hook_gen
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def newton_krylov_hook_gen(func, x0, trusted_region,
Function continuation
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def continuation(func, x, mu, delta, **opt):
Function Jacobi
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def Jacobi(func, x0, jacobi_alpha, fx=None, **opt):
Function arnoldi_common
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def arnoldi_common(A, r, krylov_tol=default_options["krylov_tol"], **cfg):
""" Support generator for Arnoldi process
Parameters
-----------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function gmres_factorize
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def gmres_factorize(A, r, krylov_tol=default_options["krylov_tol"],
krylov_maxiter=default_options["krylov_maxiter"], **cfg):
"""
Execute a factorization :math:`AV = VQR`
to solve minimization problem :math:`|Ax-b| = |VQ(Ry-g)| = |Ry-g|`.
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function mgs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def mgs(vectors, eps=1e-9):
""" modified Gram-Schmit algorithm
Parameters
-----------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function trusted_region
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def trusted_region(self, v, eps, r0=None, p=2):
""" Estimate the trusted region in which the deviation is smaller than `eps`.
Parameters
------------
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function hook_step
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def hook_step(A, b, trusted_region, hook_maxiter, hook_tol, nu=0, **opt):
""" optimal hook step based on trusted region approach
Return :math:`x` which minimizes :math:`|Ax-b|`
under the constraint :math:`|x| < r`,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"